Fix bug
This commit is contained in:
parent
0c85c17b0d
commit
0ff02760f2
@ -20,6 +20,8 @@ int main() {
|
|||||||
|
|
||||||
std::shared_ptr<GameState> currentState = states["main_menu"];
|
std::shared_ptr<GameState> currentState = states["main_menu"];
|
||||||
|
|
||||||
|
currentState->init();
|
||||||
|
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef INGAME_STATE_H
|
||||||
|
#define INGAME_STATE_H
|
||||||
|
|
||||||
#include "../entities/Opponent.h"
|
#include "../entities/Opponent.h"
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -38,4 +41,6 @@ public:
|
|||||||
void renderItem(SDL_Renderer* renderer, Item i) const;
|
void renderItem(SDL_Renderer* renderer, Item i) const;
|
||||||
void renderOpponent(SDL_Renderer* renderer, SDL_Texture* opponentTexture, Opponent o) const;
|
void renderOpponent(SDL_Renderer* renderer, SDL_Texture* opponentTexture, Opponent o) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,14 @@
|
|||||||
#include "MainMenuState.h"
|
#include "MainMenuState.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
void MainMenuState::update() {
|
||||||
|
// Handle updates like animations if necessary
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainMenuState::init() {
|
||||||
|
std::cout << "Main menu state initialized\n";
|
||||||
|
}
|
||||||
|
|
||||||
void MainMenuState::handleEvents(SDL_Event& event) {
|
void MainMenuState::handleEvents(SDL_Event& event) {
|
||||||
if (event.type == SDL_KEYDOWN) {
|
if (event.type == SDL_KEYDOWN) {
|
||||||
switch (event.key.keysym.sym) {
|
switch (event.key.keysym.sym) {
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#ifndef MAIN_MNU_STATE_H
|
||||||
|
#define MAIN_MNU_STATE_H
|
||||||
|
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#include <SDL2/SDL_ttf.h>
|
#include <SDL2/SDL_ttf.h>
|
||||||
@ -9,3 +12,5 @@ public:
|
|||||||
void update() override;
|
void update() override;
|
||||||
void render(SDL_Renderer* renderer) override;
|
void render(SDL_Renderer* renderer) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user