mirror of
https://github.com/glest/glest-source.git
synced 2025-08-21 15:41:24 +02:00
no more trouble with middle mouse button camera view
This commit is contained in:
@@ -3385,7 +3385,12 @@ void Game::mouseMove(int x, int y, const MouseState *ms) {
|
|||||||
float ymult = 0.2f;
|
float ymult = 0.2f;
|
||||||
float xmult = 0.2f;
|
float xmult = 0.2f;
|
||||||
|
|
||||||
gameCamera.transitionVH(-(y - lastMousePos.y) * ymult, (lastMousePos.x - x) * xmult);
|
Vec2i oldPos=Shared::Platform::Window::getOldMousePos();
|
||||||
|
int oldx= (oldPos.x * metrics.getVirtualW() / metrics.getScreenW());
|
||||||
|
int oldy= ((metrics.getScreenH()-oldPos.y) * metrics.getVirtualH() / metrics.getScreenH());
|
||||||
|
lastMousePos.x=oldx;
|
||||||
|
lastMousePos.y=oldy;
|
||||||
|
gameCamera.transitionVH(-(y - oldy) * ymult, (oldx - x) * xmult);
|
||||||
}
|
}
|
||||||
mouseX=lastMousePos.x;
|
mouseX=lastMousePos.x;
|
||||||
mouseY=lastMousePos.y;
|
mouseY=lastMousePos.y;
|
||||||
|
@@ -132,6 +132,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
static bool handleEvent();
|
static bool handleEvent();
|
||||||
static void revertMousePos();
|
static void revertMousePos();
|
||||||
|
static Vec2i getOldMousePos();
|
||||||
static bool isKeyDown() { return isKeyPressedDown; }
|
static bool isKeyDown() { return isKeyPressedDown; }
|
||||||
static void setupGraphicsScreen(int depthBits=-1, int stencilBits=-1, bool hardware_acceleration=false, bool fullscreen_anti_aliasing=false);
|
static void setupGraphicsScreen(int depthBits=-1, int stencilBits=-1, bool hardware_acceleration=false, bool fullscreen_anti_aliasing=false);
|
||||||
static const bool getIsFullScreen() { return isFullScreen; }
|
static const bool getIsFullScreen() { return isFullScreen; }
|
||||||
|
@@ -359,6 +359,10 @@ void Window::revertMousePos() {
|
|||||||
SDL_WarpMouse(oldX, oldY);
|
SDL_WarpMouse(oldX, oldY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vec2i Window::getOldMousePos() {
|
||||||
|
return Vec2i(oldX, oldY);
|
||||||
|
}
|
||||||
|
|
||||||
string Window::getText() {
|
string Window::getText() {
|
||||||
char* c = 0;
|
char* c = 0;
|
||||||
SDL_WM_GetCaption(&c, 0);
|
SDL_WM_GetCaption(&c, 0);
|
||||||
|
Reference in New Issue
Block a user