add defines for window resolution

--amend
This commit is contained in:
mniip 2013-11-10 13:02:55 +04:00
parent c4562ec73e
commit fdfaa3a29b
23 changed files with 112 additions and 109 deletions

View File

@ -125,6 +125,9 @@
#define XCNTR 306 #define XCNTR 306
#define YCNTR 192 #define YCNTR 192
#define WINDOWW (XRES+BARSIZE)
#define WINDOWH (YRES+MENUSIZE)
#define MAX_DISTANCE sqrt(pow((float)XRES, 2)+pow((float)YRES, 2)) #define MAX_DISTANCE sqrt(pow((float)XRES, 2)+pow((float)YRES, 2))
#define GRAV_DIFF #define GRAV_DIFF

View File

@ -76,7 +76,7 @@ int main(int argc, char *argv[])
ui::Engine::Ref().g = new Graphics(); ui::Engine::Ref().g = new Graphics();
engine = &ui::Engine::Ref(); engine = &ui::Engine::Ref();
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); engine->Begin(WINDOWW, WINDOWH);
GameSave * gameSave = new GameSave(inputFile); GameSave * gameSave = new GameSave(inputFile);

View File

@ -200,7 +200,7 @@ void blit(pixel * vid)
if(sdl_scrn) if(sdl_scrn)
{ {
pixel * src = vid; 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; pixel *dst;
if (SDL_MUSTLOCK(sdl_scrn)) if (SDL_MUSTLOCK(sdl_scrn))
if (SDL_LockSurface(sdl_scrn)<0) if (SDL_LockSurface(sdl_scrn)<0)
@ -244,7 +244,7 @@ void blit2(pixel * vid, int currentScale)
if(sdl_scrn) if(sdl_scrn)
{ {
pixel * src = vid; 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; pixel *dst;
int i,k; int i,k;
if (SDL_MUSTLOCK(sdl_scrn)) if (SDL_MUSTLOCK(sdl_scrn))
@ -354,9 +354,9 @@ SDL_Surface * SDLSetScreen(int newScale, bool newFullscreen)
fullscreen = newFullscreen; fullscreen = newFullscreen;
SDL_Surface * surface; SDL_Surface * surface;
#ifndef OGLI #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 #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 #endif
return surface; return surface;
} }
@ -469,7 +469,7 @@ void EventProcess(SDL_Event event)
#ifdef OGLI #ifdef OGLI
case SDL_VIDEORESIZE: case SDL_VIDEORESIZE:
{ {
float ratio = float(XRES+BARSIZE) / float(YRES+MENUSIZE); float ratio = (float)WINDOWW / WINDOWH;
float width = event.resize.w; float width = event.resize.w;
float height = width/ratio; float height = width/ratio;
@ -481,9 +481,9 @@ void EventProcess(SDL_Event event)
currentWidth = width; currentWidth = width;
currentHeight = height; currentHeight = height;
inputScale = float(XRES+BARSIZE)/currentWidth; inputScale = (float)WINDOWW/currentWidth;
glLineWidth(currentWidth/float(XRES+BARSIZE)); glLineWidth(currentWidth/(float)WINDOWW);
if(sdl_scrn == NULL) if(sdl_scrn == NULL)
{ {
std::cerr << "Oh bugger" << std::endl; std::cerr << "Oh bugger" << std::endl;
@ -615,8 +615,8 @@ bool LoadWindowPosition(int scale)
SDL_VERSION(&sysInfo.version); SDL_VERSION(&sysInfo.version);
if (SDL_GetWMInfo(&sysInfo) > 0) if (SDL_GetWMInfo(&sysInfo) > 0)
{ {
int windowW = (XRES + BARSIZE) * scale; int windowW = WINDOWW * scale;
int windowH = (YRES + MENUSIZE) * scale; int windowH = WINDOWH * scale;
int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX); int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX); int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
@ -748,8 +748,8 @@ void SigHandler(int signal)
int main(int argc, char * argv[]) int main(int argc, char * argv[])
{ {
currentWidth = XRES+BARSIZE; currentWidth = WINDOWW;
currentHeight = YRES+MENUSIZE; currentHeight = WINDOWH;
std::map<std::string, std::string> arguments = readArguments(argc, argv); std::map<std::string, std::string> arguments = readArguments(argc, argv);
@ -839,7 +839,7 @@ int main(int argc, char * argv[])
engine = &ui::Engine::Ref(); engine = &ui::Engine::Ref();
engine->SetMaxSize(desktopWidth, desktopHeight); engine->SetMaxSize(desktopWidth, desktopHeight);
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); engine->Begin(WINDOWW, WINDOWH);
engine->SetFastQuit(Client::Ref().GetPrefBool("FastQuit", true)); engine->SetFastQuit(Client::Ref().GetPrefBool("FastQuit", true));
#if !defined(DEBUG) && !defined(_DEBUG) #if !defined(DEBUG) && !defined(_DEBUG)

View File

@ -870,7 +870,7 @@ int luatpt_drawtext(lua_State* l)
textgreen = luaL_optint(l, 5, 255); textgreen = luaL_optint(l, 5, 255);
textblue = luaL_optint(l, 6, 255); textblue = luaL_optint(l, 6, 255);
textalpha = luaL_optint(l, 7, 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); return luaL_error(l, "Screen coordinates out of range (%d,%d)", textx, texty);
if (textred<0) textred = 0; if (textred<0) textred = 0;
if (textred>255) textred = 255; if (textred>255) textred = 255;
@ -1430,7 +1430,7 @@ int luatpt_drawpixel(lua_State* l)
b = luaL_optint(l, 5, 255); b = luaL_optint(l, 5, 255);
a = luaL_optint(l, 6, 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); return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y);
if (r<0) r = 0; if (r<0) r = 0;
if (r>255) r = 255; if (r>255) r = 255;
@ -1456,12 +1456,12 @@ int luatpt_drawrect(lua_State* l)
b = luaL_optint(l, 7, 255); b = luaL_optint(l, 7, 255);
a = luaL_optint(l, 8, 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); return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y);
if(x+w > XRES+BARSIZE) if(x+w > WINDOWW)
w = XRES+BARSIZE-x; w = WINDOWW-x;
if(y+h > YRES+MENUSIZE) if(y+h > WINDOWH)
h = YRES+MENUSIZE-y; h = WINDOWH-y;
if (r<0) r = 0; if (r<0) r = 0;
if (r>255) r = 255; if (r>255) r = 255;
if (g<0) g = 0; if (g<0) g = 0;
@ -1486,12 +1486,12 @@ int luatpt_fillrect(lua_State* l)
b = luaL_optint(l, 7, 255); b = luaL_optint(l, 7, 255);
a = luaL_optint(l, 8, 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); return luaL_error(l, "Screen coordinates out of range (%d,%d)", x, y);
if(x+w > XRES+BARSIZE) if(x+w > WINDOWW)
w = XRES+BARSIZE-x; w = WINDOWW-x;
if(y+h > YRES+MENUSIZE) if(y+h > WINDOWH)
h = YRES+MENUSIZE-y; h = WINDOWH-y;
if (r<0) r = 0; if (r<0) r = 0;
if (r>255) r = 255; if (r>255) r = 255;
if (g<0) g = 0; if (g<0) g = 0;

View File

@ -2339,8 +2339,8 @@ void LuaScriptInterface::initGraphicsAPI()
lua_getglobal(l, "graphics"); lua_getglobal(l, "graphics");
lua_setglobal(l, "gfx"); lua_setglobal(l, "gfx");
lua_pushinteger(l, XRES+BARSIZE); lua_setfield(l, -2, "WIDTH"); lua_pushinteger(l, WINDOWW); lua_setfield(l, -2, "WIDTH");
lua_pushinteger(l, YRES+MENUSIZE); lua_setfield(l, -2, "HEIGHT"); lua_pushinteger(l, WINDOWH); lua_setfield(l, -2, "HEIGHT");
} }
int LuaScriptInterface::graphics_textSize(lua_State * l) int LuaScriptInterface::graphics_textSize(lua_State * l)

View File

@ -1169,8 +1169,8 @@ VideoBuffer Graphics::DumpFrame()
{ {
#ifdef OGLI #ifdef OGLI
#else #else
VideoBuffer newBuffer(XRES+BARSIZE, YRES+MENUSIZE); VideoBuffer newBuffer(WINDOWW, WINDOWH);
std::copy(vid, vid+((XRES+BARSIZE)*(YRES+MENUSIZE)), newBuffer.Buffer); std::copy(vid, vid+(WINDOWW*WINDOWH), newBuffer.Buffer);
return newBuffer; return newBuffer;
#endif #endif
} }

View File

@ -23,7 +23,7 @@ Graphics::Graphics():
glGenTextures(1, &vidBuf); glGenTextures(1, &vidBuf);
glBindTexture(GL_TEXTURE_2D, 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_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
@ -61,13 +61,13 @@ void Graphics::Reset()
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
//glOrtho(0, (XRES+BARSIZE)*sdl_scale, 0, (YRES+MENUSIZE)*sdl_scale, -1, 1); //glOrtho(0, WINDOWW*sdl_scale, 0, WINDOWH*sdl_scale, -1, 1);
glOrtho(0, (XRES+BARSIZE)*sdl_scale, (YRES+MENUSIZE)*sdl_scale, 0, -1, 1); glOrtho(0, WINDOWW*sdl_scale, WINDOWH*sdl_scale, 0, -1, 1);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
//glRasterPos2i(0, (YRES+MENUSIZE)); //glRasterPos2i(0, WINDOWH);
glRasterPos2i(0, 0); glRasterPos2i(0, 0);
glPixelZoom(1, 1); glPixelZoom(1, 1);
} }
@ -83,8 +83,8 @@ void Graphics::Finalise()
glFlush(); glFlush();
} }
#define VIDXRES XRES+BARSIZE #define VIDXRES WINDOWW
#define VIDYRES YRES+MENUSIZE #define VIDYRES WINDOWH
#define PIXELMETHODS_CLASS Graphics #define PIXELMETHODS_CLASS Graphics
#include "OpenGLDrawMethods.inl" #include "OpenGLDrawMethods.inl"
#undef VIDYRES #undef VIDYRES

