Remove stuff from Config.h that doesn't belong
This commit is contained in:
parent
6cfaed0e1b
commit
87f3ada7b0
19
src/Config.h
19
src/Config.h
@ -163,10 +163,6 @@
|
||||
#define GLASS_IOR 1.9
|
||||
#define GLASS_DISP 0.07
|
||||
|
||||
//some compatibility stuff for non-standard compilers
|
||||
#if defined(WIN) && !defined(strcasecmp)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER < 1800
|
||||
#define fmin min
|
||||
@ -178,21 +174,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define TPT_INLINE _inline
|
||||
#else
|
||||
#define TPT_INLINE inline
|
||||
#endif
|
||||
|
||||
// old Platform.h stuff, maybe we should have a file for these kinds of things
|
||||
typedef unsigned short Uint16;
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
|
||||
#define SDEUT
|
||||
//#define REALHEAT
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <ctime>
|
||||
#include <climits>
|
||||
#ifdef WIN
|
||||
#define _WIN32_WINNT 0x0501 //Necessary for some macros and functions, tells windows.h to include functions only available in Windows XP or later
|
||||
#include <direct.h>
|
||||
@ -34,7 +35,7 @@
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
extern "C" {
|
||||
char * readClipboard();
|
||||
void writeClipboard(const char * clipboardData);
|
||||
void writeClipboard(const char * clipboardData);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -779,7 +780,7 @@ void EngineProcess()
|
||||
|
||||
engine->Tick();
|
||||
engine->Draw();
|
||||
|
||||
|
||||
if(scale != engine->Scale || fullscreen != engine->Fullscreen)
|
||||
{
|
||||
sdl_scrn = SDLSetScreen(engine->Scale, engine->Fullscreen);
|
||||
@ -844,7 +845,7 @@ bool LoadWindowPosition(int scale)
|
||||
|
||||
int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
|
||||
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
|
||||
|
||||
|
||||
// Center the window on the primary desktop by default
|
||||
int newWindowX = (desktopWidth - windowW) / 2;
|
||||
int newWindowY = (desktopHeight - windowH) / 2;
|
||||
@ -878,7 +879,7 @@ bool LoadWindowPosition(int scale)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SetWindowPos(sysInfo.window, 0, newWindowX, newWindowY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
||||
|
||||
// True if we didn't use the default, i.e. the position was valid
|
||||
@ -921,7 +922,7 @@ void BlueScreen(const char * detailMessage){
|
||||
int currentY = 0, width, height;
|
||||
int errorWidth = 0;
|
||||
Graphics::textsize(errorHelp.c_str(), errorWidth, height);
|
||||
|
||||
|
||||
engine->g->drawtext((engine->GetWidth()/2)-(errorWidth/2), ((engine->GetHeight()/2)-100) + currentY, errorTitle.c_str(), 255, 255, 255, 255);
|
||||
Graphics::textsize(errorTitle.c_str(), width, height);
|
||||
currentY += height + 4;
|
||||
@ -933,9 +934,9 @@ void BlueScreen(const char * detailMessage){
|
||||
engine->g->drawtext((engine->GetWidth()/2)-(errorWidth/2), ((engine->GetHeight()/2)-100) + currentY, errorHelp.c_str(), 255, 255, 255, 255);
|
||||
Graphics::textsize(errorTitle.c_str(), width, height);
|
||||
currentY += height + 4;
|
||||
|
||||
|
||||
//Death loop
|
||||
SDL_Event event;
|
||||
SDL_Event event;
|
||||
while(true)
|
||||
{
|
||||
while (SDL_PollEvent(&event))
|
||||
@ -975,7 +976,7 @@ int main(int argc, char * argv[])
|
||||
#if defined(_DEBUG) && defined(_MSC_VER)
|
||||
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
|
||||
#endif
|
||||
currentWidth = WINDOWW;
|
||||
currentWidth = WINDOWW;
|
||||
currentHeight = WINDOWH;
|
||||
|
||||
|
||||
@ -1013,7 +1014,7 @@ int main(int argc, char * argv[])
|
||||
if(arguments["proxy"] == "false")
|
||||
{
|
||||
proxyString = "";
|
||||
Client::Ref().SetPref("Proxy", "");
|
||||
Client::Ref().SetPref("Proxy", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1065,7 +1066,7 @@ int main(int argc, char * argv[])
|
||||
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
|
||||
XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1);
|
||||
sdl_wminfo.info.x11.unlock_func();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "X11 setup failed, X11 window info not found");
|
||||
@ -1203,7 +1204,7 @@ int main(int argc, char * argv[])
|
||||
SDL_GetMouseState(&sdl_x, &sdl_y);
|
||||
engine->onMouseMove(sdl_x*inputScale, sdl_y*inputScale);
|
||||
EngineProcess();
|
||||
|
||||
|
||||
#ifdef WIN
|
||||
SaveWindowPosition();
|
||||
#endif
|
||||
@ -1215,7 +1216,7 @@ int main(int argc, char * argv[])
|
||||
BlueScreen(e.what());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Client::Ref().SetPref("Scale", ui::Engine::Ref().GetScale());
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete gameController;
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <cstdarg>
|
||||
#include "Config.h"
|
||||
#include <climits>
|
||||
#include "common/tpt-inline.h"
|
||||
|
||||
#if defined(LIN) || defined(USE_STDINT)
|
||||
#include <sys/types.h>
|
||||
@ -647,13 +648,13 @@ int bson_init_data( bson *b , char *data );
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a BSON object, point its data pointer
|
||||
* Initialize a BSON object, point its data pointer
|
||||
* to the provided char*, and initialize the size
|
||||
*
|
||||
* @param b the BSON object to initialize.
|
||||
* @param data the raw BSON data.
|
||||
* @param size the size of the BSON data.
|
||||
*
|
||||
*
|
||||
* @return BSON_OK or BSON_ERROR.
|
||||
*/
|
||||
int bson_init_data_size( bson *b , char *data , int size );
|
||||
|
30
src/common/tpt-compat.h
Normal file
30
src/common/tpt-compat.h
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TPT_COMPAT_H
|
||||
#define TPT_COMPAT_H
|
||||
|
||||
//some compatibility stuff for non-standard compilers
|
||||
#if defined(WIN) && !defined(strcasecmp)
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
typedef unsigned short Uint16;
|
||||
|
||||
#ifndef NULL
|
||||
# define NULL 0
|
||||
#endif
|
||||
|
||||
#endif
|
25
src/common/tpt-inline.h
Normal file
25
src/common/tpt-inline.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TPT_INLINE_H
|
||||
#define TPT_INLINE_H
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define TPT_INLINE _inline
|
||||
#else
|
||||
#define TPT_INLINE inline
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "gui/interface/Point.h"
|
||||
#include "Config.h"
|
||||
#include "common/tpt-compat.h"
|
||||
|
||||
class DebugInfo
|
||||
{
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "OpenGLHeaders.h"
|
||||
#endif
|
||||
#include "Config.h"
|
||||
#include "common/tpt-inline.h"
|
||||
#include "Pixel.h"
|
||||
#include "Icons.h"
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "Config.h"
|
||||
#include "common/tpt-compat.h"
|
||||
#include "Appearance.h"
|
||||
#include "Point.h"
|
||||
|
||||
@ -11,14 +11,14 @@ namespace ui
|
||||
class ContextMenu;
|
||||
class Window;
|
||||
class Panel;
|
||||
|
||||
|
||||
/* class Component
|
||||
*
|
||||
*
|
||||
* An interactive UI component that can be added to a state or an XComponent*.
|
||||
* *See sys::XComponent
|
||||
*/
|
||||
class Component
|
||||
{
|
||||
class Component
|
||||
{
|
||||
private:
|
||||
Window* parentstate_;
|
||||
Panel* _parent;
|
||||
@ -34,7 +34,7 @@ namespace ui
|
||||
Component(Point position, Point size);
|
||||
Component();
|
||||
virtual ~Component();
|
||||
|
||||
|
||||
void* UserData;
|
||||
inline Window* const GetParentWindow() const { return parentstate_; }
|
||||
bool IsFocused() const;
|
||||
@ -50,11 +50,11 @@ namespace ui
|
||||
//virtual void SetAppearance(ui::Appearance);
|
||||
//ui::Appearance GetAppearance();
|
||||
virtual void TextPosition(std::string);
|
||||
|
||||
|
||||
void Refresh();
|
||||
|
||||
Point GetScreenPos();
|
||||
|
||||
|
||||
/* See the parent of this component.
|
||||
* If new_parent is NULL, this component will have no parent. (THIS DOES NOT delete THE COMPONENT. See XComponent::RemoveChild)
|
||||
*/
|
||||
@ -65,12 +65,12 @@ namespace ui
|
||||
inline Panel* const GetParent() const { return _parent; }
|
||||
|
||||
virtual void OnContextMenuAction(int item);
|
||||
|
||||
|
||||
//UI functions:
|
||||
/*
|
||||
void Tick(float dt);
|
||||
void Draw(const Point& screenPos);
|
||||
|
||||
|
||||
void OnMouseHover(int localx, int localy);
|
||||
void OnMouseMoved(int localx, int localy, int dx, int dy);
|
||||
void OnMouseMovedInside(int localx, int localy, int dx, int dy);
|
||||
@ -92,17 +92,17 @@ namespace ui
|
||||
// dt: The change in time.
|
||||
///
|
||||
virtual void Tick(float dt);
|
||||
|
||||
|
||||
///
|
||||
// Called: When ready to draw.
|
||||
// Params:
|
||||
// None
|
||||
///
|
||||
virtual void Draw(const Point& screenPos);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse is currently hovering over the item. (Called every tick)
|
||||
// Params:
|
||||
@ -110,7 +110,7 @@ namespace ui
|
||||
// localy: Local mouse Y position.
|
||||
///
|
||||
virtual void OnMouseHover(int localx, int localy);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse moves.
|
||||
// Params:
|
||||
@ -120,7 +120,7 @@ namespace ui
|
||||
// dy: Mouse Y delta.
|
||||
///
|
||||
virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse moves.
|
||||
// Params:
|
||||
@ -130,7 +130,7 @@ namespace ui
|
||||
// dy: Mouse Y delta.
|
||||
///
|
||||
virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse moves on top of the item.
|
||||
// Params:
|
||||
@ -140,7 +140,7 @@ namespace ui
|
||||
// dy: Mouse Y delta.
|
||||
///
|
||||
virtual void OnMouseEnter(int localx, int localy);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse leaves the item.
|
||||
// Params:
|
||||
@ -148,7 +148,7 @@ namespace ui
|
||||
// localy: Local mouse Y position.
|
||||
///
|
||||
virtual void OnMouseLeave(int localx, int localy);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a mouse button is pressed.
|
||||
// Params:
|
||||
@ -157,7 +157,7 @@ namespace ui
|
||||
// button: The button that is being held down.
|
||||
///
|
||||
virtual void OnMouseDown(int x, int y, unsigned button);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a mouse button is released.
|
||||
// Params:
|
||||
@ -166,7 +166,7 @@ namespace ui
|
||||
// button: The button that is being released.
|
||||
///
|
||||
virtual void OnMouseUp(int x, int y, unsigned button);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a mouse button is pressed on top of the item.
|
||||
// Params:
|
||||
@ -175,7 +175,7 @@ namespace ui
|
||||
// button: The button that is being held down.
|
||||
///
|
||||
virtual void OnMouseClick(int localx, int localy, unsigned button);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a mouse button is released on top of the item.
|
||||
// Params:
|
||||
@ -184,7 +184,7 @@ namespace ui
|
||||
// button: The button that is being released.
|
||||
///
|
||||
virtual void OnMouseUnclick(int localx, int localy, unsigned button);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse wheel moves/changes.
|
||||
// Params:
|
||||
@ -193,7 +193,7 @@ namespace ui
|
||||
// d: The mouse wheel movement value.
|
||||
///
|
||||
virtual void OnMouseWheel(int localx, int localy, int d);
|
||||
|
||||
|
||||
///
|
||||
// Called: When the mouse wheel moves/changes on top of the item.
|
||||
// Params:
|
||||
@ -202,7 +202,7 @@ namespace ui
|
||||
// d: The mouse wheel movement value.
|
||||
///
|
||||
virtual void OnMouseWheelInside(int localx, int localy, int d);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a key is pressed.
|
||||
// Params:
|
||||
@ -212,7 +212,7 @@ namespace ui
|
||||
// alt: Alternate key is down.
|
||||
///
|
||||
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
|
||||
|
||||
|
||||
///
|
||||
// Called: When a key is released.
|
||||
// Params:
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Config.h"
|
||||
#include "common/tpt-compat.h"
|
||||
#include "gui/interface/Point.h"
|
||||
|
||||
class Graphics;
|
||||
@ -83,7 +83,7 @@ namespace ui
|
||||
void MakeActiveWindow();
|
||||
bool CloseActiveWindow();
|
||||
Graphics * GetGraphics();
|
||||
|
||||
|
||||
protected:
|
||||
ui::Button * okayButton;
|
||||
ui::Button * cancelButton;
|
||||
@ -95,7 +95,7 @@ namespace ui
|
||||
virtual void OnFocus() {}
|
||||
virtual void OnBlur() {}
|
||||
|
||||
virtual void OnTryExit(ExitMethod);
|
||||
virtual void OnTryExit(ExitMethod);
|
||||
virtual void OnTryOkay(OkayMethod);
|
||||
|
||||
virtual void OnMouseMove(int x, int y, int dx, int dy) {}
|
||||
|
Loading…
Reference in New Issue
Block a user