Skip to content

Commit 58702d5

Browse files
committed
Updated First OpenGL Tutorial with spelling errors and added a virtual deconstructor (Thanks Resharper C++!) so the GLFWManager's deconstructor would get called when deleting the WindowManager.
1 parent b25a9c8 commit 58702d5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

OpenGL/First OpenGL Program/Headers/WindowManager.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class WindowManager
1414
{
1515
public:
1616

17+
// This is needed so that the class inheriting this will have it's deconstructor called
18+
virtual ~WindowManager() {}
19+
1720
// This initialized the window and creates the OpenGL context
1821
virtual int Initialize(int width, int height, std::string strTitle, bool bFullScreen = false) = 0;
1922

OpenGL/First OpenGL Program/Source/GLFWManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ implementation of this online on the tutorial page, which is a Win32Manager.
2626
// set to a "Console" application and wouldn't compile with a WinMain().
2727
int main()
2828
{
29+
// First create our desired WindowManager implementation so we can set it below
2930
GLFWManager *pWindowManager = new GLFWManager();
3031

31-
// Create a local instance of our GLApplication (defined in Main.cpp).
32+
// Create a local instance of our GLApplication (defined in Main.cpp) and set its
33+
// WindowManager implementation (in this case, GLFW).
3234
GLApplication application;
3335
application.SetWindowManager(pWindowManager);
3436

@@ -133,7 +135,7 @@ bool GLFWManager::ProcessInput(bool continueGame = true)
133135
{
134136
// Use the GLFW function to check for the user pressing the Escape button, as well as a window close event.
135137
// If any of these checks return true, return false back to the caller to let them know the user has quit.
136-
if ( glfwGetKey((GLFWwindow*)Window, GLFW_KEY_ESCAPE) == GLFW_PRESS || glfwWindowShouldClose((GLFWwindow*)Window) != 0 )
138+
if ( glfwGetKey(Window, GLFW_KEY_ESCAPE) == GLFW_PRESS || glfwWindowShouldClose(Window) != 0 )
137139
return false;
138140

139141
// Poll the input events to see if the user quit or closed the window. This can only be called

OpenGL/First OpenGL Program/Source/Main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ normally setup something for Dependency Injection but I didn't want to add too m
230230
Notice that our .cpp files go in the "Source Files\" folder, the .h files go in the "Header Files\" folder and
231231
the shader files have their own folder as well. The tutorials will always start at the Main.cpp file so please
232232
look their first to start the tutorial. This has a ton of things to go over so let's just jump in and take a look
233-
at the code. If you can get through this firt tutorial, the rest should be much easier to swallow because we now
233+
at the code. If you can get through this first tutorial, the rest should be much easier to swallow because we now
234234
have a great base to just tweak going forward.
235235
*/
236236

0 commit comments

Comments
 (0)