Skip to content

Commit

Permalink
Need to fix NULL Exception Thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
RileyNB1 committed Sep 9, 2023
1 parent 65699af commit 256ae82
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 7 deletions.
5 changes: 0 additions & 5 deletions LearningOpenGL/LearningOpenGL/LearningOpenGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
#define MAX_RAY_DEPTH 100
#define PI 3.1415926535

//vector 3







Expand Down
2 changes: 2 additions & 0 deletions LearningOpenGL/LearningOpenGL/LearningOpenGL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ copy /Y "$(SolutionDir)SDL2_mixer\lib\$(PlatformTarget)\*.dll" "$(OutDir)"</Comm
<ClCompile Include="src\sdl_proj\SDLGraphics.cpp" />
<ClCompile Include="src\sdl_proj\Texture.cpp" />
<ClCompile Include="src\sdl_proj\Timer.cpp" />
<ClCompile Include="src\StartScreen.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\opengl\GLTexture.h" />
Expand Down Expand Up @@ -255,6 +256,7 @@ copy /Y "$(SolutionDir)SDL2_mixer\lib\$(PlatformTarget)\*.dll" "$(OutDir)"</Comm
<ClInclude Include="include\sdl_proj\Timer.h" />
<ClInclude Include="include\sdl_proj\tinyxml\tinyxml2.h" />
<ClInclude Include="include\opengl\ShaderUtil.h" />
<ClInclude Include="include\Tetris\StartScreen.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
6 changes: 6 additions & 0 deletions LearningOpenGL/LearningOpenGL/LearningOpenGL.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
<ClCompile Include="src\opengl\ShaderUtil.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\StartScreen.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\opengl\GLGraphics.h">
Expand Down Expand Up @@ -227,5 +230,8 @@
<ClInclude Include="include\opengl\ShaderUtil.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Tetris\StartScreen.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
24 changes: 24 additions & 0 deletions LearningOpenGL/LearningOpenGL/include/Tetris/StartScreen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#include "GLTexture.h"
#include "GameEntity.h"

using namespace FOGrP;

class StartScreen : public GameEntity
{
private:



GLTexture* mStartButton;
GLTexture* mTetrisLogo;


public:
StartScreen();
~StartScreen();


void Update() override;
void Render() override;
};
2 changes: 1 addition & 1 deletion LearningOpenGL/LearningOpenGL/include/sdl_proj/Graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace FOGrP

static const short SCREEN_WIDTH = 1024;
static const short SCREEN_HEIGHT = 896;
const char* WINDOW_TITLE = "Galaga";
const char* WINDOW_TITLE = "Main Menu";

protected:
static Graphics* sInstance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <GLGraphics.h>
#include "Tetris/StartScreen.h"
#include <Timer.h>
#include <GameEntity.h>
#include <managers/AssetManager.h>
Expand All @@ -22,6 +23,7 @@ namespace FOGrP

// modules
Graphics* mGraphics;
StartScreen* mStartScreen;
AssetManager* mAssetManager;
InputManager* mInputManager;
AudioManager* mAudioManager;
Expand Down
40 changes: 40 additions & 0 deletions LearningOpenGL/LearningOpenGL/src/StartScreen.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "Tetris/StartScreen.h"


StartScreen::StartScreen()
{


mStartButton = new GLTexture("Start", "emulogic.ttf", 32, { 200, 0, 0 });
mTetrisLogo = new GLTexture("Tetris.png");

}

StartScreen::~StartScreen()
{

delete mStartButton;
mStartButton = nullptr;

// logo entities
delete mTetrisLogo;
mTetrisLogo = nullptr;


}

void StartScreen::Update()
{

}

void StartScreen::Render()
{


mStartButton->Render();

mTetrisLogo->Render();


}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace FOGrP
void GameManager::Update()
{
mInputManager->Update();

mStartScreen->Update();

if (mInputManager->KeyDown(SDL_SCANCODE_1))
{
Expand All @@ -73,6 +73,7 @@ namespace FOGrP


mGraphics->Render();
mStartScreen->Render();
}

void GameManager::TestStuff()
Expand All @@ -84,6 +85,7 @@ namespace FOGrP
// create Graphics singleton
mEvent = {};

mStartScreen = new StartScreen();
Graphics::SetMode(Graphics::RenderMode::GL);
mGraphics = Graphics::Instance();

Expand Down
Binary file modified LearningOpenGL/out/int/vc143.idb
Binary file not shown.
Binary file added LearningOpenGL/resources/Tetris.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 256ae82

Please sign in to comment.