- rename standard integer types to a more familiar (u)int(8/16/32) - many function/struct renames. i don't _really_ know if what i've done for this is better, but it "feels" better to me. many draw/blit function names are shorter which is nice, at least. kinda important to me because i develop this on a real DOS machine in 80x50 text mode. - add 'extern "C"' blocks to headers for C++ compiler usage - draw/pixel color value arguments for functions should all have been changed to be uint8 instead of a full 32-bit int. feels right, but maybe should've left alone... - small fix to keyboard handler. noticed a problem on one thinkpad laptop. was a result of what i think was a typo in a constant value used during the part of the interrupt handler that tells the keyboard controller the key event was processed - fix uncommon potential crash function return in draw_filled_rect - renamed low-level "direct" assembly functions to "lowlevel_xxx" to be a little bit more explicit about what they are - add some convenience event helper functions for determining event types - add fixed point atan2 - fixed some tabs/spaces inconsistences (should all be spaces now?) - maybe some other minor things i've forgotten
82 lines
1.6 KiB
C
Executable file
82 lines
1.6 KiB
C
Executable file
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include "dgl.h"
|
|
#include "dglgfx.h"
|
|
#include "helpers.h"
|
|
|
|
#include "blit.h"
|
|
#include "events.h"
|
|
#include "fixed.h"
|
|
#include "kbrd.h"
|
|
#include "line.h"
|
|
#include "mouse.h"
|
|
#include "pal.h"
|
|
#include "pcx.h"
|
|
#include "pset.h"
|
|
#include "rect.h"
|
|
#include "surface.h"
|
|
#include "text.h"
|
|
#include "vector2.h"
|
|
|
|
SURFACE *backbuffer = NULL;
|
|
|
|
void break_handler(int sig) {
|
|
exit(0);
|
|
}
|
|
|
|
int main(void) {
|
|
signal(SIGINT, break_handler);
|
|
|
|
dgl_init();
|
|
|
|
ASSERT(screen == NULL);
|
|
|
|
if (!gfx_init()) {
|
|
printf("Error initializing video: %s\n", dgl_last_error_message());
|
|
return 1;
|
|
}
|
|
|
|
ASSERT(screen != NULL);
|
|
ASSERT(screen->width == 320 && screen->height == 200);
|
|
|
|
backbuffer = surface_create(320, 200);
|
|
ASSERT(backbuffer != NULL);
|
|
ASSERT(backbuffer->width == 320 && backbuffer->height == 200);
|
|
|
|
test_keyboard();
|
|
test_mouse();
|
|
test_events();
|
|
test_fixed();
|
|
test_vec2i();
|
|
test_vec2();
|
|
test_surface_clear();
|
|
test_surface_copy();
|
|
test_pixels_1();
|
|
test_pixels_2();
|
|
test_pixels_clipping();
|
|
test_hline();
|
|
test_hline_clipping();
|
|
test_vline();
|
|
test_vline_clipping();
|
|
test_line();
|
|
test_line_clipping();
|
|
test_rect();
|
|
test_rect_clipping();
|
|
test_filled_rect();
|
|
test_filled_rect_clipping();
|
|
test_blit();
|
|
test_blit_clipping();
|
|
test_sprite();
|
|
test_sprite_clipping();
|
|
test_text();
|
|
test_text_clipping();
|
|
test_palette();
|
|
test_palette_fading();
|
|
test_pcx();
|
|
|
|
surface_free(backbuffer);
|
|
|
|
return 0;
|
|
}
|
|
|