pequeños retoques

This commit is contained in:
2024-08-21 18:05:32 +02:00
parent 248a391be6
commit b628b426c1
3 changed files with 9 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
source := source/*.cpp source := source/*.cpp
executable_name := demo_pelota2 executable_name := demo_pelotas2
windows: windows:
g++ $(source) -Wall -lmingw32 -lws2_32 -lSDL2main -lSDL2 -o $(executable_name).exe g++ $(source) -Wall -lmingw32 -lws2_32 -lSDL2main -lSDL2 -o $(executable_name).exe

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#define WINDOW_CAPTION "demo_pelotas2"
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240 #define SCREEN_HEIGHT 240
#define BALL_SIZE 8 #define BALL_SIZE 8

View File

@@ -10,7 +10,7 @@ SDL_Renderer *renderer = NULL;
SDL_Event *event; SDL_Event *event;
Texture *texture = nullptr; Texture *texture = nullptr;
std::vector<Ball *> balls; std::vector<Ball *> balls;
int test[7] = {1, 10, 100, 500, 1000, 10000, 100000}; int test[8] = {1, 10, 100, 500, 1000, 10000, 50000, 100000};
bool shouldExit = false; bool shouldExit = false;
Uint32 ticks = 0; Uint32 ticks = 0;
@@ -77,7 +77,7 @@ bool init()
} }
// Create window // Create window
window = SDL_CreateWindow("Demo Pelotas 2", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2, SDL_WINDOW_SHOWN); window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH * 2, SCREEN_HEIGHT * 2, SDL_WINDOW_SHOWN);
if (window == NULL) if (window == NULL)
{ {
printf("Window could not be created! SDL Error: %s\n", SDL_GetError()); printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
@@ -192,6 +192,11 @@ void checkEvents()
{ {
initBalls(6); initBalls(6);
} }
if (event->key.keysym.sym == SDLK_8)
{
initBalls(7);
}
} }
} }
} }