Forum

Draw rectangle?

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Draw rectangle?

Postby Stealth Kill » Sun Jun 08, 2008 2:53 pm

I need good ideas how to draw a rectangle.

I used this method

M_DrawTransPic (-20, 39, Draw_CachePic ("gfx/menu/A.lmp") );
M_DrawTransPic (-20, 39, Draw_CachePic ("gfx/menu/B.lmp") );
M_DrawTransPic (-20, 79, Draw_CachePic ("gfx/menu/A.lmp") );
M_DrawTransPic (113, 39, Draw_CachePic ("gfx/menu/B.lmp") );

A lmp looks like this _____
B lmp looks like this |

_______
|xxxxxxx|
|______|

This works but are there other methods?

Is it possible to draw a yelow pixel?
Like DrawYelowPixel (135, 2)
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Postby mh » Sun Jun 08, 2008 9:41 pm

You can write your own routines to do these (and you'll need to for drawing single pixels). Have a look at the actual drawing code in gl_draw.c - it's a hell of a lot simpler than may seem at first.

Draw_CachePic is fine for use in menus, but it's not really suitable for in-game use as it involves a load of run-time string comparisons (which are slow) and loads textures as required rather than at game start-up.

This is a very big subject so it's not really possible to be meaningful and helpful in the space of a single post, but if you like I can provide you with simple code for these that you can use as a basis for future experiments.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Stealth Kill » Mon Jun 09, 2008 12:14 pm

I found this in gl_draw.c

=============
Draw_Fill

Fills a box of pixels with a single color
=============
Draw_Fill (50, 50, 10, 2, 0)

It fills a box but i can make 4 lines with it to make a frame.

thanks :)
Stealth Kill
 
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest