Renamed base class used in tutorials.

This commit is contained in:
Pawel Lapinski
2018-02-26 22:48:01 +01:00
parent 906cd3fb8d
commit 2592271bfa
5 changed files with 25 additions and 25 deletions

View File

@@ -32,7 +32,7 @@ namespace ApiWithoutSecrets {
#if defined(VK_USE_PLATFORM_WIN32_KHR) #if defined(VK_USE_PLATFORM_WIN32_KHR)
#define TUTORIAL_NAME "API without Secrets: Introduction to Vulkan" #define SERIES_NAME "API without Secrets: Introduction to Vulkan"
LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { LRESULT CALLBACK WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
switch( message ) { switch( message ) {
@@ -56,7 +56,7 @@ namespace ApiWithoutSecrets {
} }
if( Parameters.Instance ) { if( Parameters.Instance ) {
UnregisterClass( TUTORIAL_NAME, Parameters.Instance ); UnregisterClass( SERIES_NAME, Parameters.Instance );
} }
} }
@@ -77,7 +77,7 @@ namespace ApiWithoutSecrets {
wcex.hCursor = LoadCursor( NULL, IDC_ARROW ); wcex.hCursor = LoadCursor( NULL, IDC_ARROW );
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wcex.lpszMenuName = NULL; wcex.lpszMenuName = NULL;
wcex.lpszClassName = TUTORIAL_NAME; wcex.lpszClassName = SERIES_NAME;
wcex.hIconSm = NULL; wcex.hIconSm = NULL;
if( !RegisterClassEx( &wcex ) ) { if( !RegisterClassEx( &wcex ) ) {
@@ -85,7 +85,7 @@ namespace ApiWithoutSecrets {
} }
// Create window // Create window
Parameters.Handle = CreateWindow( TUTORIAL_NAME, title, WS_OVERLAPPEDWINDOW, 20, 20, 500, 500, nullptr, nullptr, Parameters.Instance, nullptr ); Parameters.Handle = CreateWindow( SERIES_NAME, title, WS_OVERLAPPEDWINDOW, 20, 20, 500, 500, nullptr, nullptr, Parameters.Instance, nullptr );
if( !Parameters.Handle ) { if( !Parameters.Handle ) {
return false; return false;
} }
@@ -93,7 +93,7 @@ namespace ApiWithoutSecrets {
return true; return true;
} }
bool Window::RenderingLoop( TutorialBase &tutorial ) const { bool Window::RenderingLoop( ProjectBase &project ) const {
// Display window // Display window
ShowWindow( Parameters.Handle, SW_SHOWNORMAL ); ShowWindow( Parameters.Handle, SW_SHOWNORMAL );
UpdateWindow( Parameters.Handle ); UpdateWindow( Parameters.Handle );
@@ -123,13 +123,13 @@ namespace ApiWithoutSecrets {
// Draw // Draw
if( resize ) { if( resize ) {
resize = false; resize = false;
if( !tutorial.OnWindowSizeChanged() ) { if( !project.OnWindowSizeChanged() ) {
result = false; result = false;
break; break;
} }
} }
if( tutorial.ReadyToDraw() ) { if( project.ReadyToDraw() ) {
if( !tutorial.Draw() ) { if( !project.Draw() ) {
result = false; result = false;
break; break;
} }
@@ -203,7 +203,7 @@ namespace ApiWithoutSecrets {
return true; return true;
} }
bool Window::RenderingLoop( TutorialBase &tutorial ) const { bool Window::RenderingLoop( ProjectBase &project ) const {
// Prepare notification for window destruction // Prepare notification for window destruction
xcb_intern_atom_cookie_t protocols_cookie = xcb_intern_atom( Parameters.Connection, 1, 12, "WM_PROTOCOLS" ); xcb_intern_atom_cookie_t protocols_cookie = xcb_intern_atom( Parameters.Connection, 1, 12, "WM_PROTOCOLS" );
xcb_intern_atom_reply_t *protocols_reply = xcb_intern_atom_reply( Parameters.Connection, protocols_cookie, 0 ); xcb_intern_atom_reply_t *protocols_reply = xcb_intern_atom_reply( Parameters.Connection, protocols_cookie, 0 );
@@ -258,13 +258,13 @@ namespace ApiWithoutSecrets {
// Draw // Draw
if( resize ) { if( resize ) {
resize = false; resize = false;
if( !tutorial.OnWindowSizeChanged() ) { if( !project.OnWindowSizeChanged() ) {
result = false; result = false;
break; break;
} }
} }
if( tutorial.ReadyToDraw() ) { if( project.ReadyToDraw() ) {
if( !tutorial.Draw() ) { if( !project.Draw() ) {
result = false; result = false;
break; break;
} }
@@ -310,7 +310,7 @@ namespace ApiWithoutSecrets {
return true; return true;
} }
bool Window::RenderingLoop( TutorialBase &tutorial ) const { bool Window::RenderingLoop( ProjectBase &project ) const {
// Prepare notification for window destruction // Prepare notification for window destruction
Atom delete_window_atom; Atom delete_window_atom;
delete_window_atom = XInternAtom( Parameters.DisplayPtr, "WM_DELETE_WINDOW", false ); delete_window_atom = XInternAtom( Parameters.DisplayPtr, "WM_DELETE_WINDOW", false );
@@ -359,13 +359,13 @@ namespace ApiWithoutSecrets {
// Draw // Draw
if( resize ) { if( resize ) {
resize = false; resize = false;
if( !tutorial.OnWindowSizeChanged() ) { if( !project.OnWindowSizeChanged() ) {
result = false; result = false;
break; break;
} }
} }
if( tutorial.ReadyToDraw() ) { if( project.ReadyToDraw() ) {
if( !tutorial.Draw() ) { if( !project.Draw() ) {
result = false; result = false;
break; break;
} }

View File

@@ -55,11 +55,11 @@ namespace ApiWithoutSecrets {
#endif #endif
// ************************************************************ // // ************************************************************ //
// OnWindowSizeChanged // // ProjectBase //
// // // //
// Base class for handling window size changes // // Base class for handling window size changes and drawing //
// ************************************************************ // // ************************************************************ //
class TutorialBase { class ProjectBase {
public: public:
virtual bool OnWindowSizeChanged() = 0; virtual bool OnWindowSizeChanged() = 0;
virtual bool Draw() = 0; virtual bool Draw() = 0;
@@ -68,11 +68,11 @@ namespace ApiWithoutSecrets {
return CanRender; return CanRender;
} }
TutorialBase() : ProjectBase() :
CanRender( false ) { CanRender( false ) {
} }
virtual ~TutorialBase() { virtual ~ProjectBase() {
} }
protected: protected:
@@ -126,7 +126,7 @@ namespace ApiWithoutSecrets {
~Window(); ~Window();
bool Create( const char *title ); bool Create( const char *title );
bool RenderingLoop( TutorialBase &tutorial ) const; bool RenderingLoop( ProjectBase &project ) const;
WindowParameters GetParameters() const; WindowParameters GetParameters() const;
private: private:

View File

@@ -106,7 +106,7 @@ namespace ApiWithoutSecrets {
// // // //
// Base class for Vulkan more advanced tutorial classes // // Base class for Vulkan more advanced tutorial classes //
// ************************************************************ // // ************************************************************ //
class VulkanCommon : public OS::TutorialBase { class VulkanCommon : public OS::ProjectBase {
public: public:
VulkanCommon(); VulkanCommon();
virtual ~VulkanCommon(); virtual ~VulkanCommon();

View File

@@ -46,7 +46,7 @@ namespace ApiWithoutSecrets {
// // // //
// Class for presenting Vulkan usage topics // // Class for presenting Vulkan usage topics //
// ************************************************************ // // ************************************************************ //
class Tutorial01 : public OS::TutorialBase { class Tutorial01 : public OS::ProjectBase {
public: public:
Tutorial01(); Tutorial01();
~Tutorial01(); ~Tutorial01();

View File

@@ -63,7 +63,7 @@ namespace ApiWithoutSecrets {
// // // //
// Class for presenting Vulkan usage topics // // Class for presenting Vulkan usage topics //
// ************************************************************ // // ************************************************************ //
class Tutorial02 : public OS::TutorialBase { class Tutorial02 : public OS::ProjectBase {
public: public:
Tutorial02(); Tutorial02();
~Tutorial02(); ~Tutorial02();