fix mouse coords at startup being 0,0, fix glitch that could make background windows fade completely to black
This commit is contained in:
parent
94e635b65d
commit
b7fe998252
@ -987,11 +987,15 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
}
|
||||
|
||||
//initial mouse coords
|
||||
int sdl_x, sdl_y;
|
||||
SDL_GetMouseState(&sdl_x, &sdl_y);
|
||||
engine->onMouseMove(sdl_x*inputScale, sdl_y*inputScale);
|
||||
EngineProcess();
|
||||
|
||||
#ifdef WIN
|
||||
#ifdef WIN
|
||||
SaveWindowPosition();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(DEBUG) && !defined(_DEBUG)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <iostream>
|
||||
#include <stack>
|
||||
#include <cstdio>
|
||||
#include <cmath>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Misc.h"
|
||||
@ -76,7 +77,7 @@ void Engine::Exit()
|
||||
|
||||
void Engine::ShowWindow(Window * window)
|
||||
{
|
||||
windowOpenState = 0.0f;
|
||||
windowOpenState = 0;
|
||||
if(window->Position.X==-1)
|
||||
{
|
||||
window->Position.X = (width_-window->Size.X)/2;
|
||||
@ -182,22 +183,6 @@ void Engine::Tick()
|
||||
|
||||
|
||||
lastTick = gettime();
|
||||
if(windowOpenState<1.0f)
|
||||
{
|
||||
if(lastBuffer)
|
||||
{
|
||||
pixel * vid = g->vid;
|
||||
g->vid = lastBuffer;
|
||||
g->fillrect(0, 0, width_, height_, 0, 0, 0, 5);
|
||||
g->vid = vid;
|
||||
|
||||
}
|
||||
/*if(windowTargetPosition.Y < state_->Position.Y)
|
||||
{
|
||||
state_->Position.Y += windowTargetPosition.Y/20;
|
||||
}*/
|
||||
windowOpenState += 0.05f;//*dt;
|
||||
}
|
||||
|
||||
/*if(statequeued_ != NULL)
|
||||
{
|
||||
@ -223,6 +208,9 @@ void Engine::Draw()
|
||||
g->Clear();
|
||||
#ifndef OGLI
|
||||
memcpy(g->vid, lastBuffer, (width_ * height_) * PIXELSIZE);
|
||||
if(windowOpenState < 20)
|
||||
windowOpenState++;
|
||||
g->fillrect(0, 0, width_, height_, 0, 0, 0, 255-std::pow(.98, windowOpenState)*255);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -87,7 +87,7 @@ namespace ui
|
||||
//Window* statequeued_;
|
||||
Window* state_;
|
||||
Point windowTargetPosition;
|
||||
float windowOpenState;
|
||||
int windowOpenState;
|
||||
|
||||
bool running_;
|
||||
bool break_;
|
||||
|
Reference in New Issue
Block a user