However one problem is that the internal clock (I'm assuming PC clock) is too slow for most games.<br>
<br>
But if you're not timer-intesive then it will do just fine.<br>
<br>
-Xotor-<br>
<br>
: : : I am making a game like Final Fantasy 1 in C and need some help.<br>
: : : I am wondering how do I make a delay function that delays for any number of <br>
: : : seconds I choose? and how do I put in sprites into my game.<br>
: : : I am using djgpp and the allegro library.<br>
: <br>
: For delays, you can use the internal clock<br>
: <br>
: unsigned short *Clock = (unsigned short *)0x0000046CL; // Clock pointer<br>
: <br>
: void pause(int T) // Pause for clock ticks<br>
: {<br>
: unsigned short Now = *Clock;<br>
: while (*Clock - Now < T) <br>
: {<br>
: // Do nothing<br>
: }<br>
: }<br>
: <br>
: Or wait for the vertical retrace<br>
: <br>
: void vr()<br>
: {<br>
: while ((inp(0x03DA) & 0x08)) {};<br>
: while (!(inp(0x03DA) & 0x08)) {};<br>
: }<br>
: <br>
: Sprites? Are you asking how to define a sprite<br>
: struct or how to draw a sprite? Sprite struct<br>
: should appear something like this<br>
: <br>
: typedef struct _Sprite<br>
: {<br>
: int X, Y, W, H;<br>
: unsigned char *Image;<br>
: char Palette[768]; // optional<br>
: int Visible, Life, Power, Speed;<br>
: } Sprite;<br>
: <br>
: To draw the sprite, load an image file into<br>
: the Image -- don't feel like getting the code<br>
: -- then use a draw bitmap type function<br>
: <br>
: DrawBitmap(MySprite->Image);<br>
: <br>
<br>