View File

@ -5,7 +5,7 @@
Graphics::Graphics(): Graphics::Graphics():
sdl_scale(1) 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() void Graphics::Clear()
{ {
memset(vid, 0, PIXELSIZE * ((XRES+BARSIZE) * (YRES+MENUSIZE))); memset(vid, 0, PIXELSIZE * (WINDOWW * WINDOWH));
} }
void Graphics::Finalise() void Graphics::Finalise()
@ -34,8 +34,8 @@ void Graphics::Finalise()
} }
#define VIDXRES XRES+BARSIZE #define VIDXRES WINDOWW
#define VIDYRES YRES+MENUSIZE #define VIDYRES WINDOWH
#define PIXELMETHODS_CLASS Graphics #define PIXELMETHODS_CLASS Graphics
#include "RasterDrawMethods.inl" #include "RasterDrawMethods.inl"
#undef VIDYRES #undef VIDYRES

View File

@ -22,8 +22,8 @@ extern "C"
} }
#ifndef OGLI #ifndef OGLI
#define VIDXRES (XRES+BARSIZE) #define VIDXRES WINDOWW
#define VIDYRES (YRES+MENUSIZE) #define VIDYRES WINDOWH
#else #else
#define VIDXRES XRES #define VIDXRES XRES
#define VIDYRES YRES #define VIDYRES YRES
@ -356,10 +356,10 @@ void Renderer::FinaliseParts()
glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2d(1, 0); 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); glVertex3f(XRES*sdl_scale, YRES*sdl_scale, 1.0);
glTexCoord2d(0, 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); glVertex3f(0, YRES*sdl_scale, 1.0);
glTexCoord2d(0, 1); glTexCoord2d(0, 1);
//glVertex3f(0, MENUSIZE*sdl_scale, 1.0); //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);
glVertex2i(zoomScopePosition.X+zoomScopeSize, zoomScopePosition.Y+zoomScopeSize); glVertex2i(zoomScopePosition.X+zoomScopeSize, zoomScopePosition.Y+zoomScopeSize);
glVertex2i(zoomScopePosition.X, 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, (WINDOWH-(zoomScopePosition.Y-1))*sdl_scale, 0);
glVertex3i((zoomScopePosition.X-1)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0); glVertex3i((zoomScopePosition.X-1)*sdl_scale, (WINDOWH-(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, (WINDOWH-(zoomScopePosition.Y+zoomScopeSize))*sdl_scale, 0);
glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (YRES+MENUSIZE-(zoomScopePosition.Y-1))*sdl_scale, 0); glVertex3i((zoomScopePosition.X+zoomScopeSize)*sdl_scale, (WINDOWH-(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);*/
glEnd(); glEnd();
glDisable(GL_COLOR_LOGIC_OP); glDisable(GL_COLOR_LOGIC_OP);
} }
@ -880,7 +880,7 @@ void Renderer::DrawWalls()
drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24); drawblob((x*CELL+i), (y*CELL+j), 0x24, 0x24, 0x24);
for (j=0; j<CELL; j+=2) for (j=0; j<CELL; j+=2)
for (i=0; i<CELL; i+=2) for (i=0; i<CELL; i+=2)
vid[(y*CELL+j)*(XRES+BARSIZE)+(x*CELL+i)] = PIXPACK(0x000000); vid[(y*CELL+j)*WINDOWW+(x*CELL+i)] = PIXPACK(0x000000);
} }
else else
{ {
@ -2169,8 +2169,8 @@ void Renderer::draw_other() // EMP effect
glColor4f(femp_decor*2.5f, 0.4f+femp_decor*1.5f, 1.0f+femp_decor*1.5f, femp_decor/0.44f); glColor4f(femp_decor*2.5f, 0.4f+femp_decor*1.5f, 1.0f+femp_decor*1.5f, femp_decor/0.44f);
glVertex2f(0, MENUSIZE); glVertex2f(0, MENUSIZE);
glVertex2f(XRES, MENUSIZE); glVertex2f(XRES, MENUSIZE);
glVertex2f(XRES, YRES+MENUSIZE); glVertex2f(XRES, WINDOWH);
glVertex2f(0, YRES+MENUSIZE); glVertex2f(0, WINDOWH);
glEnd(); glEnd();
glTranslated(0, -MENUSIZE, 0); glTranslated(0, -MENUSIZE, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, prevFbo); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, prevFbo);
@ -2795,7 +2795,7 @@ VideoBuffer Renderer::DumpFrame()
VideoBuffer newBuffer(XRES, YRES); VideoBuffer newBuffer(XRES, YRES);
for(int y = 0; y < YRES; y++) for(int y = 0; y < YRES; y++)
{ {
std::copy(vid+(y*(XRES+BARSIZE)), vid+(y*(XRES+BARSIZE))+XRES, newBuffer.Buffer+(y*XRES)); std::copy(vid+(y*WINDOWW), vid+(y*WINDOWW)+XRES, newBuffer.Buffer+(y*XRES));
} }
return newBuffer; return newBuffer;
#endif #endif

View File

@ -2,7 +2,7 @@
#include "gui/interface/Keys.h" #include "gui/interface/Keys.h"
ConsoleView::ConsoleView(): ConsoleView::ConsoleView():
ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, 150)), ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),
commandField(NULL) commandField(NULL)
{ {
class CommandHighlighter: public ui::TextboxAction class CommandHighlighter: public ui::TextboxAction

View File

@ -21,9 +21,9 @@ public:
for (int x=0; x<width; x++) for (int x=0; x<width; x++)
{ {
//if (toolID == DECO_LIGH) //if (toolID == DECO_LIGH)
// vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXRGB(PIXR(pc)-10*j, PIXG(pc)-10*j, PIXB(pc)-10*j); // vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)-10*j, PIXG(pc)-10*j, PIXB(pc)-10*j);
//else if (toolID == DECO_DARK) //else if (toolID == DECO_DARK)
// vid_buf[(XRES+BARSIZE)*(y+j)+(x+i)] = PIXRGB(PIXR(pc)+10*j, PIXG(pc)+10*j, PIXB(pc)+10*j); // vid_buf[WINDOWW*(y+j)+(x+i)] = PIXRGB(PIXR(pc)+10*j, PIXG(pc)+10*j, PIXB(pc)+10*j);
if (toolID == DECO_SMUDGE) if (toolID == DECO_SMUDGE)
newTexture->SetPixel(x, y, 0, 255-5*x, 255+5*x, 255); newTexture->SetPixel(x, y, 0, 255-5*x, 255+5*x, 255);
else if (toolID == DECO_DRAW || toolID == DECO_CLEAR) else if (toolID == DECO_DRAW || toolID == DECO_CLEAR)

View File

@ -143,7 +143,7 @@ public:
GameView::GameView(): 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<ui::Point>()), pointQueue(queue<ui::Point>()),
isMouseDown(false), isMouseDown(false),
ren(NULL), ren(NULL),
@ -415,7 +415,7 @@ GameView::GameView():
v->c->OpenElementSearch(); 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->Appearance.Margin = ui::Border(0, 2, 3, 2);
tempButton->SetActionCallback(new ElementSearchAction(this)); tempButton->SetActionCallback(new ElementSearchAction(this));
AddComponent(tempButton); AddComponent(tempButton);
@ -539,7 +539,7 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender)
for(vector<QuickOption*>::iterator iter = optionList.begin(), end = optionList.end(); iter != end; ++iter) for(vector<QuickOption*>::iterator iter = optionList.begin(), end = optionList.end(); iter != end; ++iter)
{ {
QuickOption * option = *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->Appearance.Margin = ui::Border(0, 2, 3, 2);
tempButton->SetTogglable(true); tempButton->SetTogglable(true);
tempButton->SetActionCallback(new OptionAction(option)); tempButton->SetActionCallback(new OptionAction(option));
@ -553,7 +553,7 @@ void GameView::NotifyQuickOptionsChanged(GameModel * sender)
void GameView::NotifyMenuListChanged(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++) for(int i = 0; i < menuButtons.size(); i++)
{ {
RemoveComponent(menuButtons[i]); RemoveComponent(menuButtons[i]);
@ -571,7 +571,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
{ {
std::string tempString = ""; std::string tempString = "";
tempString += menuList[i]->GetIcon(); 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->Appearance.Margin = ui::Border(0, 2, 3, 2);
tempButton->SetTogglable(true); tempButton->SetTogglable(true);
tempButton->SetActionCallback(new MenuAction(this, i)); tempButton->SetActionCallback(new MenuAction(this, i));
@ -666,7 +666,7 @@ void GameView::NotifyLastToolChanged(GameModel * sender)
void GameView::NotifyToolListChanged(GameModel * sender) void GameView::NotifyToolListChanged(GameModel * sender)
{ {
lastOffset = 0; lastOffset = 0;
int currentX = XRES+BARSIZE-56; int currentX = WINDOWW-56;
for(int i = 0; i < menuButtons.size(); i++) for(int i = 0; i < menuButtons.size(); i++)
{ {
if(((MenuAction*)menuButtons[i]->GetActionCallback())->menuID==sender->GetActiveMenu()) 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(selectMode==PlaceSave)
{ {
if(placeSaveThumb && y <= YRES+MENUSIZE-BARSIZE) if(placeSaveThumb && y <= WINDOWH-BARSIZE)
{ {
int thumbX = selectPoint2.X - (placeSaveThumb->Width/2); int thumbX = selectPoint2.X - (placeSaveThumb->Width/2);
int thumbY = selectPoint2.Y - (placeSaveThumb->Height/2); int thumbY = selectPoint2.Y - (placeSaveThumb->Height/2);
@ -2245,7 +2245,7 @@ void GameView::OnDraw()
//Introduction text //Introduction text
if(introText) 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); g->drawtext(16, 20, (char*)introTextMessage.c_str(), 255, 255, 255, introText>51?255:introText*5);
} }
} }

View File

@ -33,7 +33,7 @@ void ContextMenu::Show(ui::Point position)
Size.X = 100; Size.X = 100;
Size.Y = items.size()*16-1; 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); position.X -= std::min(position.X, Size.X);
if(position.Y+Size.Y > YRES+MENUSIZE) if(position.Y+Size.Y > YRES+MENUSIZE)
position.Y -= std::min(position.Y, Size.Y); position.Y -= std::min(position.Y, Size.Y);

View File

@ -23,7 +23,7 @@ Panel::Panel(Point position, Point size):
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glGenTextures(1, &myVidTex); glGenTextures(1, &myVidTex);
glBindTexture(GL_TEXTURE_2D, 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_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_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); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, lastVid);
#else #else
myVid = new pixel[(XRES+BARSIZE)*(YRES+MENUSIZE)]; myVid = new pixel[WINDOWW*WINDOWH];
#endif #endif
} }
@ -110,7 +110,7 @@ void Panel::Draw(const Point& screenPos)
#else #else
pixel * lastVid = ui::Engine::Ref().g->vid; pixel * lastVid = ui::Engine::Ref().g->vid;
ui::Engine::Ref().g->vid = myVid; ui::Engine::Ref().g->vid = myVid;
std::fill(myVid, myVid+((XRES+BARSIZE)*(YRES+MENUSIZE)), 0); std::fill(myVid, myVid+(WINDOWW*WINDOWH), 0);
#endif #endif
// attempt to draw all children // attempt to draw all children
@ -140,7 +140,7 @@ void Panel::Draw(const Point& screenPos)
int x = screenPos.X, y = screenPos.Y; int x = screenPos.X, y = screenPos.Y;
int h = Size.Y, w = Size.X; 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); glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
@ -162,7 +162,7 @@ void Panel::Draw(const Point& screenPos)
//dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x; //dst=(pixel *)sdl_scrn->pixels+y*sdl_scrn->pitch/PIXELSIZE+x;
for (int row = 0; row < Size.Y; row++) 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 #endif
} }

View File

@ -695,7 +695,7 @@ void Textbox::Draw(const Point& screenPos)
if(IsFocused()) if(IsFocused())
{ {
if(border) g->drawrect(screenPos.X, screenPos.Y, Size.X, Size.Y, 255, 255, 255, 255); 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 else
{ {

View File

@ -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(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); sprintf(tempString2, "Size: %d, %d", focusedComponent_->Size.X, focusedComponent_->Size.Y);
if(Graphics::textwidth(tempString)+xPos > XRES+BARSIZE) if(Graphics::textwidth(tempString)+xPos > WINDOWW)
xPos = XRES+BARSIZE-(Graphics::textwidth(tempString)+5); xPos = WINDOWW-(Graphics::textwidth(tempString)+5);
if(Graphics::textwidth(tempString2)+xPos > XRES+BARSIZE) if(Graphics::textwidth(tempString2)+xPos > WINDOWW)
xPos = XRES+BARSIZE-(Graphics::textwidth(tempString2)+5); 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+1, tempString, 0, 0, 0, 200);
g->drawtext(xPos, focusedComponent_->Position.Y+Position.Y, tempString, 255, 255, 255, 255); g->drawtext(xPos, focusedComponent_->Position.Y+Position.Y, tempString, 255, 255, 255, 255);

View File

@ -15,12 +15,12 @@
#include "LocalBrowserModelException.h" #include "LocalBrowserModelException.h"
LocalBrowserView::LocalBrowserView(): 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"); nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), "Next \x95");
previousButton = new ui::Button(ui::Point(1, YRES+MENUSIZE-18), ui::Point(50, 16), "\x96 Prev"); previousButton = new ui::Button(ui::Point(1, WINDOWH-18), ui::Point(50, 16), "\x96 Prev");
undeleteButton = new ui::Button(ui::Point(XRES+BARSIZE-122, YRES+MENUSIZE-18), ui::Point(60, 16), "Rescan"); undeleteButton = new ui::Button(ui::Point(WINDOWW-122, WINDOWH-18), ui::Point(60, 16), "Rescan");
infoLabel = new ui::Label(ui::Point(51, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-102, 16), "Loading..."); infoLabel = new ui::Label(ui::Point(51, WINDOWH-18), ui::Point(WINDOWW-102, 16), "Loading...");
AddComponent(infoLabel); AddComponent(infoLabel);
AddComponent(nextButton); AddComponent(nextButton);
AddComponent(previousButton); 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->Visible = false;
removeSelected->SetActionCallback(new RemoveSelectedAction(this)); removeSelected->SetActionCallback(new RemoveSelectedAction(this));
AddComponent(removeSelected); AddComponent(removeSelected);

View File

@ -77,7 +77,7 @@ public:
}; };
RenderView::RenderView(): RenderView::RenderView():
ui::Window(ui::Point(0, 0), ui::Point(XRES, YRES+MENUSIZE)), ui::Window(ui::Point(0, 0), ui::Point(XRES, WINDOWH)),
toolTip(""), toolTip(""),
toolTipPresence(0), toolTipPresence(0),
isToolTipFadingIn(false), isToolTipFadingIn(false),
@ -353,7 +353,7 @@ void RenderView::NotifyColourChanged(RenderModel * sender)
void RenderView::OnDraw() void RenderView::OnDraw()
{ {
Graphics * g = ui::Engine::Ref().g; 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) if(ren)
{ {
ren->clearScreen(1.0f); ren->clearScreen(1.0f);
@ -361,11 +361,11 @@ void RenderView::OnDraw()
ren->RenderEnd(); ren->RenderEnd();
} }
g->draw_line(0, YRES, XRES-1, YRES, 200, 200, 200, 255); 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(line1, YRES, line1, WINDOWH, 200, 200, 200, 255);
g->draw_line(line2, YRES, line2, YRES+MENUSIZE, 200, 200, 200, 255); g->draw_line(line2, YRES, line2, WINDOWH, 200, 200, 200, 255);
g->draw_line(line3, YRES, line3, YRES+MENUSIZE, 200, 200, 200, 255); g->draw_line(line3, YRES, line3, WINDOWH, 200, 200, 200, 255);
g->draw_line(line4, YRES, line4, YRES+MENUSIZE, 200, 200, 200, 255); g->draw_line(line4, YRES, line4, WINDOWH, 200, 200, 200, 255);
g->draw_line(XRES, 0, XRES, YRES+MENUSIZE, 255, 255, 255, 255); g->draw_line(XRES, 0, XRES, WINDOWH, 255, 255, 255, 255);
if(toolTipPresence && toolTip.length()) if(toolTipPresence && toolTip.length())
{ {
g->drawtext(6, Size.Y-MENUSIZE-12, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5); g->drawtext(6, Size.Y-MENUSIZE-12, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5);

View File

@ -188,7 +188,7 @@ void SearchController::OpenSave(int saveID)
if(activePreview) if(activePreview)
delete activePreview; delete activePreview;
Graphics * g = ui::Engine::Ref().g; 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)); activePreview = new PreviewController(saveID, instantOpen, new OpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView()); ui::Engine::Ref().ShowWindow(activePreview->GetView());
} }
@ -198,7 +198,7 @@ void SearchController::OpenSave(int saveID, int saveDate)
if(activePreview) if(activePreview)
delete activePreview; delete activePreview;
Graphics * g = ui::Engine::Ref().g; 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)); activePreview = new PreviewController(saveID, saveDate, instantOpen, new OpenCallback(this));
ui::Engine::Ref().ShowWindow(activePreview->GetView()); ui::Engine::Ref().ShowWindow(activePreview->GetView());
} }

