Cambiado tamaño de la ventana

This commit is contained in:
2024-08-22 21:42:18 +02:00
parent 1883032be5
commit 578549b122
2 changed files with 2 additions and 23 deletions

View File

@@ -3,6 +3,7 @@
#define WINDOW_CAPTION "demo_pelotas2" #define WINDOW_CAPTION "demo_pelotas2"
#define SCREEN_WIDTH 320 #define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240 #define SCREEN_HEIGHT 240
#define WINDOW_SIZE 3
#define BALL_SIZE 8 #define BALL_SIZE 8
#define GRAVITY 0.2f #define GRAVITY 0.2f
#define TEXT_TIME 100 #define TEXT_TIME 100

View File

@@ -100,7 +100,7 @@ bool init()
else else
{ {
// Create window // Create window
window = SDL_CreateWindow(WINDOW_CAPTION, 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 * WINDOW_SIZE, SCREEN_HEIGHT * WINDOW_SIZE, SDL_WINDOW_SHOWN);
if (window == nullptr) if (window == nullptr)
{ {
printf("Window could not be created! SDL Error: %s\n", SDL_GetError()); printf("Window could not be created! SDL Error: %s\n", SDL_GetError());
@@ -180,81 +180,59 @@ void checkEvents()
switch (event->key.keysym.sym) switch (event->key.keysym.sym)
{ {
case SDLK_ESCAPE: case SDLK_ESCAPE:
{
shouldExit = true; shouldExit = true;
break; break;
}
case SDLK_SPACE: case SDLK_SPACE:
{
pushUpBalls(); pushUpBalls();
break; break;
}
case SDLK_g: case SDLK_g:
{
switchBallsGravity(); switchBallsGravity();
break; break;
}
case SDLK_1: case SDLK_1:
{
index = 0; index = 0;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_2: case SDLK_2:
{
index = 1; index = 1;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_3: case SDLK_3:
{
index = 2; index = 2;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_4: case SDLK_4:
{
index = 3; index = 3;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_5: case SDLK_5:
{
index = 4; index = 4;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_6: case SDLK_6:
{
index = 5; index = 5;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_7: case SDLK_7:
{
index = 6; index = 6;
initBalls(index); initBalls(index);
break; break;
}
case SDLK_8: case SDLK_8:
{
index = 7; index = 7;
initBalls(index); initBalls(index);
break; break;
} }
} }
} }
}
} }
void update() void update()