diff options
Diffstat (limited to 'lib/base.cc')
-rw-r--r-- | lib/base.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/base.cc b/lib/base.cc index 49e883e..5282617 100644 --- a/lib/base.cc +++ b/lib/base.cc @@ -78,3 +78,19 @@ void mogltk::base::Leave2DMode() { bool mogltk::base::is2D() { return true; } + +void mogltk::base::changeviewport(int x, int y, unsigned int w, unsigned int h) { + SDL_Rect r; + + if ((w == 0) && (h == 0)) { + w = GetWidth() - x; + h = GetHeight() - y; + } + + r.x = x; + r.y = y; + r.w = w; + r.h = h; + + SDL_SetClipRect(surface, &r); +} |