Fix some details

This commit is contained in:
Miloslav Ciz 2025-03-24 16:24:14 +01:00
parent 8450e113fa
commit 139bb2f905
4 changed files with 31 additions and 4 deletions

View file

@ -5,12 +5,15 @@
#define DATA_FILE_NAME "data"
#include "game.h"
#define LCR_LOADING_COMMAND SDL_PumpEvents(); SDL_RenderPresent(renderer);
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *texture;
SDL_Surface *screenSurface;
#include "game.h"
uint16_t screen[LCR_SETTING_RESOLUTION_X * LCR_SETTING_RESOLUTION_Y];
FILE *musicFile = 0;
@ -106,7 +109,7 @@ uint8_t LCR_keyPressed(uint8_t key)
void LCR_sleep(uint16_t timeMs)
{
usleep(timeMs * 1000);
SDL_Delay(timeMs);
}
void LCR_drawPixel(unsigned long index, uint16_t color)
@ -221,9 +224,15 @@ int main(int argc, char *argv[])
while (running)
{
SDL_PumpEvents();
SDL_Event event;
running = 1;
while (SDL_PollEvent(&event))
if (event.type == SDL_QUIT)
running = 0;
keyboardState = SDL_GetKeyboardState(NULL);
running = !keyboardState[SDL_SCANCODE_Q];
running &= LCR_gameStep(SDL_GetTicks());