Skip to content

Commit

Permalink
main menu is here, after 3 months, ur welcome guys (didnt make it in …
Browse files Browse the repository at this point in the history
…a seperate class, but made the class and its useless for now)
  • Loading branch information
mimumi2005 committed Jun 5, 2023
1 parent a41741f commit 7eb4588
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 127 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ set(PROJECT_FILES
"src/game/entities/Crate.cpp"
"src/game/entities/Crate.h"
"src/game/entities/Error.cpp"
"src/game/entities/Error.h")
"src/game/entities/Error.h" src/Menu.cpp src/Menu.h)

add_executable(${PROJECT_NAME} ${BUILD_OPTIONS} ${PROJECT_FILES})
target_link_libraries(${PROJECT_NAME} SDL2 SDL2main SDL2_image SDL2_mixer SDL2_ttf)
Expand Down
Binary file added bin/assets/images/interface/Back.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/assets/images/interface/Exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/assets/images/interface/Menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/assets/images/interface/PlayButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/assets/images/interface/Resume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// Created by Mim on 6/5/2023.
//

#include "Menu.h"
GameReference* Window;
AssetsManager* AssetsHandler;
SoundManager* SoundHandler;
Menu::Menu(GameReference* GameWindow,Drawing* Render, Texture* TextureStart, int width, int height){
TextureButtonStart = TextureStart;
Renderer = Render;
Window = GameWindow;
m_Height = height;
m_Width = width;
AssetsHandler = Window->Assets();
SoundHandler = AssetsHandler->SoundHandler();
GameWindow->Render()->SetWorld(reinterpret_cast<GameWorld *>(this));
StartButtonRect = { int(GameWindow->GetWidth2()) - 150,
int(GameWindow->GetHeight2()) - 200,
300, 100 };

}
void Menu::Draw() {

}
24 changes: 24 additions & 0 deletions src/Menu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Created by Mim on 6/5/2023.
//

#ifndef TRIALANDERROR_MENU_H
#define TRIALANDERROR_MENU_H
#include "game/indicators/TextSurface.h"
#include "GameReference.h"

class Menu {
private:
double m_Width, m_Height;
Drawing* Renderer;
Texture* TextureButtonStart;
public:
SDL_Rect StartButtonRect;
Menu(GameReference* GameWindow,Drawing* Render,Texture* TextureStart, int width, int height);
void Event(const SDL_Event& currentEvent);
void Tick();
void Draw();
};


#endif //TRIALANDERROR_MENU_H
315 changes: 189 additions & 126 deletions src/main.cpp

Large diffs are not rendered by default.

0 comments on commit 7eb4588

Please sign in to comment.