mirror of
https://github.com/glest/glest-source.git
synced 2025-08-11 02:43:57 +02:00
moved common platform code into shared are for win32 projects
This commit is contained in:
@@ -108,14 +108,14 @@ private:
|
||||
int lastMouseX[3];
|
||||
int lastMouseY[3];
|
||||
|
||||
static unsigned int lastMouseEvent; /** for use in mouse hover calculations */
|
||||
static int64 lastMouseEvent; /** for use in mouse hover calculations */
|
||||
static MouseState mouseState;
|
||||
static Vec2i mousePos;
|
||||
static bool isKeyPressedDown;
|
||||
static bool isFullScreen;
|
||||
static SDL_keysym keystate;
|
||||
|
||||
static void setLastMouseEvent(unsigned int lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
|
||||
static void setLastMouseEvent(int64 lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
|
||||
static unsigned int getLastMouseEvent() {return Window::lastMouseEvent;}
|
||||
|
||||
static const MouseState &getMouseState() {return Window::mouseState;}
|
||||
|
@@ -13,87 +13,16 @@
|
||||
#define _SHARED_PLATFORM_PLATFORMUTIL_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include <list>
|
||||
|
||||
#include "types.h"
|
||||
#include "checksum.h"
|
||||
#include <utility>
|
||||
|
||||
#include "platform_common.h"
|
||||
|
||||
using namespace Shared::PlatformCommon;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::exception;
|
||||
using std::list;
|
||||
|
||||
using Shared::Platform::int64;
|
||||
using Shared::Util::Checksum;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class PerformanceTimer
|
||||
// =====================================================
|
||||
|
||||
class PerformanceTimer{
|
||||
private:
|
||||
int64 thisTicks;
|
||||
int64 lastTicks;
|
||||
int64 updateTicks;
|
||||
|
||||
int times; // number of consecutive times
|
||||
int maxTimes; // maximum number consecutive times
|
||||
|
||||
public:
|
||||
void init(int fps, int maxTimes= -1);
|
||||
|
||||
bool isTime();
|
||||
void reset();
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Chrono
|
||||
// =====================================================
|
||||
|
||||
class Chrono{
|
||||
private:
|
||||
int64 startCount;
|
||||
int64 accumCount;
|
||||
static int64 freq;
|
||||
|
||||
bool stopped;
|
||||
|
||||
public:
|
||||
Chrono();
|
||||
void start();
|
||||
void stop();
|
||||
int64 getMicros() const;
|
||||
int64 getMillis() const;
|
||||
int64 getSeconds() const;
|
||||
|
||||
static int64 getCurTicks();
|
||||
static int64 getCurMillis();
|
||||
|
||||
private:
|
||||
int64 queryCounter(int multiplier) const;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class ModeInfo
|
||||
// =====================================================
|
||||
class ModeInfo {
|
||||
public:
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
|
||||
ModeInfo(int width, int height, int depth);
|
||||
|
||||
string getString() const;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class PlatformExceptionHandler
|
||||
// =====================================================
|
||||
@@ -117,36 +46,9 @@ public:
|
||||
// =====================================================
|
||||
// Misc
|
||||
// =====================================================
|
||||
void Tokenize(const string& str,vector<string>& tokens,const string& delimiters = " ");
|
||||
bool isdir(const char *path);
|
||||
void findDirs(const vector<string> &paths, vector<string> &results, bool errorOnNotFound=false);
|
||||
void findAll(const vector<string> &paths, const string &fileFilter, vector<string> &results, bool cutExtension=false, bool errorOnNotFound=true);
|
||||
void findAll(const string &path, vector<string> &results, bool cutExtension=false, bool errorOnNotFound=true);
|
||||
int32 getFolderTreeContentsCheckSumRecursively(vector<string> paths, string pathSearchString, const string filterFileExt, Checksum *recursiveChecksum);
|
||||
int32 getFolderTreeContentsCheckSumRecursively(const string &path, const string &filterFileExt, Checksum *recursiveChecksum);
|
||||
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(vector<string> paths, string pathSearchString, const string filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
|
||||
vector<std::pair<string,int32> > getFolderTreeContentsCheckSumListRecursively(const string &path, const string &filterFileExt, vector<std::pair<string,int32> > *recursiveMap);
|
||||
void createDirectoryPaths(string Path);
|
||||
string extractDirectoryPathFromFile(string filename);
|
||||
string extractExtension(const string& filename);
|
||||
|
||||
void getFullscreenVideoInfo(int &colorBits,int &screenWidth,int &screenHeight);
|
||||
void getFullscreenVideoModes(list<ModeInfo> *modeinfos);
|
||||
bool changeVideoMode(int resH, int resW, int colorBits, int refreshFrequency);
|
||||
void restoreVideoMode(bool exitingApp=false);
|
||||
|
||||
bool EndsWith(const string &str, const string& key);
|
||||
void message(string message);
|
||||
bool ask(string message);
|
||||
void exceptionMessage(const exception &excp);
|
||||
|
||||
int getScreenW();
|
||||
int getScreenH();
|
||||
|
||||
void sleep(int millis);
|
||||
|
||||
void showCursor(bool b);
|
||||
bool isKeyDown(int virtualKey);
|
||||
string getCommandLine();
|
||||
|
||||
}}//end namespace
|
||||
|
Reference in New Issue
Block a user