1. SVGA sprites ... help!

Hi. I've been experimenting with doing graphics in SVGA modes ...
specifically, loading in sprites (16x16x256 bmps) and displaying 'em.
Since I need them to be transparent, I hacked up the display_image()
procedure, but that only made it even slower ... so I downloaded
ememcopy ...

Can someone explain to me how to use ememcopy to 'blit' (is that the
right term? pleased) these sprites to the screen? I imagine I'll need to
have quite a few of them available at once ... say, 50. The ememcopy.e
file wasn't very helpful, and I wrote to the author of ememcopy but
didn't receive a response. So, can someone give me some sample code on
how to do this, using ememcopy or some other means, using any of the
SVGA modes? Thanks again. ;)

DARREN HEWER, darren_hewer at hotmail.com
Humble subordinate of Autumn Dreams
(http://members.tripod.com/~adpage)
emmzee on #megazeux
"Buh-bye everybudy! Have a nice day!"

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

2. Re: SVGA sprites ... help!

Why not try one of the available graphics engines. I don't know of any off
hand (except I know Ralf has one). Check the EUPHORIA home page.

Oh. Wait. These engines may not handle SVGA, huh...? Whoops.

Too bad I already sent this message. Otherwise, I could just delete this
and keep my mouth shut about it.

-ck

Darren Hewer wrote:

> Hi. I've been experimenting with doing graphics in SVGA modes ...
> specifically, loading in sprites (16x16x256 bmps) and displaying 'em.
> Since I need them to be transparent, I hacked up the display_image()
> procedure, but that only made it even slower ... so I downloaded
> ememcopy ...
>
> Can someone explain to me how to use ememcopy to 'blit' (is that the
> right term? pleased) these sprites to the screen? I imagine I'll need to
> have quite a few of them available at once ... say, 50. The ememcopy.e
> file wasn't very helpful, and I wrote to the author of ememcopy but
> didn't receive a response. So, can someone give me some sample code on
> how to do this, using ememcopy or some other means, using any of the
> SVGA modes? Thanks again. ;)
>
> DARREN HEWER, darren_hewer at hotmail.com
> Humble subordinate of Autumn Dreams
> (http://members.tripod.com/~adpage)
> emmzee on #megazeux
> "Buh-bye everybudy! Have a nice day!"
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: SVGA sprites ... help!

I've got a svga graphics engine in the works... it handles virtual
screens, loading bitmaps (even true-color), transparent blits, and
clipping... all in machine code for extra speed.

I'm slapping together a simple game demo right now, and would appreciate
some decent graphics if anyone has any to spare... characters, bullets,
explosions, tiles, anything!  I'm too lazy to draw my own!

Just for fun, here's some preliminary documentation (generated by
Einar's wonderful COMM2DOC prog...)

<neil.e>

 A Graphics Library named Neil
 Pete Eberlein <xseal at harborside.com>
 July 4, 1998 - Sept. 15, 1998

:global procedure set_width(integer width)
   sets the virtual width of the screen


:global function mode_x(integer width, integer height)
   attempts to switch to mode X
   returns 0 on success, 1 otherwise


:global function vesa_mode(integer width, integer height, integer bpp)
   attempts to set a VESA mode
   returns 0 on success, 1 otherwise


:global function gfx_mode(integer width, integer height, integer bpp)
   Attempts to set a graphics mode of the desired width, height and
color
   depth.  Valid color depths (bpp) are: 8, 15, 16, 24, 32.
   See also: make_rgb_map, restore_mode


:global procedure restore_mode()
   Restores the graphics mode the one present when ex.exe started.
   Same as graphics_mode(-1) except it's not a function smile


:global function virtual_screen(integer width, integer height)
   creates a virtual screen.  The handle is actually a memory address,
the
   screen is linear - you may peek and poke to your hearts content.
   returns the handle (atom)


:global function sub_screen(atom source, integer x1, integer y1, integer
width, integer height)
   creates a sub-screen on the virtual screen "source" at the position
"x1,y1",
   with the dimensions "width" and "height"
   returns (atom) the handle to the sub-screen
   *** do not poke around on the memory address returned ***
   *** do not use sub-screens with pixel or get_pixel ***


:global procedure free_screen(atom handle)
   frees the memory associated with a virtual screen


:global procedure pan_screen(atom handle, sequence pos)
   changes the relative position of blits to the virtual screen
   pan(screen, {50,50}) -- all sprites on the screen are subsequently
                        -- 50 pixels up and to the left.


:global procedure make_rgb_map()
   Enables true-color conversions in an 8-bit mode and creates the
necessary
   32x32x32 lookup table using a fast recursive floodfill method.
   If the palette changes, i.e. a call to all_palette, you must do
   make_rgb_map again afterward.
   See also: gfx_mode, load_bitmap


:global function rgb(object r, object g, object b)
   convert 24-bit rgb's into current pixel depth


:global function rgb_pal(sequence Palette)
   convert 24-bit palette entries into current pixel depth


:global procedure pixel(object data, sequence xy)
   draws a pixel on the screen or virtual screen (xy[3] may =
virtual_screen)


:global function get_pixel(sequence xy)
   gets pixels from the screen or a virtual screen (xy[4] may =
virtual_screen)


:global procedure display_image(sequence i, sequence pos)
   display a 2-d sequence on the screen (pos[3] may = virtual_screen)


:global procedure Blit(sequence src, sequence dest)

   slower Blit, used for debugging/comparing the banked blit


:global function load_bitmap(sequence file_name)
   read a bitmap (.BMP) file into a new virtual screen
   Bitmaps are automatically converted to the current color depth.
   True-color to 8-bit conversion first requires make_rgb_map().
   To set the current palette to the bitmap's palette, set the global
   variable "use_bitmap_palette" to 1.
   return {virtual screen, width, height}
   See also: make_rgb_map, use_bitmap_palette


:global procedure move_command(atom handle, sequence disp)
   adds disp to the position of a sprite command handle


:global function get_dest_pos(atom handle)
   returns {dest_x, dest_y} of the command handle


:global procedure set_dest_pos(atom handle, sequence pos)
   sets the position of a sprite command handle
   pos can take: {x,y} -- only sets the position, command list depth
unchanged
                 {x,y,z} -- sets position and depth in the command list,
                         -- adding it to the command list if neccessary


:global function new_command(atom kind, object source, sequence dest)
   creates a new command in memory of type kind, and places it in the
command
   list if dest_z is present.  Returned is the command handle.
    kind can take: blit, clear_blit, mixer_blit, screen_blit
    source can take a source handle, {screen_handle,x,y,width,height},
          or {screen_handle,x,y,width,height,hot_x,hot_y}
    dest can take {screen_handle, dest_x, dest_y, dest_z}
          or {screen_handle, dest_x, dest_y}
   Note: if you use "screen" as the dest screen handle, you should only
    use screen_blit for kind.

   See also: set_dest_pos, move_command, set_source_handle,
remove_command,
             free_command, set_mix_table, set_rle_flags


:global procedure do_command(atom kind, object source, sequence dest)
   creates a new command in memory of type kind, and places it in the
command
   list if dest_z is present.  Returned is the command handle.
    kind can take: blit, clear_blit, mixer_blit, screen_blit
    source can take a source handle, {screen_handle,x,y,width,height},
          or {screen_handle,x,y,width,height,hot_x,hot_y}
    dest must take {screen_handle, dest_x, dest_y}

   See also: set_dest_pos, move_command, set_source_handle,
remove_command,
             free_command, set_mix_table, set_rle_flags


:global procedure set_source(atom handle, atom source)
   Sets the source handle of a command.
   See also: new_source, make_rle_sprite


:global procedure set_mix_table(atom handle, atom mix_table)
   Sets the mixing table associated with a sprite handle
   mix_table must take an atom from allocate(#10000)


:global procedure set_bit_mask(atom handle, atom flags)
   Sets the bit mask for a rle sprite.  This mask is AND'ed with the
value
   used with the hit_sprite function.  If the result is nonzero and the
   sprites touch, a successful hit occurs.


:global procedure execute_commands()
   Execute all the commands in the command list.  This will render all
the
   commands in the order from lowest to highest dest_z.


:global procedure remove_command(atom handle)
   Remove the command handle from the command list. The the memory is
not
   freed, so handle may still be used.


:global procedure free_command(atom handle)
   Free the memory associated with the command handle and removes it
from
   the command list if neccessary.  Further use of handle is not
recommended.


:global function new_source(object source)
   Creates a source handle with the properties described in source.
   source can take: {screen_handle,x,y,width,height}
                    {screen_handle,x,y,width,height,hot_x,hot_y}
                    or an atom of a virtual screen, where the source
takes
                        up the whole virtual screen
   Note: creating source handles instead of using a sequence, will allow
     faster creation of sprites and they can be easily animated by
changing
     the source handle using "set_source"
   See also: new_command, do_command, set_source


:global function make_rle_sprite(object source)
   Creates a run-length encoded sprite from the non-zero bytes on a
virtual
   screen.  Multi-byte pixels must be all zero to be transparent or all
   non-zero to be opaque.
    Source can take a screen handle (use the whole virtual screen),
          {screen_handle,x,y,width,height} or
          {screen_handle,x,y,width,height,hot_x,hot_y}
   See also: new_command, set_source


:global function hit_sprite(atom handle, atom bit_mask)
   Finds the first rle sprite whose pixels overlap rle sprite command
handle
   and whose bit_mask anded with bit_mask is non_zero.  Returns the
command
   handle of the hit sprite.  Use bit_mask to discern between different
types
   of sprites, i.e. power-ups, bad guys, bullets, etc.
   See also: set_bit_mask

Later,
--
 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu