Skip to content

Commit

Permalink
Allow enabling vsync
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-mower committed Oct 25, 2023
1 parent 693cdad commit 84c917d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gwen/Renderers/OpenGL/OpenGL_Base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,5 +632,11 @@ namespace Gwen
return true;
}

void OpenGL_Base::EnableVsync(bool yn)
{
auto wglSwapIntervalEXT = (bool(*)(int))wglGetProcAddress("wglSwapIntervalEXT");

wglSwapIntervalEXT(yn ? 1 : 0);
}
}
}
2 changes: 2 additions & 0 deletions gwen/include/Gwen/BaseRender.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ namespace Gwen
virtual void Begin() {};
virtual void End() {};

virtual void EnableVsync(bool yn) {};

virtual void SetDrawColor( Color color ) {};

virtual void DrawFilledRect( Gwen::Rect rect ) {};;
Expand Down
2 changes: 2 additions & 0 deletions gwen/include/Gwen/Renderers/OpenGL_Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace Gwen
virtual void SetDrawColor( Gwen::Color color );
virtual void DrawFilledRect( Gwen::Rect rect );

virtual void EnableVsync(bool yn);

void StartClip();
void EndClip();

Expand Down

0 comments on commit 84c917d

Please sign in to comment.