mirror of
https://github.com/glest/glest-source.git
synced 2025-08-13 11:54:00 +02:00
Updates related to win32 camera zoom compile fixes
This commit is contained in:
@@ -59,7 +59,8 @@ class Chrono{
|
||||
private:
|
||||
int64 startCount;
|
||||
int64 accumCount;
|
||||
int64 freq;
|
||||
static int64 freq;
|
||||
|
||||
bool stopped;
|
||||
|
||||
public:
|
||||
|
@@ -8,18 +8,20 @@
|
||||
// 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 <cassert>
|
||||
|
||||
#include "types.h"
|
||||
#include "vec.h"
|
||||
#include "platform_menu.h"
|
||||
|
||||
using std::map;
|
||||
using std::string;
|
||||
using Shared::Graphics::Vec2i;
|
||||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
@@ -27,9 +29,16 @@ class Timer;
|
||||
class PlatformContextGl;
|
||||
|
||||
enum MouseButton{
|
||||
mbLeft,
|
||||
mbRight,
|
||||
mbCenter
|
||||
mbUnknown,
|
||||
mbLeft,
|
||||
mbCenter,
|
||||
mbRight,
|
||||
mbWheelUp,
|
||||
mbWheelDown,
|
||||
mbButtonX1,
|
||||
mbButtonX2,
|
||||
|
||||
mbCount
|
||||
};
|
||||
|
||||
enum SizeState{
|
||||
@@ -53,11 +62,29 @@ const int vkBack= VK_BACK;
|
||||
const int vkDelete= VK_DELETE;
|
||||
const int vkF1= VK_F1;
|
||||
|
||||
struct MouseState{
|
||||
bool leftMouse;
|
||||
bool rightMouse;
|
||||
bool centerMouse;
|
||||
};
|
||||
class MouseState {
|
||||
private:
|
||||
bool states[mbCount];
|
||||
|
||||
|
||||
public:
|
||||
MouseState() {
|
||||
clear();
|
||||
}
|
||||
//MouseState(const MouseState &);
|
||||
//MouseState &operator=(const MouseState &);
|
||||
void clear() { memset(this, 0, sizeof(MouseState)); }
|
||||
|
||||
bool get(MouseButton b) const {
|
||||
assert(b > 0 && b < mbCount);
|
||||
return states[b];
|
||||
}
|
||||
|
||||
void set(MouseButton b, bool state) {
|
||||
assert(b > 0 && b < mbCount);
|
||||
states[b] = state;
|
||||
}
|
||||
};
|
||||
|
||||
enum WindowStyle{
|
||||
wsFullscreen,
|
||||
@@ -81,6 +108,19 @@ private:
|
||||
static int nextClassName;
|
||||
static WindowMap createdWindows;
|
||||
|
||||
static unsigned int lastMouseEvent; /** for use in mouse hover calculations */
|
||||
static MouseState mouseState;
|
||||
static Vec2i mousePos;
|
||||
|
||||
static void setLastMouseEvent(unsigned int lastMouseEvent) {Window::lastMouseEvent = lastMouseEvent;}
|
||||
static unsigned int getLastMouseEvent() {return Window::lastMouseEvent;}
|
||||
|
||||
static const MouseState &getMouseState() {return Window::mouseState;}
|
||||
static void setMouseState(MouseButton b, bool state) {Window::mouseState.set(b, state);}
|
||||
|
||||
static const Vec2i &getMousePos() {return Window::mousePos;}
|
||||
static void setMousePos(const Vec2i &mousePos) {Window::mousePos = mousePos;}
|
||||
|
||||
protected:
|
||||
WindowHandle handle;
|
||||
WindowStyle windowStyle;
|
||||
@@ -152,6 +192,23 @@ private:
|
||||
static int getNextClassName();
|
||||
void registerWindow(WNDPROC wndProc= NULL);
|
||||
void createWindow(LPVOID creationData= NULL);
|
||||
void mouseyVent(int asdf, MouseButton mouseButton) {
|
||||
const Vec2i &mousePos = getMousePos();
|
||||
switch(asdf) {
|
||||
case 0:
|
||||
setMouseState(mouseButton, true);
|
||||
eventMouseDown(mousePos.x, mousePos.y, mouseButton);
|
||||
break;
|
||||
case 1:
|
||||
setMouseState(mouseButton, false);
|
||||
eventMouseUp(mousePos.x, mousePos.y, mouseButton);
|
||||
break;
|
||||
case 2:
|
||||
eventMouseDoubleClick(mousePos.x, mousePos.y, mouseButton);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
|
Reference in New Issue
Block a user