Remove stuff from Config.h that doesn't belong

This commit is contained in:
wolfy1339
2017-11-15 20:07:00 -05:00
committed by jacob1
parent 6cfaed0e1b
commit 87f3ada7b0
9 changed files with 104 additions and 65 deletions

View File

@@ -163,10 +163,6 @@
#define GLASS_IOR 1.9 #define GLASS_IOR 1.9
#define GLASS_DISP 0.07 #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 defined(_MSC_VER)
#if _MSC_VER < 1800 #if _MSC_VER < 1800
#define fmin min #define fmin min
@@ -178,21 +174,6 @@
#endif #endif
#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 SDEUT
//#define REALHEAT //#define REALHEAT

View File

@@ -3,6 +3,7 @@
#include <map> #include <map>
#include <string> #include <string>
#include <ctime> #include <ctime>
#include <climits>
#ifdef WIN #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 #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> #include <direct.h>
@@ -34,7 +35,7 @@
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
extern "C" { extern "C" {
char * readClipboard(); char * readClipboard();
void writeClipboard(const char * clipboardData); void writeClipboard(const char * clipboardData);
} }
#endif #endif
@@ -779,7 +780,7 @@ void EngineProcess()
engine->Tick(); engine->Tick();
engine->Draw(); engine->Draw();
if(scale != engine->Scale || fullscreen != engine->Fullscreen) if(scale != engine->Scale || fullscreen != engine->Fullscreen)
{ {
sdl_scrn = SDLSetScreen(engine->Scale, 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 savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX); int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);
// Center the window on the primary desktop by default // Center the window on the primary desktop by default
int newWindowX = (desktopWidth - windowW) / 2; int newWindowX = (desktopWidth - windowW) / 2;
int newWindowY = (desktopHeight - windowH) / 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); 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 // 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 currentY = 0, width, height;
int errorWidth = 0; int errorWidth = 0;
Graphics::textsize(errorHelp.c_str(), errorWidth, height); 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); 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); Graphics::textsize(errorTitle.c_str(), width, height);
currentY += height + 4; 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); 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); Graphics::textsize(errorTitle.c_str(), width, height);
currentY += height + 4; currentY += height + 4;
//Death loop //Death loop
SDL_Event event; SDL_Event event;
while(true) while(true)
{ {
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
@@ -975,7 +976,7 @@ int main(int argc, char * argv[])
#if defined(_DEBUG) && defined(_MSC_VER) #if defined(_DEBUG) && defined(_MSC_VER)
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG); _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
#endif #endif
currentWidth = WINDOWW; currentWidth = WINDOWW;
currentHeight = WINDOWH; currentHeight = WINDOWH;
@@ -1013,7 +1014,7 @@ int main(int argc, char * argv[])
if(arguments["proxy"] == "false") if(arguments["proxy"] == "false")
{ {
proxyString = ""; proxyString = "";
Client::Ref().SetPref("Proxy", ""); Client::Ref().SetPref("Proxy", "");
} }
else else
{ {
@@ -1065,7 +1066,7 @@ int main(int argc, char * argv[])
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1); XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1); XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1);
sdl_wminfo.info.x11.unlock_func(); sdl_wminfo.info.x11.unlock_func();
} }
else else
{ {
fprintf(stderr, "X11 setup failed, X11 window info not found"); 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); SDL_GetMouseState(&sdl_x, &sdl_y);
engine->onMouseMove(sdl_x*inputScale, sdl_y*inputScale); engine->onMouseMove(sdl_x*inputScale, sdl_y*inputScale);
EngineProcess(); EngineProcess();
#ifdef WIN #ifdef WIN
SaveWindowPosition(); SaveWindowPosition();
#endif #endif
@@ -1215,7 +1216,7 @@ int main(int argc, char * argv[])
BlueScreen(e.what()); BlueScreen(e.what());
} }
#endif #endif
Client::Ref().SetPref("Scale", ui::Engine::Ref().GetScale()); Client::Ref().SetPref("Scale", ui::Engine::Ref().GetScale());
ui::Engine::Ref().CloseWindow(); ui::Engine::Ref().CloseWindow();
delete gameController; delete gameController;

View File