View File

@ -10,7 +10,7 @@
#include "Misc.h" #include "Misc.h"
SearchView::SearchView(): 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<ui::SaveButton*>()), saveButtons(vector<ui::SaveButton*>()),
errorLabel(NULL), errorLabel(NULL),
c(NULL) c(NULL)
@ -18,11 +18,11 @@ SearchView::SearchView():
Client::Ref().AddListener(this); Client::Ref().AddListener(this);
nextButton = new ui::Button(ui::Point(XRES+BARSIZE-52, YRES+MENUSIZE-18), ui::Point(50, 16), "Next \x95"); nextButton = new ui::Button(ui::Point(WINDOWW-52, WINDOWH-18), ui::Point(50, 16), "Next \x95");
previousButton = new ui::Button(ui::Point(1, YRES+MENUSIZE-18), ui::Point(50, 16), "\x96 Prev"); previousButton = new ui::Button(ui::Point(1, WINDOWH-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"); 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, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-540, 16), "\boPopular Tags:"); tagsLabel = new ui::Label(ui::Point(270, WINDOWH-18), ui::Point(WINDOWW-540, 16), "\boPopular Tags:");
motdLabel = new ui::RichLabel(ui::Point(51, YRES+MENUSIZE-18), ui::Point(XRES+BARSIZE-102, 16), Client::Ref().GetMessageOfTheDay()); motdLabel = new ui::RichLabel(ui::Point(51, WINDOWH-18), ui::Point(WINDOWW-102, 16), Client::Ref().GetMessageOfTheDay());
class SearchAction : public ui::TextboxAction class SearchAction : public ui::TextboxAction
{ {
@ -34,7 +34,7 @@ SearchView::SearchView():
v->doSearch(); 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.icon = IconSearch;
searchField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft; searchField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;
searchField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; searchField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;
@ -51,7 +51,7 @@ SearchView::SearchView():
v->c->ChangeSort(); 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->SetIcon(IconVoteSort);
sortButton->SetTogglable(true); sortButton->SetTogglable(true);
sortButton->SetActionCallback(new SortAction(this)); sortButton->SetActionCallback(new SortAction(this));
@ -69,7 +69,7 @@ SearchView::SearchView():
v->c->ShowOwn(sender->GetToggleState()); 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->SetIcon(IconMyOwn);
ownButton->SetTogglable(true); ownButton->SetTogglable(true);
ownButton->SetActionCallback(new MyOwnAction(this)); ownButton->SetActionCallback(new MyOwnAction(this));
@ -148,7 +148,7 @@ SearchView::SearchView():
AddComponent(searchField); AddComponent(searchField);
AddComponent(infoLabel); 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); AddComponent(loadingSpinner);
ui::Label * searchPrompt = new ui::Label(ui::Point(10, 10), ui::Point(50, 16), "Search:"); 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->Visible = false;
removeSelected->SetActionCallback(new RemoveSelectedAction(this)); removeSelected->SetActionCallback(new RemoveSelectedAction(this));
AddComponent(removeSelected); 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->Visible = false;
unpublishSelected->SetActionCallback(new UnpublishSelectedAction(this)); unpublishSelected->SetActionCallback(new UnpublishSelectedAction(this));
AddComponent(unpublishSelected); 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->Visible = false;
favouriteSelected->SetActionCallback(new FavouriteSelectedAction(this)); favouriteSelected->SetActionCallback(new FavouriteSelectedAction(this));
AddComponent(favouriteSelected); 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->Visible = false;
clearSelection->SetActionCallback(new ClearSelectionAction(this)); clearSelection->SetActionCallback(new ClearSelectionAction(this));
AddComponent(clearSelection); AddComponent(clearSelection);
@ -558,7 +558,7 @@ void SearchView::NotifySaveListChanged(SearchModel * sender)
loadingSpinner->Visible = false; loadingSpinner->Visible = false;
if(!errorLabel) 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); AddComponent(errorLabel);
} }
if(!sender->GetSavesLoaded()) if(!sender->GetSavesLoaded())

