mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 04:43:58 +02:00
better mouse camera navigation ( missing win32 implementation )
This commit is contained in:
@@ -126,6 +126,8 @@ protected:
|
||||
|
||||
public:
|
||||
static bool handleEvent();
|
||||
static void revertMousePos();
|
||||
|
||||
|
||||
Window();
|
||||
virtual ~Window();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest Shared Library (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Marti<74>o Figueroa
|
||||
// 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
|
||||
@@ -136,6 +136,7 @@ protected:
|
||||
|
||||
public:
|
||||
static bool handleEvent();
|
||||
static void revertMousePos();
|
||||
|
||||
//contructor & destructor
|
||||
Window();
|
||||
|
@@ -32,6 +32,7 @@ namespace Shared{ namespace Platform{
|
||||
|
||||
// Matze: hack for now...
|
||||
static Window* global_window = 0;
|
||||
static int oldX=0,oldY=0;
|
||||
unsigned int Window::lastMouseEvent = 0; /** for use in mouse hover calculations */
|
||||
Vec2i Window::mousePos;
|
||||
MouseState Window::mouseState;
|
||||
@@ -57,6 +58,7 @@ Window::~Window() {
|
||||
|
||||
bool Window::handleEvent() {
|
||||
SDL_Event event;
|
||||
SDL_GetMouseState(&oldX,&oldY);
|
||||
while(SDL_PollEvent(&event)) {
|
||||
try {
|
||||
//printf("START [%d]\n",event.type);
|
||||
@@ -138,6 +140,10 @@ bool Window::handleEvent() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void Window::revertMousePos() {
|
||||
SDL_WarpMouse(oldX, oldY);
|
||||
}
|
||||
|
||||
string Window::getText() {
|
||||
char* c = 0;
|
||||
SDL_WM_GetCaption(&c, 0);
|
||||
|
Reference in New Issue
Block a user