16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 04:39:18 +02:00
This commit is contained in:
milek7
2017-08-18 11:48:13 +02:00
parent ec60853614
commit 6b5084e855
6 changed files with 10 additions and 12 deletions

View File

@@ -154,6 +154,7 @@ TButton::play( sound* Sound ) {
if( Sound == nullptr ) { return; } if( Sound == nullptr ) { return; }
Sound->stop();
Sound->play(); Sound->play();
return; return;
} }

View File

@@ -109,12 +109,12 @@ void window_resize_callback(GLFWwindow *window, int w, int h)
void cursor_pos_callback(GLFWwindow *window, double x, double y) void cursor_pos_callback(GLFWwindow *window, double x, double y)
{ {
if (!window)
return;
input::Mouse.move( x, y ); input::Mouse.move( x, y );
if( true == Global::ControlPicking ) { if( !Global::ControlPicking ) {
glfwSetCursorPos( window, x, y );
}
else {
glfwSetCursorPos( window, 0, 0 ); glfwSetCursorPos( window, 0, 0 );
} }
} }

View File

@@ -320,6 +320,7 @@ TGauge::play( sound *Sound ) {
if( Sound == nullptr ) { return; } if( Sound == nullptr ) { return; }
Sound->stop();
Sound->play(); Sound->play();
return; return;
} }

View File

@@ -6848,10 +6848,6 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
{ {
DynamicObject->mdKabina->Init(); // obrócenie modelu oraz optymalizacja, również zapisanie binarnego DynamicObject->mdKabina->Init(); // obrócenie modelu oraz optymalizacja, również zapisanie binarnego
set_cab_controls(); set_cab_controls();
// HACK: for some reason simulation at the start is slow until a sound is played
// until we do a proper fix, try to play a 'silent' sound when cab is entered
// TBD: it could be instead a legit sound of door closing
play_sound( dsbSwitch, 0.0f );
return true; return true;
} }
return (token == "none"); return (token == "none");

View File

@@ -1122,9 +1122,6 @@ bool TWorld::Update()
dt = Timer::GetDeltaRenderTime(); // nie uwzględnia pauzowania ani mnożenia czasu dt = Timer::GetDeltaRenderTime(); // nie uwzględnia pauzowania ani mnożenia czasu
sound_man->set_listener(Camera.Pos, Camera.LookAt, Camera.vUp);
sound_man->update(dt);
// fixed step render time routines // fixed step render time routines
fTime50Hz += dt; // w pauzie też trzeba zliczać czas, bo przy dużym FPS będzie problem z odczytem ramek fTime50Hz += dt; // w pauzie też trzeba zliczać czas, bo przy dużym FPS będzie problem z odczytem ramek
@@ -1151,6 +1148,9 @@ bool TWorld::Update()
Update_Camera( dt ); Update_Camera( dt );
sound_man->set_listener(Camera.Pos, Camera.LookAt, Camera.vUp);
sound_man->update(dt);
GfxRenderer.Update( dt ); GfxRenderer.Update( dt );
ResourceSweep(); ResourceSweep();

View File

@@ -26,6 +26,7 @@ ui_layer::~ui_layer() {
bool bool
ui_layer::init( GLFWwindow *Window ) { ui_layer::init( GLFWwindow *Window ) {
m_window = Window;
#ifndef _WIN32 #ifndef _WIN32
Global::bGlutFont = true; Global::bGlutFont = true;
@@ -43,7 +44,6 @@ ui_layer::init( GLFWwindow *Window ) {
} }
#ifdef _WIN32 #ifdef _WIN32
m_window = Window;
HFONT font; // Windows Font ID HFONT font; // Windows Font ID
m_fontbase = ::glGenLists(96); // storage for 96 characters m_fontbase = ::glGenLists(96); // storage for 96 characters
HDC hDC = ::GetDC( glfwGetWin32Window( m_window ) ); HDC hDC = ::GetDC( glfwGetWin32Window( m_window ) );