|
- #include <SDL.h>
- #include <stdbool.h>
- #include <stdio.h>
- #include "IZ_app.h"
-
- const char* APP_NAME = "SDL2";
- //const unsigned int SCREEN_WIDTH = 320;
- //const unsigned int SCREEN_HEIGHT = 240;
-
- // NES frame rate
- //const float SCREEN_FPS = 59.94f;
-
- //#define SDL_GetTicks64 SDL_GetTicks
- //
- //SDL_Window* IZ_GetWindow() {
- // if (SDL_Init(SDL_INIT_VIDEO) < 0) {
- // printf("SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
- // return NULL;
- // }
- //
- // SDL_Window* window = SDL_CreateWindow(
- // APP_NAME,
- // SDL_WINDOWPOS_UNDEFINED,
- // SDL_WINDOWPOS_UNDEFINED,
- // (int) SCREEN_WIDTH,
- // (int) SCREEN_HEIGHT,
- // SDL_WINDOW_SHOWN
- // );
- //
- // if (window == NULL) {
- // printf("Window could not be created! SDL_Error: %s\n", SDL_GetError());
- // return NULL;
- // }
- //
- // return window;
- //}
-
- int main(int argc, char** argv) {
- IZ_App app;
- return IZ_AppRun(&app, argc, argv, APP_NAME, 0, 0, 0);
-
- // SDL_Window* window = IZ_GetWindow();
- // if (!window) {
- // return -1;
- // }
- // SDL_Surface* screenSurface = SDL_GetWindowSurface(window);
- //
- // uint64_t start = SDL_GetTicks64();
- // unsigned int seconds_elapsed = 0;
- // uint64_t last_update = start;
- // unsigned int frames = 0;
- // bool quit = false;
- // SDL_Event e;
- // while (!quit) {
- // while (SDL_PollEvent(&e) != 0) {
- // if (e.type == SDL_QUIT) {
- // quit = true;
- // }
- // }
- //
- // unsigned int current_ticks = SDL_GetTicks64();
- // unsigned int delta = current_ticks - last_update;
- // unsigned int new_seconds_elapsed = current_ticks / 1000;
- //
- // if (new_seconds_elapsed > seconds_elapsed) {
- // printf("%u\n", frames);
- // frames = 0;
- // seconds_elapsed = new_seconds_elapsed;
- // }
- //
- // if ((float) delta < 1000.f / SCREEN_FPS) {
- // continue;
- // }
- //
- // last_update = current_ticks;
- // frames += 1;
- //
- // SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));
- // SDL_UpdateWindowSurface(window);
- // }
- //
- // SDL_DestroyWindow(window);
- // SDL_Quit();
- //
- // return 0;
- }
|