#include #include #include "modules/engine/main.c" #include "modules/engine/frontend/sdl/main.c" #include "modules/engine/frontend/generic/textures.c" //#include "modules/engine/frontend/sdl/textures.c" // TODO void handleEvent(struct ENGINE_EVENT event) { if (event.type == ENGINE_EVENT_TYPE_EXIT) { exit(0); } } int frame = 0; int frameSec = 0; Uint32 lastSec = 0; char tr, tg, tb; struct ENGINE_TEXTURE * texture; void tick() { int y = 0; while (y < engine_height) { int x = 0; while (x < engine_width) { /*tr = (char)(x + y) + ((char)frame * 1); tg = (char)(x + y) + ((char)frame * 3); tb = (char)(x + y) + ((char)frame * 5);*/ /*tr = (char)(x + y) * (char)frame * 1; tg = (char)(x + y) * (char)frame * 3; tb = (char)(x + y) * (char)frame * 5;*/ tr = (char)((x * y) + 64) + frame; tg = (char)((x * y) + 128) + frame; tb = (char)((x * y) + 192) + frame; /*int part = engine_width / 3; if (x < part * 1) { tr = 255; tg = 0; tb = 0; } else if (x < part * 2) { tr = 0; tg = 255; tb = 0; } else { tr = 0; tg = 0; tb = 255; }*/ /*tr = 0; tg = 255 - ((char)((x * y) + 128) + frame); tb = 0;*/ /*tr = (char)(((float)x / (float)engine_width) * 255); tg = 255 - tr; tb = (char)(((float)y / (float)engine_height) * 255);*/ engine_surface_color_set(tr,tg,tb,255); engine_surface_draw_pixel(x,y); ++x; } ++y; } //y = 0; //while (y < engine_height) { // int x = 0; // while (x < engine_width) { // tr = (char)(x + y) + ((char)frame * 1); // tg = (char)(x + y) + ((char)frame * 3); // tb = (char)(x + y) + ((char)frame * 5); /*tr = (char)(x + y) * (char)frame * 1; tg = (char)(x + y) * (char)frame * 3; tb = (char)(x + y) * (char)frame * 5;*/ /*tr = (char)((x * y) + 64) + frame; tg = (char)((x * y) + 128) + frame; tb = (char)((x * y) + 192) + frame;*/ /*int part = engine_width / 3; if (x < part * 1) { tr = 255; tg = 0; tb = 0; } else if (x < part * 2) { tr = 0; tg = 255; tb = 0; } else { tr = 0; tg = 0; tb = 255; }*/ /*tr = 0; tg = 255 - ((char)((x * y) + 128) + frame); tb = 0;*/ /*tr = (char)(((float)x / (float)engine_width) * 255); tg = 255 - tr; tb = (char)(((float)y / (float)engine_height) * 255);*/ // engine_surface_color_set(tr,tg,tb,128); // engine_surface_draw_pixel(x,y); // ++x; // } // ++y; //} engine_texture_render_2d(texture,5,5); frame += 1; frameSec += 1; Uint32 tick = SDL_GetTicks(); if (tick - lastSec >= 1000) { printf("FPS: %d\n",frameSec); lastSec = tick; frameSec = 0; } engine_window_present(); //engine_time_sleep(33); } int main(int argc, char **argv) { texture = engine_texture_create(8,8); engine_texture_from_file(texture,"assets/textures/fier.rgba"); for (int i = 0; i < argc; ++i) { printf("argv[%d]: %s\n", i, argv[i]); } engine_window_init(256,256,"Game"); while (1) { struct ENGINE_EVENT event = engine_event_get(); if (event.type != ENGINE_EVENT_TYPE_NONE) { handleEvent(event); } else { tick(); } } }