View File

@ -24,7 +24,7 @@ JNIEXPORT void JNICALL Java_PowderToy_initialise(JNIEnv * env, jobject canvas)
ui::Engine::Ref().g = new Graphics(); ui::Engine::Ref().g = new Graphics();
engine = &ui::Engine::Ref(); engine = &ui::Engine::Ref();
engine->Begin(XRES+BARSIZE, YRES+MENUSIZE); engine->Begin(WINDOWW, WINDOWH);
gameController = new GameController(); gameController = new GameController();
engine->ShowWindow(gameController->GetView()); 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) 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) 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) JNIEXPORT void JNICALL Java_PowderToy_mousePressed(JNIEnv * env, jobject canvas, jint mouseX, jint mouseY, jint mouseButton)

View File

@ -137,7 +137,7 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
{ {
memcpy(dst, src, (width*CELL)*PIXELSIZE); memcpy(dst, src, (width*CELL)*PIXELSIZE);
dst+=(width*CELL);///PIXELSIZE; dst+=(width*CELL);///PIXELSIZE;
src+=XRES+BARSIZE; src+=WINDOWW;
} }
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL); tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
if(pData) if(pData)

View File

@ -1900,7 +1900,7 @@ void Simulation::clear_sim(void)
fighcount = 0; fighcount = 0;
player.spwn = 0; player.spwn = 0;
player2.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_r, 0, sizeof(fire_r));
//memset(fire_g, 0, sizeof(fire_g)); //memset(fire_g, 0, sizeof(fire_g));
//memset(fire_b, 0, sizeof(fire_b)); //memset(fire_b, 0, sizeof(fire_b));