Overview -------- This gives you the rest. The functions ------------- int wait_time(int arg1): sleep up to arg1 milliseconds. Call this function one time in your game loop to let the time your loop needs always be the same. This function does not sleep exactly arg1 milliseconds but only the time which is missing to arg1 according to the formel: [sleeping time] = arg1 - [time your loop needs] so that your loop always needs arg1 milliseconds. Do not give a time for arg1 which is too short. Return value: time in milliseconds since last call, that should be some value of arg1, if it is much greater then arg1 might be too small -1=error Example: wait_time(70); // sleep up to 70 milliseconds Note: wait_time() is not a sleep(). In the first call it saves a timestamp but does not wait. In the next calls it refers to the last timestamp to calculate the waiting time. The use of wait_time() in following example is useless: wait_time(50); /* first call: set timestamp but no waiting */ wait_for_pressing_a_key(); /* could take a long time */ wait_time(50); /* the time since last call is more than 50 milliseconds, so no waiting */ The use of wait_time() in following example is correct: wait_time(50); /* first call: set timestamp but no waiting */ while (true) { [ do something ] /* takes e.g. 30 milliseconds */ wait_time(50); /* wait 50-30=20 milliseconds */ } The programs ------------ vgag-bitmap: Convert an uncompressed windows bitmap file (.bmp) or a ppm graphic file into a vgagames graphic file (see function load_grafik() in Graphic box functions) and show the colormap of the file in a valid colormap format (see function load_colormap() in Color functions). The source graphic file must have a color depth of 256 or less colors. For the vgagames graphic file which is created the extension ".vga" is added. Usage: ./vgag-bitmap "bitmap-file.bmp" Creates: "bitmap-file.bmp.vga" For a description of a vgagames graphic file format please see function load_grafik() in Graphic box functions. Note: vgagames can also load and use windows bitmap and ppm graphic files, it is not necessary to convert them, but the loading of a vgagames graphic file is a bit faster.
Home | Previous: Network functions | Next: []