diff --git a/src/Config.h b/src/Config.h index 88ebcb6d1..fd19556bb 100644 --- a/src/Config.h +++ b/src/Config.h @@ -125,6 +125,9 @@ #define XCNTR 306 #define YCNTR 192 +#define WINDOWW (XRES+BARSIZE) +#define WINDOWH (YRES+MENUSIZE) + #define MAX_DISTANCE sqrt(pow((float)XRES, 2)+pow((float)YRES, 2)) #define GRAV_DIFF diff --git a/src/PowderToyRenderer.cpp b/src/PowderToyRenderer.cpp index 929a20503..9207ab637 100644 --- a/src/PowderToyRenderer.cpp +++ b/src/PowderToyRenderer.cpp @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) ui::Engine::Ref().g = new Graphics(); engine = &ui::Engine::Ref(); - engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); + engine->Begin(WINDOWW, WINDOWH); GameSave * gameSave = new GameSave(inputFile); diff --git a/src/PowderToySDL.cpp b/src/PowderToySDL.cpp index 2eb7f6435..1833fb9b0 100644 --- a/src/PowderToySDL.cpp +++ b/src/PowderToySDL.cpp @@ -200,7 +200,7 @@ void blit(pixel * vid) if(sdl_scrn) { pixel * src = vid; - int j, x = 0, y = 0, w = XRES+BARSIZE, h = YRES+MENUSIZE, pitch = XRES+BARSIZE; + int j, x = 0, y = 0, w = WINDOWW, h = WINDOWH, pitch = WINDOWW; pixel *dst; if (SDL_MUSTLOCK(sdl_scrn)) if (SDL_LockSurface(sdl_scrn)<0) @@ -244,7 +244,7 @@ void blit2(pixel * vid, int currentScale) if(sdl_scrn) { pixel * src = vid; - int j, x = 0, y = 0, w = XRES+BARSIZE, h = YRES+MENUSIZE, pitch = XRES+BARSIZE; + int j, x = 0, y = 0, w = WINDOWW, h = WINDOWH, pitch = WINDOWW; pixel *dst; int i,k; if (SDL_MUSTLOCK(sdl_scrn)) @@ -354,9 +354,9 @@ SDL_Surface * SDLSetScreen(int newScale, bool newFullscreen) fullscreen = newFullscreen; SDL_Surface * surface; #ifndef OGLI - surface = SDL_SetVideoMode((XRES + BARSIZE) * newScale, (YRES + MENUSIZE) * newScale, 32, SDL_SWSURFACE | (newFullscreen?SDL_FULLSCREEN:0)); + surface = SDL_SetVideoMode(WINDOWW * newScale, WINDOWH * newScale, 32, SDL_SWSURFACE | (newFullscreen?SDL_FULLSCREEN:0)); #else - surface = SDL_SetVideoMode((XRES + BARSIZE) * newScale, (YRES + MENUSIZE) * newScale, 32, SDL_OPENGL | SDL_RESIZABLE | (newFullscreen?SDL_FULLSCREEN:0)); + surface = SDL_SetVideoMode(WINDOWW * newScale, WINDOWH * newScale, 32, SDL_OPENGL | SDL_RESIZABLE | (newFullscreen?SDL_FULLSCREEN:0)); #endif return surface; } @@ -469,7 +469,7 @@ void EventProcess(SDL_Event event) #ifdef OGLI case SDL_VIDEORESIZE: { - float ratio = float(XRES+BARSIZE) / float(YRES+MENUSIZE); + float ratio = (float)WINDOWW / WINDOWH; float width = event.resize.w; float height = width/ratio; @@ -481,9 +481,9 @@ void EventProcess(SDL_Event event) currentWidth = width; currentHeight = height; - inputScale = float(XRES+BARSIZE)/currentWidth; + inputScale = (float)WINDOWW/currentWidth; - glLineWidth(currentWidth/float(XRES+BARSIZE)); + glLineWidth(currentWidth/(float)WINDOWW); if(sdl_scrn == NULL) { std::cerr << "Oh bugger" << std::endl; @@ -615,8 +615,8 @@ bool LoadWindowPosition(int scale) SDL_VERSION(&sysInfo.version); if (SDL_GetWMInfo(&sysInfo) > 0) { - int windowW = (XRES + BARSIZE) * scale; - int windowH = (YRES + MENUSIZE) * scale; + int windowW = WINDOWW * scale; + int windowH = WINDOWH * scale; int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX); int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX); @@ -748,8 +748,8 @@ void SigHandler(int signal) int main(int argc, char * argv[]) { - currentWidth = XRES+BARSIZE; - currentHeight = YRES+MENUSIZE; + currentWidth = WINDOWW; + currentHeight = WINDOWH; std::map arguments = readArguments(argc, argv); @@ -839,7 +839,7 @@ int main(int argc, char * argv[]) engine = &ui::Engine::Ref(); engine->SetMaxSize(desktopWidth, desktopHeight); - engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); + engine->Begin(WINDOWW, WINDOWH); engine->SetFastQuit(Client::Ref().GetPrefBool("FastQuit", true)); #if !defined(DEBUG) && !defined(_DEBUG) diff --git a/src/cat/LegacyLuaAPI.cpp b/src/cat/LegacyLuaAPI.cpp index 6d4729a93..96f050746 100644 --- a/src/cat/LegacyLuaAPI.cpp +++ b/src/cat/LegacyLuaAPI.cpp @@ -870,7 +870,7 @@ int luatpt_drawtext(lua_State* l) textgreen = luaL_optint(l, 5, 255); textblue = luaL_optint(l, 6, 255); textalpha = luaL_optint(l, 7, 255); - if (textx<0 || texty<0 || textx>=XRES+BARSIZE || texty>=YRES+MENUSIZE) + if (textx<0 || texty<0 || textx>=WINDOWW || texty>=WINDOWH) return luaL_error(l, "Screen coordinates out of range (%d,%d)", textx, texty); if (textred<0) textred = 0; if (textred>255) textred = 255; @@ -1430,7 +1430,7 @@ int luatpt_drawpixel(lua_State* l) b = luaL_optint(l, 5, 255); a = luaL_optint(l, 6, 255); - if (x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) + if (x<0 || y<0 || x>=WINDOWW || y>=WINDOWH) return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y); if (r<0) r = 0; if (r>255) r = 255; @@ -1456,12 +1456,12 @@ int luatpt_drawrect(lua_State* l) b = luaL_optint(l, 7, 255); a = luaL_optint(l, 8, 255); - if (x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) + if (x<0 || y<0 || x>=WINDOWW || y>=WINDOWH) return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y); - if(x+w > XRES+BARSIZE) - w = XRES+BARSIZE-x; - if(y+h > YRES+MENUSIZE) - h = YRES+MENUSIZE-y; + if(x+w > WINDOWW) + w = WINDOWW-x; + if(y+h > WINDOWH) + h = WINDOWH-y; if (r<0) r = 0; if (r>255) r = 255; if (g<0) g = 0; @@ -1486,12 +1486,12 @@ int luatpt_fillrect(lua_State* l) b = luaL_optint(l, 7, 255); a = luaL_optint(l, 8, 255); - if (x<0 || y<0 || x>=XRES+BARSIZE || y>=YRES+MENUSIZE) + if (x<0 || y<0 || x>=WINDOWW || y>=WINDOWH) return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y); - if(x+w > XRES+BARSIZE) - w = XRES+BARSIZE-x; - if(y+h > YRES+MENUSIZE) - h = YRES+MENUSIZE-y; + if(x+w > WINDOWW) + w = WINDOWW-x; + if(y+h > WINDOWH) + h = WINDOWH-y; if (r<0) r = 0; if (r>255) r = 255; if (g<0) g = 0; diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index da21a5581..333555902 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -2339,8 +2339,8 @@ void LuaScriptInterface::initGraphicsAPI() lua_getglobal(l, "graphics"); lua_setglobal(l, "gfx"); - lua_pushinteger(l, XRES+BARSIZE); lua_setfield(l, -2, "WIDTH"); - lua_pushinteger(l, YRES+MENUSIZE); lua_setfield(l, -2, "HEIGHT"); + lua_pushinteger(l, WINDOWW); lua_setfield(l, -2, "WIDTH"); + lua_pushinteger(l, WINDOWH); lua_setfield(l, -2, "HEIGHT"); } int LuaScriptInterface::graphics_textSize(lua_State * l) diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index c70344bb5..c423baeaa 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -1169,8 +1169,8 @@ VideoBuffer Graphics::DumpFrame() { #ifdef OGLI #else - VideoBuffer newBuffer(XRES+BARSIZE, YRES+MENUSIZE); - std::copy(vid, vid+((XRES+BARSIZE)*(YRES+MENUSIZE)), newBuffer.Buffer); + VideoBuffer newBuffer(WINDOWW, WINDOWH); + std::copy(vid, vid+(WINDOWW*WINDOWH), newBuffer.Buffer); return newBuffer; #endif } diff --git a/src/graphics/OpenGLGraphics.cpp b/src/graphics/OpenGLGraphics.cpp index 4f1d5d4ee..59592c9be 100644 --- a/src/graphics/OpenGLGraphics.cpp +++ b/src/graphics/OpenGLGraphics.cpp @@ -23,7 +23,7 @@ Graphics::Graphics(): glGenTextures(1, &vidBuf); glBindTexture(GL_TEXTURE_2D, vidBuf); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WINDOWW, WINDOWH, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); @@ -61,13 +61,13 @@ void Graphics::Reset() glMatrixMode(GL_PROJECTION); glLoadIdentity(); - //glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1); - glOrtho(0, (XRES+BARSIZE)*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 0, -1, 1); + //glOrtho(0, WINDOWW*sdl_scale, 0, WINDOWH*sdl_scale, -1, 1); + glOrtho(0, WINDOWW*sdl_scale, WINDOWH*sdl_scale, 0, -1, 1); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - //glRasterPos2i(0, (YRES+MENUSIZE)); + //glRasterPos2i(0, WINDOWH); glRasterPos2i(0, 0); glPixelZoom(1, 1); } @@ -83,8 +83,8 @@ void Graphics::Finalise() glFlush(); } -#define VIDXRES XRES+BARSIZE -#define VIDYRES YRES+MENUSIZE +#define VIDXRES WINDOWW +#define VIDYRES WINDOWH #define PIXELMETHODS_CLASS Graphics #include "OpenGLDrawMethods.inl" #undef VIDYRES diff --git a/src/graphics/RasterGraphics.cpp b/src/graphics/RasterGraphics.cpp index 2a485e56c..a2dbf3904 100644 --- a/src/graphics/RasterGraphics.cpp +++ b/src/graphics/RasterGraphics.cpp @@ -5,7 +5,7 @@ Graphics::Graphics(): sdl_scale(1) { - vid = (pixel *)malloc(PIXELSIZE * ((XRES+BARSIZE) * (YRES+MENUSIZE))); + vid = (pixel *)malloc(PIXELSIZE * (WINDOWW * WINDOWH)); } @@ -26,7 +26,7 @@ Graphics::~Graphics() void Graphics::Clear() { - memset(vid, 0, PIXELSIZE * ((XRES+BARSIZE) * (YRES+MENUSIZE))); + memset(vid, 0, PIXELSIZE * (WINDOWW * WINDOWH)); } void Graphics::Finalise() @@ -34,8 +34,8 @@ void Graphics::Finalise() } -#define VIDXRES XRES+BARSIZE -#define VIDYRES YRES+MENUSIZE +#define VIDXRES WINDOWW +#define VIDYRES WINDOWH #define PIXELMETHODS_CLASS Graphics #include "RasterDrawMethods.inl" #undef VIDYRES diff --git a/src/graphics/Renderer.cpp b/src/graphics/Renderer.cpp index 9c99bfac7..f48e89754 100644 --- a/src/graphics/Renderer.cpp +++ b/src/graphics/Renderer.cpp @@ -22,8 +22,8 @@ extern "C" } #ifndef OGLI -#define VIDXRES (XRES+BARSIZE) -#define VIDYRES (YRES+MENUSIZE) +#define VIDXRES WINDOWW +#define VIDYRES WINDOWH #else #define VIDXRES XRES #define VIDYRES YRES @@ -356,10 +356,10 @@ void Renderer::FinaliseParts() glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); glTexCoord2d(1, 0); - //glVertex3f(XRES*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 1.0); + //glVertex3f(XRES*sdl_scale, WINDOWH*sdl_scale, 1.0); glVertex3f(XRES*sdl_scale, YRES*sdl_scale, 1.0); glTexCoord2d(0, 0); - //glVertex3f(0, (YRES+MENUSIZE)*sdl_scale, 1.0); + //glVertex3f(0, WINDOWH*sdl_scale, 1.0); glVertex3f(0, YRES*sdl_scale, 1.0); glTexCoord2d(0, 1); //glVertex3f(0, MENUSIZE*sdl_scale, 1.0); @@ -474,11 +474,11 @@ void Renderer::RenderZoom() glVertex2i(zoomScopePosition.X+zoomScopeSize, zoomScopePosition.Y); glVertex2i(zoomScopePosition.X+zoomScopeSize, zoomScopePosition.Y+zoomScopeSize); glVertex2i(zoomScopePosition.X, zoomScopePosition.Y+zoomScopeSize); - /*glVertex3i((zoomScopePosition.X-1)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y-1))*sdl_scale, 0); - glVertex3i((zoomScopePosition.X-1)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0); - glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0); - glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y-1))*sdl_scale, 0); - glVertex3i((zoomScopePosition.X-1)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y-1))*sdl_scale, 0);*/ + /*glVertex3i((zoomScopePosition.X-1)*sdl_scale, (WINDOWH-(zoomScopePosition.Y-1))*sdl_scale, 0); + glVertex3i((zoomScopePosition.X-1)*sdl_scale, (WINDOWH-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0); + glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (WINDOWH-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0); + glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (WINDOWH-(zoomScopePosition.Y-1))*sdl_scale, 0); + glVertex3i((zoomScopePosition.X-1)*sdl_scale, (WINDOWH-(zoomScopePosition.Y-1))*sdl_scale, 0);*/ glEnd(); glDisable(GL_COLOR_LOGIC_OP); } @@ -880,7 +880,7 @@ void Renderer::DrawWalls() drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24); for (j=0; jSetPixel(x, y, 0, 255-5*x, 255+5*x, 255); else if (toolID == DECO_DRAW || toolID == DECO_CLEAR) diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 6d513a114..cad3baa67 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -143,7 +143,7 @@ public: GameView::GameView(): - ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)), + ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), pointQueue(queue()), isMouseDown(false), ren(NULL), @@ -415,7 +415,7 @@ GameView::GameView(): v->c->OpenElementSearch(); } }; - ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, YRES+MENUSIZE-32), ui::Point(15, 15), "\xE5", "Search for elements"); + ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, WINDOWH-32), ui::Point(15, 15), "\xE5", "Search for elements"); tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2); tempButton->SetActionCallback(new ElementSearchAction(this)); AddComponent(tempButton); @@ -539,7 +539,7 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender) for(vector::iterator iter = optionList.begin(), end = optionList.end(); iter != end; ++iter) { QuickOption * option = *iter; - ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, currentY), ui::Point(15, 15), option->GetIcon(), option->GetDescription()); + ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), option->GetIcon(), option->GetDescription()); //tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2); tempButton->SetTogglable(true); tempButton->SetActionCallback(new OptionAction(option)); @@ -553,7 +553,7 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender) void GameView::NotifyMenuListChanged(GameModel * sender) { - int currentY = YRES+MENUSIZE-48;//-(sender->GetMenuList().size()*16); + int currentY = WINDOWH-48;//-(sender->GetMenuList().size()*16); for(int i = 0; i < menuButtons.size(); i++) { RemoveComponent(menuButtons[i]); @@ -571,7 +571,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender) { std::string tempString = ""; tempString += menuList[i]->GetIcon(); - ui::Button * tempButton = new ui::Button(ui::Point(XRES+BARSIZE-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription()); + ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription()); tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2); tempButton->SetTogglable(true); tempButton->SetActionCallback(new MenuAction(this, i)); @@ -666,7 +666,7 @@ void GameView::NotifyLastToolChanged(GameModel * sender) void GameView::NotifyToolListChanged(GameModel * sender) { lastOffset = 0; - int currentX = XRES+BARSIZE-56; + int currentX = WINDOWW-56; for(int i = 0; i < menuButtons.size(); i++) { if(((MenuAction*)menuButtons[i]->GetActionCallback())->menuID==sender->GetActiveMenu()) @@ -1086,7 +1086,7 @@ void GameView::OnMouseUp(int x, int y, unsigned button) { if(selectMode==PlaceSave) { - if(placeSaveThumb && y <= YRES+MENUSIZE-BARSIZE) + if(placeSaveThumb && y <= WINDOWH-BARSIZE) { int thumbX = selectPoint2.X - (placeSaveThumb->Width/2); int thumbY = selectPoint2.Y - (placeSaveThumb->Height/2); @@ -2245,7 +2245,7 @@ void GameView::OnDraw() //Introduction text if(introText) { - g->fillrect(0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, introText>51?102:introText*2); + g->fillrect(0, 0, WINDOWW, WINDOWH, 0, 0, 0, introText>51?102:introText*2); g->drawtext(16, 20, (char*)introTextMessage.c_str(), 255, 255, 255, introText>51?255:introText*5); } } diff --git a/src/gui/interface/ContextMenu.cpp b/src/gui/interface/ContextMenu.cpp index e052d0d4f..dcf051f24 100644 --- a/src/gui/interface/ContextMenu.cpp +++ b/src/gui/interface/ContextMenu.cpp @@ -33,7 +33,7 @@ void ContextMenu::Show(ui::Point position) Size.X = 100; Size.Y = items.size()*16-1; - if(position.X+Size.X > XRES+BARSIZE) + if(position.X+Size.X > WINDOWW) position.X -= std::min(position.X, Size.X); if(position.Y+Size.Y > YRES+MENUSIZE) position.Y -= std::min(position.Y, Size.Y); diff --git a/src/gui/interface/Panel.cpp b/src/gui/interface/Panel.cpp index 0a81af37c..fc316a3ad 100644 --- a/src/gui/interface/Panel.cpp +++ b/src/gui/interface/Panel.cpp @@ -23,7 +23,7 @@ Panel::Panel(Point position, Point size): glEnable(GL_TEXTURE_2D); glGenTextures(1, &myVidTex); glBindTexture(GL_TEXTURE_2D, myVidTex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, XRES+BARSIZE, YRES+MENUSIZE, 0, GL_RGBA, GL_FLOAT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, WINDOWW, WINDOWH, 0, GL_RGBA, GL_FLOAT, NULL); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); @@ -38,7 +38,7 @@ Panel::Panel(Point position, Point size): glBindFramebuffer(GL_DRAW_FRAMEBUFFER, lastVid); #else - myVid = new pixel[(XRES+BARSIZE)*(YRES+MENUSIZE)]; + myVid = new pixel[WINDOWW*WINDOWH]; #endif } @@ -110,7 +110,7 @@ void Panel::Draw(const Point& screenPos) #else pixel * lastVid = ui::Engine::Ref().g->vid; ui::Engine::Ref().g->vid = myVid; - std::fill(myVid, myVid+((XRES+BARSIZE)*(YRES+MENUSIZE)), 0); + std::fill(myVid, myVid+(WINDOWW*WINDOWH), 0); #endif // attempt to draw all children @@ -140,7 +140,7 @@ void Panel::Draw(const Point& screenPos) int x = screenPos.X, y = screenPos.Y; int h = Size.Y, w = Size.X; - double texX = double(Size.X)/double(XRES+BARSIZE), texY = 1, texYB = 1-(double(Size.Y)/double(YRES+MENUSIZE)); + double texX = double(Size.X)/WINDOWW, texY = 1, texYB = 1-(double(Size.Y)/WINDOWH); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); @@ -162,7 +162,7 @@ void Panel::Draw(const Point& screenPos) //dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; for (int row = 0; row < Size.Y; row++) { - std::copy(myVid+(row*(XRES+BARSIZE)), myVid+(row*(XRES+BARSIZE))+Size.X, lastVid+((screenPos.Y+row)*(XRES+BARSIZE))+screenPos.X); + std::copy(myVid+(row*WINDOWW), myVid+(row*WINDOWW)+Size.X, lastVid+((screenPos.Y+row)*WINDOWW)+screenPos.X); } #endif } diff --git a/src/gui/interface/Textbox.cpp b/src/gui/interface/Textbox.cpp index c23bcb44f..ef07c67dc 100644 --- a/src/gui/interface/Textbox.cpp +++ b/src/gui/interface/Textbox.cpp @@ -695,7 +695,7 @@ void Textbox::Draw(const Point& screenPos) if(IsFocused()) { if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); - g->draw_line(screenPos.X+textPosition.X+cursorPosition, screenPos.Y+3, screenPos.X+textPosition.X+cursorPosition, screenPos.Y+12, 255, 255, 255, XRES+BARSIZE); + g->draw_line(screenPos.X+textPosition.X+cursorPosition, screenPos.Y+3, screenPos.X+textPosition.X+cursorPosition, screenPos.Y+12, 255, 255, 255, WINDOWW); } else { diff --git a/src/gui/interface/Window.cpp b/src/gui/interface/Window.cpp index 9ec68573b..bfffdb4c4 100644 --- a/src/gui/interface/Window.cpp +++ b/src/gui/interface/Window.cpp @@ -190,10 +190,10 @@ void Window::DoDraw() sprintf(tempString, "Position: L %d, R %d, T: %d, B: %d", focusedComponent_->Position.X, Size.X-(focusedComponent_->Position.X+focusedComponent_->Size.X), focusedComponent_->Position.Y, Size.Y-(focusedComponent_->Position.Y+focusedComponent_->Size.Y)); sprintf(tempString2, "Size: %d, %d", focusedComponent_->Size.X, focusedComponent_->Size.Y); - if(Graphics::textwidth(tempString)+xPos > XRES+BARSIZE) - xPos = XRES+BARSIZE-(Graphics::textwidth(tempString)+5); - if(Graphics::textwidth(tempString2)+xPos > XRES+BARSIZE) - xPos = XRES+BARSIZE-(Graphics::textwidth(tempString2)+5); + if(Graphics::textwidth(tempString)+xPos > WINDOWW) + xPos = WINDOWW-(Graphics::textwidth(tempString)+5); + if(Graphics::textwidth(tempString2)+xPos > WINDOWW) + xPos = WINDOWW-(Graphics::textwidth(tempString2)+5); g->drawtext(xPos, focusedComponent_->Position.Y+Position.Y+1, tempString, 0, 0, 0, 200); g->drawtext(xPos, focusedComponent_->Position.Y+Position.Y, tempString, 255, 255, 255, 255); diff --git a/src/gui/localbrowser/LocalBrowserView.cpp b/src/gui/localbrowser/LocalBrowserView.cpp index 218864cd4..c3173d4a2 100644 --- a/src/gui/localbrowser/LocalBrowserView.cpp +++ b/src/gui/localbrowser/LocalBrowserView.cpp @@ -15,12 +15,12 @@ #include "LocalBrowserModelException.h" LocalBrowserView::LocalBrowserView(): - ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)) + ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)) { - nextButton = new ui::Button(ui::Point(XRES+BARSIZE-52, YRES+MENUSIZE-18), ui::Point(50, 16), "Next \x95"); - previousButton = new ui::Button(ui::Point(1, YRES+MENUSIZE-18), ui::Point(50, 16), "\x96 Prev"); - undeleteButton = new ui::Button(ui::Point(XRES+BARSIZE-122, YRES+MENUSIZE-18), ui::Point(60, 16), "Rescan"); - infoLabel = new ui::Label(ui::Point(51, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-102, 16), "Loading..."); + nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), "Next \x95"); + previousButton = new ui::Button(ui::Point(1, WINDOWH-18), ui::Point(50, 16), "\x96 Prev"); + undeleteButton = new ui::Button(ui::Point(WINDOWW-122, WINDOWH-18), ui::Point(60, 16), "Rescan"); + infoLabel = new ui::Label(ui::Point(51, WINDOWH-18), ui::Point(WINDOWW-102, 16), "Loading..."); AddComponent(infoLabel); AddComponent(nextButton); AddComponent(previousButton); @@ -77,7 +77,7 @@ LocalBrowserView::LocalBrowserView(): } }; - removeSelected = new ui::Button(ui::Point((((XRES+BARSIZE)-100)/2), YRES+MENUSIZE-18), ui::Point(100, 16), "Delete"); + removeSelected = new ui::Button(ui::Point(((WINDOWW-100)/2), WINDOWH-18), ui::Point(100, 16), "Delete"); removeSelected->Visible = false; removeSelected->SetActionCallback(new RemoveSelectedAction(this)); AddComponent(removeSelected); diff --git a/src/gui/render/RenderView.cpp b/src/gui/render/RenderView.cpp index 8c09ceb6f..f4a84d1ca 100644 --- a/src/gui/render/RenderView.cpp +++ b/src/gui/render/RenderView.cpp @@ -77,7 +77,7 @@ public: }; RenderView::RenderView(): - ui::Window(ui::Point(0, 0), ui::Point(XRES, YRES+MENUSIZE)), + ui::Window(ui::Point(0, 0), ui::Point(XRES, WINDOWH)), toolTip(""), toolTipPresence(0), isToolTipFadingIn(false), @@ -353,7 +353,7 @@ void RenderView::NotifyColourChanged(RenderModel * sender) void RenderView::OnDraw() { Graphics * g = ui::Engine::Ref().g; - g->clearrect(-1, -1, XRES+BARSIZE+1, YRES+MENUSIZE+1); + g->clearrect(-1, -1, WINDOWW+1, WINDOWH+1); if(ren) { ren->clearScreen(1.0f); @@ -361,11 +361,11 @@ void RenderView::OnDraw() ren->RenderEnd(); } g->draw_line(0, YRES, XRES-1, YRES, 200, 200, 200, 255); - g->draw_line(line1, YRES, line1, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(line2, YRES, line2, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(line3, YRES, line3, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(line4, YRES, line4, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(XRES, 0, XRES, YRES+MENUSIZE, 255, 255, 255, 255); + g->draw_line(line1, YRES, line1, WINDOWH, 200, 200, 200, 255); + g->draw_line(line2, YRES, line2, WINDOWH, 200, 200, 200, 255); + g->draw_line(line3, YRES, line3, WINDOWH, 200, 200, 200, 255); + g->draw_line(line4, YRES, line4, WINDOWH, 200, 200, 200, 255); + g->draw_line(XRES, 0, XRES, WINDOWH, 255, 255, 255, 255); if(toolTipPresence && toolTip.length()) { g->drawtext(6, Size.Y-MENUSIZE-12, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5); diff --git a/src/gui/search/SearchController.cpp b/src/gui/search/SearchController.cpp index bd3e4d8de..65b0bac8f 100644 --- a/src/gui/search/SearchController.cpp +++ b/src/gui/search/SearchController.cpp @@ -188,7 +188,7 @@ void SearchController::OpenSave(int saveID) if(activePreview) delete activePreview; Graphics * g = ui::Engine::Ref().g; - g->fillrect(XRES/3, YRES+MENUSIZE-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable + g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable activePreview = new PreviewController(saveID, instantOpen, new OpenCallback(this)); ui::Engine::Ref().ShowWindow(activePreview->GetView()); } @@ -198,7 +198,7 @@ void SearchController::OpenSave(int saveID, int saveDate) if(activePreview) delete activePreview; Graphics * g = ui::Engine::Ref().g; - g->fillrect(XRES/3, YRES+MENUSIZE-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable + g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable activePreview = new PreviewController(saveID, saveDate, instantOpen, new OpenCallback(this)); ui::Engine::Ref().ShowWindow(activePreview->GetView()); } diff --git a/src/gui/search/SearchView.cpp b/src/gui/search/SearchView.cpp index 526592a4a..e79e478bc 100644 --- a/src/gui/search/SearchView.cpp +++ b/src/gui/search/SearchView.cpp @@ -10,7 +10,7 @@ #include "Misc.h" SearchView::SearchView(): - ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)), + ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)), saveButtons(vector()), errorLabel(NULL), c(NULL) @@ -18,11 +18,11 @@ SearchView::SearchView(): Client::Ref().AddListener(this); - nextButton = new ui::Button(ui::Point(XRES+BARSIZE-52, YRES+MENUSIZE-18), ui::Point(50, 16), "Next \x95"); - previousButton = new ui::Button(ui::Point(1, YRES+MENUSIZE-18), ui::Point(50, 16), "\x96 Prev"); - infoLabel = new ui::Label(ui::Point(260, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-520, 16), "Page 1 of 1"); - tagsLabel = new ui::Label(ui::Point(270, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-540, 16), "\boPopular Tags:"); - motdLabel = new ui::RichLabel(ui::Point(51, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-102, 16), Client::Ref().GetMessageOfTheDay()); + nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), "Next \x95"); + previousButton = new ui::Button(ui::Point(1, WINDOWH-18), ui::Point(50, 16), "\x96 Prev"); + infoLabel = new ui::Label(ui::Point(260, WINDOWH-18), ui::Point(WINDOWW-520, 16), "Page 1 of 1"); + tagsLabel = new ui::Label(ui::Point(270, WINDOWH-18), ui::Point(WINDOWW-540, 16), "\boPopular Tags:"); + motdLabel = new ui::RichLabel(ui::Point(51, WINDOWH-18), ui::Point(WINDOWW-102, 16), Client::Ref().GetMessageOfTheDay()); class SearchAction : public ui::TextboxAction { @@ -34,7 +34,7 @@ SearchView::SearchView(): v->doSearch(); } }; - searchField = new ui::Textbox(ui::Point(60, 10), ui::Point((XRES+BARSIZE)-238, 17), "", "[search]"); + searchField = new ui::Textbox(ui::Point(60, 10), ui::Point(WINDOWW-238, 17), "", "[search]"); searchField->Appearance.icon = IconSearch; searchField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; searchField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; @@ -51,7 +51,7 @@ SearchView::SearchView(): v->c->ChangeSort(); } }; - sortButton = new ui::Button(ui::Point(XRES+BARSIZE-140, 10), ui::Point(61, 17), "Sort"); + sortButton = new ui::Button(ui::Point(WINDOWW-140, 10), ui::Point(61, 17), "Sort"); sortButton->SetIcon(IconVoteSort); sortButton->SetTogglable(true); sortButton->SetActionCallback(new SortAction(this)); @@ -69,7 +69,7 @@ SearchView::SearchView(): v->c->ShowOwn(sender->GetToggleState()); } }; - ownButton = new ui::Button(ui::Point(XRES+BARSIZE-70, 10), ui::Point(61, 17), "My Own"); + ownButton = new ui::Button(ui::Point(WINDOWW-70, 10), ui::Point(61, 17), "My Own"); ownButton->SetIcon(IconMyOwn); ownButton->SetTogglable(true); ownButton->SetActionCallback(new MyOwnAction(this)); @@ -148,7 +148,7 @@ SearchView::SearchView(): AddComponent(searchField); AddComponent(infoLabel); - loadingSpinner = new ui::Spinner(ui::Point(((XRES+BARSIZE)/2)-12, ((YRES+MENUSIZE)/2)+12), ui::Point(24, 24)); + loadingSpinner = new ui::Spinner(ui::Point((WINDOWW/2)-12, (WINDOWH/2)+12), ui::Point(24, 24)); AddComponent(loadingSpinner); ui::Label * searchPrompt = new ui::Label(ui::Point(10, 10), ui::Point(50, 16), "Search:"); @@ -200,22 +200,22 @@ SearchView::SearchView(): } }; - removeSelected = new ui::Button(ui::Point((((XRES+BARSIZE)-415)/2), YRES+MENUSIZE-18), ui::Point(100, 16), "Delete"); + removeSelected = new ui::Button(ui::Point(((WINDOWW-415)/2), WINDOWH-18), ui::Point(100, 16), "Delete"); removeSelected->Visible = false; removeSelected->SetActionCallback(new RemoveSelectedAction(this)); AddComponent(removeSelected); - unpublishSelected = new ui::Button(ui::Point((((XRES+BARSIZE)-415)/2)+105, YRES+MENUSIZE-18), ui::Point(100, 16), "Unpublish"); + unpublishSelected = new ui::Button(ui::Point(((WINDOWW-415)/2)+105, WINDOWH-18), ui::Point(100, 16), "Unpublish"); unpublishSelected->Visible = false; unpublishSelected->SetActionCallback(new UnpublishSelectedAction(this)); AddComponent(unpublishSelected); - favouriteSelected = new ui::Button(ui::Point((((XRES+BARSIZE)-415)/2)+210, YRES+MENUSIZE-18), ui::Point(100, 16), "Favourite"); + favouriteSelected = new ui::Button(ui::Point(((WINDOWW-415)/2)+210, WINDOWH-18), ui::Point(100, 16), "Favourite"); favouriteSelected->Visible = false; favouriteSelected->SetActionCallback(new FavouriteSelectedAction(this)); AddComponent(favouriteSelected); - clearSelection = new ui::Button(ui::Point((((XRES+BARSIZE)-415)/2)+315, YRES+MENUSIZE-18), ui::Point(100, 16), "Clear selection"); + clearSelection = new ui::Button(ui::Point(((WINDOWW-415)/2)+315, WINDOWH-18), ui::Point(100, 16), "Clear selection"); clearSelection->Visible = false; clearSelection->SetActionCallback(new ClearSelectionAction(this)); AddComponent(clearSelection); @@ -558,7 +558,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender) loadingSpinner->Visible = false; if(!errorLabel) { - errorLabel = new ui::Label(ui::Point(((XRES+BARSIZE)/2)-100, ((YRES+MENUSIZE)/2)-6), ui::Point(200, 12), "Error"); + errorLabel = new ui::Label(ui::Point((WINDOWW/2)-100, (WINDOWH/2)-6), ui::Point(200, 12), "Error"); AddComponent(errorLabel); } if(!sender->GetSavesLoaded()) diff --git a/src/powdertoyjava/PowderToyJava.cpp b/src/powdertoyjava/PowderToyJava.cpp index 835fdc401..67c9f61aa 100644 --- a/src/powdertoyjava/PowderToyJava.cpp +++ b/src/powdertoyjava/PowderToyJava.cpp @@ -24,7 +24,7 @@ JNIEXPORT void JNICALL Java_PowderToy_initialise(JNIEnv * env, jobject canvas) ui::Engine::Ref().g = new Graphics(); engine = &ui::Engine::Ref(); - engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); + engine->Begin(WINDOWW, WINDOWH); gameController = new GameController(); engine->ShowWindow(gameController->GetView()); @@ -51,12 +51,12 @@ JNIEXPORT void JNICALL Java_PowderToy_finish(JNIEnv * env, jobject canvas) JNIEXPORT jint JNICALL Java_PowderToy_getWidth(JNIEnv * env, jobject canvas) { - return XRES+BARSIZE; + return WINDOWW; } JNIEXPORT jint JNICALL Java_PowderToy_getHeight(JNIEnv * env, jobject canvas) { - return YRES+MENUSIZE; + return WINDOWH; } JNIEXPORT void JNICALL Java_PowderToy_mousePressed(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton) diff --git a/src/simulation/SaveRenderer.cpp b/src/simulation/SaveRenderer.cpp index 4fabd95f3..98a111fef 100644 --- a/src/simulation/SaveRenderer.cpp +++ b/src/simulation/SaveRenderer.cpp @@ -137,7 +137,7 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire) { memcpy(dst, src, (width*CELL)*PIXELSIZE); dst+=(width*CELL);///PIXELSIZE; - src+=XRES+BARSIZE; + src+=WINDOWW; } tempThumb = new VideoBuffer(pData, width*CELL, height*CELL); if(pData) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 999a6bbaa..ffe980e15 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -1900,7 +1900,7 @@ void Simulation::clear_sim(void) fighcount = 0; player.spwn = 0; player2.spwn = 0; - //memset(pers_bg, 0, (XRES+BARSIZE)*YRES*PIXELSIZE); + //memset(pers_bg, 0, WINDOWW*YRES*PIXELSIZE); //memset(fire_r, 0, sizeof(fire_r)); //memset(fire_g, 0, sizeof(fire_g)); //memset(fire_b, 0, sizeof(fire_b));