summaryrefslogtreecommitdiff
path: root/src/openglgraphics.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-10 11:50:27 -0600
committerIra Rice <irarice@gmail.com>2009-03-10 11:50:27 -0600
commit58ee835c3763e7bf088fa6c7e31dda1d687589cc (patch)
tree2eb06f7ee3fa05af68fb536284497a9967222ad9 /src/openglgraphics.cpp
parent5bbf8219bffbb587cf9a23561734c917bb23f42f (diff)
downloadmana-58ee835c3763e7bf088fa6c7e31dda1d687589cc.tar.gz
mana-58ee835c3763e7bf088fa6c7e31dda1d687589cc.tar.bz2
mana-58ee835c3763e7bf088fa6c7e31dda1d687589cc.tar.xz
mana-58ee835c3763e7bf088fa6c7e31dda1d687589cc.zip
Extended window layout to take relative positions, as well as offsets to
that position. This makes it so that when resolutions are changed, the default locations stay relative to the window's position, and not the 800x600 screen resolution. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/openglgraphics.cpp')
-rw-r--r--src/openglgraphics.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index 71ab2fe3..9bd3ab2f 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -63,18 +63,17 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel)
mFullscreen = fs;
mHWAccel = hwaccel;
- if (fs) {
+ if (fs)
displayFlags |= SDL_FULLSCREEN;
- }
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
- if (!(mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags))) {
+ if (!(mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags)))
return false;
- }
#ifdef __APPLE__
- if (mSync) {
+ if (mSync)
+ {
const GLint VBL = 1;
CGLSetParameter(CGLGetCurrentContext(), kCGLCPSwapInterval, &VBL);
}
@@ -158,9 +157,7 @@ bool OpenGLGraphics::drawImage(Image *image, int srcX, int srcY,
glEnd();
if (!useColor)
- {
glColor4ub(mColor.r, mColor.g, mColor.b, mColor.a);
- }
return true;
}
@@ -206,9 +203,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
w, h, 24,
0xff0000, 0x00ff00, 0x0000ff, 0x000000);
- if (SDL_MUSTLOCK(screenshot)) {
+ if (SDL_MUSTLOCK(screenshot))
SDL_LockSurface(screenshot);
- }
// Grap the pixel buffer and write it to the SDL surface
glPixelStorei(GL_PACK_ALIGNMENT, 1);
@@ -230,9 +226,8 @@ SDL_Surface* OpenGLGraphics::getScreenshot()
free(buf);
- if (SDL_MUSTLOCK(screenshot)) {
+ if (SDL_MUSTLOCK(screenshot))
SDL_UnlockSurface(screenshot);
- }
return screenshot;
}
@@ -242,7 +237,8 @@ bool OpenGLGraphics::pushClipArea(gcn::Rectangle area)
int transX = 0;
int transY = 0;
- if (!mClipStack.empty()) {
+ if (!mClipStack.empty())
+ {
transX = -mClipStack.top().xOffset;
transY = -mClipStack.top().yOffset;
}
@@ -267,9 +263,7 @@ void OpenGLGraphics::popClipArea()
gcn::Graphics::popClipArea();
if (mClipStack.empty())
- {
return;
- }
glPopMatrix();
glScissor(mClipStack.top().x,
@@ -325,8 +319,10 @@ void OpenGLGraphics::setTargetPlane(int width, int height)
void OpenGLGraphics::setTexturingAndBlending(bool enable)
{
- if (enable) {
- if (!mTexture) {
+ if (enable)
+ {
+ if (!mTexture)
+ {
glEnable(Image::mTextureType);
mTexture = true;
}
@@ -336,16 +332,22 @@ void OpenGLGraphics::setTexturingAndBlending(bool enable)
glEnable(GL_BLEND);
mAlpha = true;
}
- } else {
- if (mAlpha && !mColorAlpha) {
+ }
+ else
+ {
+ if (mAlpha && !mColorAlpha)
+ {
glDisable(GL_BLEND);
mAlpha = false;
- } else if (!mAlpha && mColorAlpha) {
+ }
+ else if (!mAlpha && mColorAlpha)
+ {
glEnable(GL_BLEND);
mAlpha = true;
}
- if (mTexture) {
+ if (mTexture)
+ {
glDisable(Image::mTextureType);
mTexture = false;
}