@@ -26,7 +26,8 @@
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <cstdarg> #include <cstdarg>
#include "Config.h" #include <climits>
#include "common/tpt-inline.h"
#if defined(LIN) || defined(USE_STDINT) #if defined(LIN) || defined(USE_STDINT)
#include <sys/types.h> #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 * to the provided char*, and initialize the size
* *
* @param b the BSON object to initialize. * @param b the BSON object to initialize.
* @param data the raw BSON data. * @param data the raw BSON data.
* @param size the size of the BSON data. * @param size the size of the BSON data.
* *
* @return BSON_OK or BSON_ERROR. * @return BSON_OK or BSON_ERROR.
*/ */
int bson_init_data_size( bson *b , char *data , int size ); int bson_init_data_size( bson *b , char *data , int size );

30
src/common/tpt-compat.h Normal file
View 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
View 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

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include "gui/interface/Point.h" #include "gui/interface/Point.h"
#include "Config.h" #include "common/tpt-compat.h"
class DebugInfo class DebugInfo
{ {

View File

@@ -9,6 +9,7 @@
#include "OpenGLHeaders.h" #include "OpenGLHeaders.h"
#endif #endif
#include "Config.h" #include "Config.h"
#include "common/tpt-inline.h"
#include "Pixel.h" #include "Pixel.h"
#include "Icons.h" #include "Icons.h"

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "Config.h" #include "common/tpt-compat.h"
#include "Appearance.h" #include "Appearance.h"
#include "Point.h" #include "Point.h"
@@ -11,14 +11,14 @@ namespace ui
class ContextMenu; class ContextMenu;
class Window; class Window;
class Panel; class Panel;
/* class Component /* class Component
* *
* An interactive UI component that can be added to a state or an XComponent*. * An interactive UI component that can be added to a state or an XComponent*.
* *See sys::XComponent * *See sys::XComponent
*/ */
class Component class Component
{ {
private: private:
Window* parentstate_; Window* parentstate_;
Panel* _parent; Panel* _parent;
@@ -34,7 +34,7 @@ namespace ui
Component(Point position, Point size); Component(Point position, Point size);
Component(); Component();
virtual ~Component(); virtual ~Component();
void* UserData; void* UserData;
inline Window* const GetParentWindow() const { return parentstate_; } inline Window* const GetParentWindow() const { return parentstate_; }
bool IsFocused() const; bool IsFocused() const;
@@ -50,11 +50,11 @@ namespace ui
//virtual void SetAppearance(ui::Appearance); //virtual void SetAppearance(ui::Appearance);
//ui::Appearance GetAppearance(); //ui::Appearance GetAppearance();
virtual void TextPosition(std::string); virtual void TextPosition(std::string);
void Refresh(); void Refresh();
Point GetScreenPos(); Point GetScreenPos();
/* See the parent of this component. /* 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) * 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; } inline Panel* const GetParent() const { return _parent; }
virtual void OnContextMenuAction(int item); virtual void OnContextMenuAction(int item);
//UI functions: //UI functions:
/* /*
void Tick(float dt); void Tick(float dt);
void Draw(const Point& screenPos); void Draw(const Point& screenPos);
void OnMouseHover(int localx, int localy); void OnMouseHover(int localx, int localy);
void OnMouseMoved(int localx, int localy, int dx, int dy); void OnMouseMoved(int localx, int localy, int dx, int dy);
void OnMouseMovedInside(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. // dt: The change in time.
/// ///
virtual void Tick(float dt); virtual void Tick(float dt);
/// ///
// Called: When ready to draw. // Called: When ready to draw.
// Params: // Params:
// None // None
/// ///
virtual void Draw(const Point& screenPos); virtual void Draw(const Point& screenPos);
/// ///
// Called: When the mouse is currently hovering over the item. (Called every tick) // Called: When the mouse is currently hovering over the item. (Called every tick)
// Params: // Params:
@@ -110,7 +110,7 @@ namespace ui
// localy: Local mouse Y position. // localy: Local mouse Y position.
/// ///
virtual void OnMouseHover(int localx, int localy); virtual void OnMouseHover(int localx, int localy);
/// ///
// Called: When the mouse moves. // Called: When the mouse moves.
// Params: // Params:
@@ -120,7 +120,7 @@ namespace ui
// dy: Mouse Y delta. // dy: Mouse Y delta.
/// ///
virtual void OnMouseMoved(int localx, int localy, int dx, int dy); virtual void OnMouseMoved(int localx, int localy, int dx, int dy);
/// ///
// Called: When the mouse moves. // Called: When the mouse moves.
// Params: // Params:
@@ -130,7 +130,7 @@ namespace ui
// dy: Mouse Y delta. // dy: Mouse Y delta.
/// ///
virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy); virtual void OnMouseMovedInside(int localx, int localy, int dx, int dy);
/// ///
// Called: When the mouse moves on top of the item. // Called: When the mouse moves on top of the item.
// Params: // Params:
@@ -140,7 +140,7 @@ namespace ui
// dy: Mouse Y delta. // dy: Mouse Y delta.
/// ///
virtual void OnMouseEnter(int localx, int localy); virtual void OnMouseEnter(int localx, int localy);
/// ///
// Called: When the mouse leaves the item. // Called: When the mouse leaves the item.
// Params: // Params:
@@ -148,7 +148,7 @@ namespace ui
// localy: Local mouse Y position. // localy: Local mouse Y position.
/// ///
virtual void OnMouseLeave(int localx, int localy); virtual void OnMouseLeave(int localx, int localy);
/// ///
// Called: When a mouse button is pressed. // Called: When a mouse button is pressed.
// Params: // Params:
@@ -157,7 +157,7 @@ namespace ui
// button: The button that is being held down. // button: The button that is being held down.
/// ///
virtual void OnMouseDown(int x, int y, unsigned button); virtual void OnMouseDown(int x, int y, unsigned button);
/// ///
// Called: When a mouse button is released. // Called: When a mouse button is released.
// Params: // Params:
@@ -166,7 +166,7 @@ namespace ui
// button: The button that is being released. // button: The button that is being released.
/// ///
virtual void OnMouseUp(int x, int y, unsigned button); virtual void OnMouseUp(int x, int y, unsigned button);
/// ///
// Called: When a mouse button is pressed on top of the item. // Called: When a mouse button is pressed on top of the item.
// Params: // Params:
@@ -175,7 +175,7 @@ namespace ui
// button: The button that is being held down. // button: The button that is being held down.
/// ///
virtual void OnMouseClick(int localx, int localy, unsigned button); virtual void OnMouseClick(int localx, int localy, unsigned button);
/// ///
// Called: When a mouse button is released on top of the item. // Called: When a mouse button is released on top of the item.
// Params: // Params:
@@ -184,7 +184,7 @@ namespace ui
// button: The button that is being released. // button: The button that is being released.
/// ///
virtual void OnMouseUnclick(int localx, int localy, unsigned button); virtual void OnMouseUnclick(int localx, int localy, unsigned button);
/// ///
// Called: When the mouse wheel moves/changes. // Called: When the mouse wheel moves/changes.
// Params: // Params:
@@ -193,7 +193,7 @@ namespace ui
// d: The mouse wheel movement value. // d: The mouse wheel movement value.
/// ///
virtual void OnMouseWheel(int localx, int localy, int d); virtual void OnMouseWheel(int localx, int localy, int d);
/// ///
// Called: When the mouse wheel moves/changes on top of the item. // Called: When the mouse wheel moves/changes on top of the item.
// Params: // Params:
@@ -202,7 +202,7 @@ namespace ui
// d: The mouse wheel movement value. // d: The mouse wheel movement value.
/// ///
virtual void OnMouseWheelInside(int localx, int localy, int d); virtual void OnMouseWheelInside(int localx, int localy, int d);
/// ///
// Called: When a key is pressed. // Called: When a key is pressed.
// Params: // Params:
@@ -212,7 +212,7 @@ namespace ui
// alt: Alternate key is down. // alt: Alternate key is down.
/// ///
virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt); virtual void OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt);
/// ///
// Called: When a key is released. // Called: When a key is released.
// Params: // Params:

View File

@@ -3,7 +3,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "Config.h" #include "common/tpt-compat.h"
#include "gui/interface/Point.h" #include "gui/interface/Point.h"
class Graphics; class Graphics;
@@ -83,7 +83,7 @@ namespace ui
void MakeActiveWindow(); void MakeActiveWindow();
bool CloseActiveWindow(); bool CloseActiveWindow();
Graphics * GetGraphics(); Graphics * GetGraphics();
protected: protected:
ui::Button * okayButton; ui::Button * okayButton;
ui::Button * cancelButton; ui::Button * cancelButton;
@@ -95,7 +95,7 @@ namespace ui
virtual void OnFocus() {} virtual void OnFocus() {}
virtual void OnBlur() {} virtual void OnBlur() {}
virtual void OnTryExit(ExitMethod); virtual void OnTryExit(ExitMethod);
virtual void OnTryOkay(OkayMethod); virtual void OnTryOkay(OkayMethod);
virtual void OnMouseMove(int x, int y, int dx, int dy) {} virtual void OnMouseMove(int x, int y, int dx, int dy) {}