mirror of
https://github.com/glest/glest-source.git
synced 2025-08-10 10:24:01 +02:00
initial version ( megaglest 3.2.3-beta3 )
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_FACTORYREPOSITORY_H_
|
||||
#define _SHARED_PLATFORM_FACTORYREPOSITORY_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "graphics_factory.h"
|
||||
#include "sound_factory.h"
|
||||
|
||||
#include "graphics_factory_gl.h"
|
||||
#include "graphics_factory_gl2.h"
|
||||
#include "sound_factory_ds8.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
using Shared::Graphics::GraphicsFactory;
|
||||
using Shared::Sound::SoundFactory;
|
||||
using Shared::Graphics::Gl::GraphicsFactoryGl;
|
||||
using Shared::Graphics::Gl::GraphicsFactoryGl2;
|
||||
using Shared::Sound::Ds8::SoundFactoryDs8;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class FactoryRepository
|
||||
// =====================================================
|
||||
|
||||
class FactoryRepository{
|
||||
private:
|
||||
FactoryRepository(){};
|
||||
FactoryRepository(FactoryRepository &);
|
||||
void operator=(FactoryRepository &);
|
||||
|
||||
private:
|
||||
GraphicsFactoryGl graphicsFactoryGl;
|
||||
GraphicsFactoryGl2 graphicsFactoryGl2;
|
||||
SoundFactoryDs8 soundFactoryDs8;
|
||||
|
||||
public:
|
||||
static FactoryRepository &getInstance();
|
||||
|
||||
GraphicsFactory *getGraphicsFactory(const string &name);
|
||||
SoundFactory *getSoundFactory(const string &name);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
65
source/shared_lib/include/platform/win32/gl_wrap.h
Normal file
65
source/shared_lib/include/platform/win32/gl_wrap.h
Normal file
@@ -0,0 +1,65 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_GLWRAP_H_
|
||||
#define _SHARED_PLATFORM_GLWRAP_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <gl.h>
|
||||
#include <glu.h>
|
||||
#include <glprocs.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "font.h"
|
||||
#include "types.h"
|
||||
|
||||
|
||||
#define GLEST_GLPROC(X, Y) inline X( static a= wglGetProcAddress(a); return a;)
|
||||
|
||||
using std::string;
|
||||
|
||||
using Shared::Graphics::FontMetrics;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class PlatformContextGl
|
||||
// =====================================================
|
||||
|
||||
class PlatformContextGl{
|
||||
protected:
|
||||
DeviceContextHandle dch;
|
||||
GlContextHandle glch;
|
||||
|
||||
public:
|
||||
virtual void init(int colorBits, int depthBits, int stencilBits);
|
||||
virtual void end();
|
||||
|
||||
virtual void makeCurrent();
|
||||
virtual void swapBuffers();
|
||||
|
||||
DeviceContextHandle getHandle() const {return dch;}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// Global Fcs
|
||||
// =====================================================
|
||||
|
||||
void createGlFontBitmaps(uint32 &base, const string &type, int size, int width, int charCount, FontMetrics &metrics);
|
||||
void createGlFontOutlines(uint32 &base, const string &type, int width, float depth, int charCount, FontMetrics &metrics);
|
||||
const char *getPlatformExtensions(const PlatformContextGl *pcgl);
|
||||
PROC getGlProcAddress(const char *procName);
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
@@ -0,0 +1,23 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_DEFINITIONS_H_
|
||||
#define _SHARED_PLATFORM_DEFINITIONS_H_
|
||||
|
||||
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
19
source/shared_lib/include/platform/win32/platform_main.h
Normal file
19
source/shared_lib/include/platform/win32/platform_main.h
Normal file
@@ -0,0 +1,19 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_MAIN_H_
|
||||
#define _SHARED_PLATFORM_MAIN_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define MAIN_FUNCTION(X) int main(int argc, char *argv[]){return X(argc, argv);}
|
||||
|
||||
#endif
|
90
source/shared_lib/include/platform/win32/platform_menu.h
Normal file
90
source/shared_lib/include/platform/win32/platform_menu.h
Normal file
@@ -0,0 +1,90 @@
|
||||
#ifndef _SHARED_PLATFORM_POPUPMENU_H_
|
||||
#define _SHARED_PLATFORM_POPUPMENU_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
using std::vector;
|
||||
using std::string;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
class Menu;
|
||||
|
||||
// =====================================================
|
||||
// class MenuBase
|
||||
// =====================================================
|
||||
|
||||
class MenuBase{
|
||||
private:
|
||||
static int nextId;
|
||||
|
||||
protected:
|
||||
int id;
|
||||
string text;
|
||||
HMENU handle;
|
||||
|
||||
public:
|
||||
void init(const string &text="");
|
||||
virtual ~MenuBase(){};
|
||||
|
||||
virtual void create(Menu *parent)= 0;
|
||||
virtual void destroy(){};
|
||||
|
||||
int getId() const {return id;}
|
||||
const string &getText() const {return text;}
|
||||
HMENU getHandle() const {return handle;}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Menu
|
||||
// =====================================================
|
||||
|
||||
class Menu: public MenuBase{
|
||||
private:
|
||||
typedef vector<MenuBase*> MenuChildren;
|
||||
|
||||
private:
|
||||
MenuChildren children;
|
||||
|
||||
public:
|
||||
virtual void create(Menu *parent= NULL);
|
||||
virtual void destroy();
|
||||
|
||||
int getChildCount() const {return children.size();}
|
||||
MenuBase *getChild(int i) const {return children[i];}
|
||||
|
||||
void addChild(MenuBase *menu) {children.push_back(menu);}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class MenuItem
|
||||
// =====================================================
|
||||
|
||||
class MenuItem: public MenuBase{
|
||||
private:
|
||||
bool isChecked;
|
||||
Menu *parent;
|
||||
|
||||
public:
|
||||
virtual void create(Menu *parent);
|
||||
|
||||
void setChecked(bool checked);
|
||||
|
||||
Menu *getParent() const {return parent;}
|
||||
bool getChecked() const {return isChecked;}
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class MenuSeparator
|
||||
// =====================================================
|
||||
|
||||
class MenuSeparator: public MenuBase{
|
||||
public:
|
||||
virtual void create(Menu *parent);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
118
source/shared_lib/include/platform/win32/platform_util.h
Normal file
118
source/shared_lib/include/platform/win32/platform_util.h
Normal file
@@ -0,0 +1,118 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_PLATFORMUTIL_H_
|
||||
#define _SHARED_PLATFORM_PLATFORMUTIL_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using std::exception;
|
||||
|
||||
using Shared::Platform::int64;
|
||||
|
||||
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;
|
||||
int64 freq;
|
||||
bool stopped;
|
||||
|
||||
public:
|
||||
Chrono();
|
||||
void start();
|
||||
void stop();
|
||||
int64 getMicros() const;
|
||||
int64 getMillis() const;
|
||||
int64 getSeconds() const;
|
||||
|
||||
private:
|
||||
int64 queryCounter(int multiplier) const;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class PlatformExceptionHandler
|
||||
// =====================================================
|
||||
|
||||
LONG WINAPI UnhandledExceptionFilter2(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
|
||||
class PlatformExceptionHandler{
|
||||
private:
|
||||
static PlatformExceptionHandler *thisPointer;
|
||||
|
||||
private:
|
||||
static LONG WINAPI handler(LPEXCEPTION_POINTERS pointers);
|
||||
string dumpFileName;
|
||||
|
||||
public:
|
||||
void install(string dumpFileName);
|
||||
virtual void handle()=0;
|
||||
static string codeToStr(DWORD code);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// Misc
|
||||
// =====================================================
|
||||
|
||||
void findAll(const string &path, vector<string> &results, bool cutExtension=false);
|
||||
|
||||
bool changeVideoMode(int resH, int resW, int colorBits, int refreshFrequency);
|
||||
void restoreVideoMode();
|
||||
|
||||
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
|
||||
|
||||
#endif
|
99
source/shared_lib/include/platform/win32/socket.h
Normal file
99
source/shared_lib/include/platform/win32/socket.h
Normal file
@@ -0,0 +1,99 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_SOCKET_H_
|
||||
#define _SHARED_PLATFORM_SOCKET_H_
|
||||
|
||||
#include <string>
|
||||
#include <winsock.h>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class IP
|
||||
// =====================================================
|
||||
|
||||
class Ip{
|
||||
private:
|
||||
unsigned char bytes[4];
|
||||
|
||||
public:
|
||||
Ip();
|
||||
Ip(unsigned char byte0, unsigned char byte1, unsigned char byte2, unsigned char byte3);
|
||||
Ip(const string& ipString);
|
||||
|
||||
unsigned char getByte(int byteIndex) {return bytes[byteIndex];}
|
||||
string getString() const;
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Socket
|
||||
// =====================================================
|
||||
|
||||
class Socket{
|
||||
private:
|
||||
class SocketManager{
|
||||
public:
|
||||
SocketManager();
|
||||
~SocketManager();
|
||||
};
|
||||
|
||||
protected:
|
||||
static SocketManager socketManager;
|
||||
SOCKET sock;
|
||||
|
||||
public:
|
||||
Socket(SOCKET sock);
|
||||
Socket();
|
||||
~Socket();
|
||||
|
||||
int getDataToRead();
|
||||
int send(const void *data, int dataSize);
|
||||
int receive(void *data, int dataSize);
|
||||
int peek(void *data, int dataSize);
|
||||
|
||||
void setBlock(bool block);
|
||||
bool isReadable();
|
||||
bool isWritable();
|
||||
bool isConnected();
|
||||
|
||||
string getHostName() const;
|
||||
string getIp() const;
|
||||
|
||||
protected:
|
||||
static void throwException(const string &str);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class ClientSocket
|
||||
// =====================================================
|
||||
|
||||
class ClientSocket: public Socket{
|
||||
public:
|
||||
void connect(const Ip &ip, int port);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class ServerSocket
|
||||
// =====================================================
|
||||
|
||||
class ServerSocket: public Socket{
|
||||
public:
|
||||
void bind(int port);
|
||||
void listen(int connectionQueueSize= SOMAXCONN);
|
||||
Socket *accept();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
69
source/shared_lib/include/platform/win32/thread.h
Normal file
69
source/shared_lib/include/platform/win32/thread.h
Normal file
@@ -0,0 +1,69 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_THREAD_H_
|
||||
#define _SHARED_PLATFORM_THREAD_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
// =====================================================
|
||||
// class Thread
|
||||
// =====================================================
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
typedef LPTHREAD_START_ROUTINE ThreadFunction;
|
||||
typedef DWORD ThreadId;
|
||||
|
||||
class Thread{
|
||||
public:
|
||||
enum Priority{
|
||||
pIdle= THREAD_PRIORITY_IDLE,
|
||||
pLow= THREAD_PRIORITY_BELOW_NORMAL,
|
||||
pNormal= THREAD_PRIORITY_NORMAL,
|
||||
pHigh= THREAD_PRIORITY_ABOVE_NORMAL,
|
||||
pRealTime= THREAD_PRIORITY_TIME_CRITICAL
|
||||
};
|
||||
|
||||
private:
|
||||
HANDLE threadHandle;
|
||||
static const ThreadId threadIdBase= 1000;
|
||||
static ThreadId nextThreadId;
|
||||
|
||||
public:
|
||||
void start();
|
||||
virtual void execute()=0;
|
||||
void setPriority(Thread::Priority threadPriority);
|
||||
void suspend();
|
||||
void resume();
|
||||
|
||||
private:
|
||||
static DWORD WINAPI beginExecution(void *param);
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Mutex
|
||||
// =====================================================
|
||||
|
||||
class Mutex{
|
||||
private:
|
||||
CRITICAL_SECTION mutex;
|
||||
|
||||
public:
|
||||
Mutex();
|
||||
~Mutex();
|
||||
void p();
|
||||
void v();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
35
source/shared_lib/include/platform/win32/types.h
Normal file
35
source/shared_lib/include/platform/win32/types.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_TYPES_H_
|
||||
#define _SHARED_PLATFORM_TYPES_H_
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
typedef HWND WindowHandle;
|
||||
typedef HDC DeviceContextHandle;
|
||||
typedef HGLRC GlContextHandle;
|
||||
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
typedef char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int int16;
|
||||
typedef unsigned short int uint16;
|
||||
typedef int int32;
|
||||
typedef unsigned int uint32;
|
||||
typedef long long int64;
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
158
source/shared_lib/include/platform/win32/window.h
Normal file
158
source/shared_lib/include/platform/win32/window.h
Normal file
@@ -0,0 +1,158 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_WINDOW_H_
|
||||
#define _SHARED_PLATFORM_WINDOW_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "types.h"
|
||||
#include "platform_menu.h"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
class Timer;
|
||||
class PlatformContextGl;
|
||||
|
||||
enum MouseButton{
|
||||
mbLeft,
|
||||
mbRight,
|
||||
mbCenter
|
||||
};
|
||||
|
||||
enum SizeState{
|
||||
ssMaximized,
|
||||
ssMinimized,
|
||||
ssRestored
|
||||
};
|
||||
|
||||
const int vkAdd= VK_ADD;
|
||||
const int vkSubtract= VK_SUBTRACT;
|
||||
const int vkAlt= VK_MENU;
|
||||
const int vkControl= VK_CONTROL;
|
||||
const int vkShift= VK_SHIFT;
|
||||
const int vkEscape= VK_ESCAPE;
|
||||
const int vkUp= VK_UP;
|
||||
const int vkLeft= VK_LEFT;
|
||||
const int vkRight= VK_RIGHT;
|
||||
const int vkDown= VK_DOWN;
|
||||
const int vkReturn= VK_RETURN;
|
||||
const int vkBack= VK_BACK;
|
||||
const int vkDelete= VK_DELETE;
|
||||
const int vkF1= VK_F1;
|
||||
|
||||
struct MouseState{
|
||||
bool leftMouse;
|
||||
bool rightMouse;
|
||||
bool centerMouse;
|
||||
};
|
||||
|
||||
enum WindowStyle{
|
||||
wsFullscreen,
|
||||
wsWindowedFixed,
|
||||
wsWindowedResizeable
|
||||
};
|
||||
|
||||
// =====================================================
|
||||
// class Window
|
||||
// =====================================================
|
||||
|
||||
class Window{
|
||||
private:
|
||||
typedef map<WindowHandle, Window*> WindowMap;
|
||||
|
||||
private:
|
||||
static const DWORD fullscreenStyle;
|
||||
static const DWORD windowedFixedStyle;
|
||||
static const DWORD windowedResizeableStyle;
|
||||
|
||||
static int nextClassName;
|
||||
static WindowMap createdWindows;
|
||||
|
||||
protected:
|
||||
WindowHandle handle;
|
||||
WindowStyle windowStyle;
|
||||
string text;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
string className;
|
||||
DWORD style;
|
||||
DWORD exStyle;
|
||||
bool ownDc;
|
||||
|
||||
public:
|
||||
static bool handleEvent();
|
||||
|
||||
//contructor & destructor
|
||||
Window();
|
||||
virtual ~Window();
|
||||
|
||||
WindowHandle getHandle() {return handle;}
|
||||
string getText();
|
||||
int getX() {return x;}
|
||||
int getY() {return y;}
|
||||
int getW() {return w;}
|
||||
int getH() {return h;}
|
||||
|
||||
//component state
|
||||
int getClientW();
|
||||
int getClientH();
|
||||
float getAspect();
|
||||
|
||||
//object state
|
||||
void setText(string text);
|
||||
void setStyle(WindowStyle windowStyle);
|
||||
void setSize(int w, int h);
|
||||
void setPos(int x, int y);
|
||||
void setEnabled(bool enabled);
|
||||
void setVisible(bool visible);
|
||||
|
||||
//misc
|
||||
void create();
|
||||
void minimize();
|
||||
void maximize();
|
||||
void restore();
|
||||
void showPopupMenu(Menu *menu, int x, int y);
|
||||
void destroy();
|
||||
|
||||
protected:
|
||||
virtual void eventCreate(){}
|
||||
virtual void eventMouseDown(int x, int y, MouseButton mouseButton){}
|
||||
virtual void eventMouseUp(int x, int y, MouseButton mouseButton){}
|
||||
virtual void eventMouseMove(int x, int y, const MouseState *mouseState){}
|
||||
virtual void eventMouseDoubleClick(int x, int y, MouseButton mouseButton){}
|
||||
virtual void eventKeyDown(char key){}
|
||||
virtual void eventKeyUp(char key){}
|
||||
virtual void eventKeyPress(char c){};
|
||||
virtual void eventResize(){};
|
||||
virtual void eventPaint(){}
|
||||
virtual void eventActivate(bool activated){};
|
||||
virtual void eventResize(SizeState sizeState){};
|
||||
virtual void eventMenu(int menuId){}
|
||||
virtual void eventClose(){};
|
||||
virtual void eventDestroy(){};
|
||||
|
||||
private:
|
||||
static LRESULT CALLBACK eventRouter(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
static int getNextClassName();
|
||||
void registerWindow(WNDPROC wndProc= NULL);
|
||||
void createWindow(LPVOID creationData= NULL);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
38
source/shared_lib/include/platform/win32/window_gl.h
Normal file
38
source/shared_lib/include/platform/win32/window_gl.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
//
|
||||
// You can redistribute this code and/or modify it under
|
||||
// the terms of the GNU General Public License as published
|
||||
// by the Free Software Foundation; either version 2 of the
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _SHARED_PLATFORM_WINDOWGL_H_
|
||||
#define _SHARED_PLATFORM_WINDOWGL_H_
|
||||
|
||||
#include "context_gl.h"
|
||||
#include "window.h"
|
||||
|
||||
using Shared::Graphics::Gl::ContextGl;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
// =====================================================
|
||||
// class WindowGl
|
||||
// =====================================================
|
||||
|
||||
class WindowGl: public Window{
|
||||
protected:
|
||||
ContextGl context;
|
||||
|
||||
public:
|
||||
void initGl(int colorBits, int depthBits, int stencilBits);
|
||||
void makeCurrentGl();
|
||||
void swapBuffersGl();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user