From c42457a6c5727400ff61aaae09f0510354801706 Mon Sep 17 00:00:00 2001 From: fanta Date: Thu, 15 May 2025 00:22:02 +0200 Subject: [PATCH] loop separado --- bocm | Bin 17152 -> 17152 bytes bocm.c | 2 +- functions.c | 15 +-------------- loop.c | 18 ++++++++++++++++++ 4 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 loop.c diff --git a/bocm b/bocm index dcbf9924ffab37fc9ed2cf022027f31db56cb006..d16bcd617c4d60f00e0e6fc08423b1da2aee9d7c 100755 GIT binary patch delta 219 zcmZo@V{B+++)%+RA{!(%!+%am*Y^t%VbNdztUH{^cVcr7^IO6CZq}Px3=AHf$6t8< z`TyUen{^kI%LU;shH`iR{{R2QF(9#n0SICbf999_73$IX)T5Vm0aVEkplmnmBp}b0 zfsuisgy+S@e?U!q|NsAgePaT;zUDUqowa`^{}AP8TLx6|B4IPH7(X}T$IY^e?u?UL klq6VvfQA@OPE?ZKJV$AcAY;L1OOy4Cj2kzz>% delta 219 zcmZo@V{B+++)%+RqJ85~d&L&+33sF=rnUY3QX;|`bZv7F^IO6CUePx!FZ_YT>l+hxFaSa9;m`bXzd}7apL%q&E`;h61nL8F zo1olFzroyWD7P8NebEOb&<$vQBhXp #include "functions.c" +#include "loop.c" int main(int argc, char** argv) { initWindow(); diff --git a/functions.c b/functions.c index 6376031..5e52700 100644 --- a/functions.c +++ b/functions.c @@ -4,7 +4,7 @@ SDL_Window* window; SDL_Renderer* renderer; SDL_Surface* surface; SDL_Texture* texture; -SDL_Event event; + const int screenWidth = 800; const int screenHeight = 600; @@ -54,19 +54,6 @@ int presentLogo(void){ return 0; } -int windowLoop(void){ - while (1) { - SDL_PollEvent(&event); - if (event.type == SDL_QUIT) { - break; - } - - loadBackgroundColor(); - presentLogo(); - } - return 0; -} - int destroy(void){ SDL_DestroyTexture(texture); SDL_DestroyRenderer(renderer); diff --git a/loop.c b/loop.c new file mode 100644 index 0000000..e9d7c2d --- /dev/null +++ b/loop.c @@ -0,0 +1,18 @@ +#include + +SDL_Event event; + +int windowLoop(void){ + while (1) { + SDL_PollEvent(&event); + if (event.type == SDL_QUIT) { + break; + } + + loadBackgroundColor(); + presentLogo(); + } + return 0; +} + +