Refresh on the TimeStep update of Space itself.
parent
7857bae7af
commit
4a4c1e8c0c
|
@ -394,12 +394,6 @@ static int l_engine_get_amount_stars(lua_State *l)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int l_engine_refresh_background(lua_State *l)
|
||||
{
|
||||
Pi::RefreshBackground();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_master_volume(const bool muted, const float volume)
|
||||
{
|
||||
Sound::Pause(muted || is_zero_exact(volume));
|
||||
|
@ -823,7 +817,6 @@ void LuaEngine::Register()
|
|||
|
||||
{ "SetAmountStars", l_engine_set_amount_stars },
|
||||
{ "GetAmountStars", l_engine_get_amount_stars },
|
||||
{ "RefreshBackground", l_engine_refresh_background },
|
||||
|
||||
{ "GetMasterMuted", l_engine_get_master_muted },
|
||||
{ "SetMasterMuted", l_engine_set_master_muted },
|
||||
|
|
|
@ -126,6 +126,7 @@ std::map<SDL_JoystickID,Pi::JoystickState> Pi::joysticks;
|
|||
bool Pi::navTunnelDisplayed;
|
||||
bool Pi::speedLinesDisplayed = false;
|
||||
bool Pi::hudTrailsDisplayed = false;
|
||||
bool Pi::bRefreshBackgroundStars = false;
|
||||
float Pi::amountOfBackgroundStarsDisplayed = 1.0f;
|
||||
Gui::Fixed *Pi::menu;
|
||||
bool Pi::DrawGUI = true;
|
||||
|
@ -715,12 +716,6 @@ void Pi::SetView(View *v)
|
|||
if (currentView) currentView->Attach();
|
||||
}
|
||||
|
||||
void Pi::RefreshBackground()
|
||||
{
|
||||
if(game && game->GetSpace())
|
||||
game->GetSpace()->RefreshBackground();
|
||||
}
|
||||
|
||||
void Pi::OnChangeDetailLevel()
|
||||
{
|
||||
BaseSphere::OnChangeDetailLevel();
|
||||
|
|
9
src/Pi.h
9
src/Pi.h
|
@ -137,9 +137,13 @@ public:
|
|||
static void SetView(View *v);
|
||||
static View *GetView() { return currentView; }
|
||||
|
||||
static void SetAmountBackgroundStars(const float pc) { amountOfBackgroundStarsDisplayed = Clamp(pc, 0.01f, 1.0f); }
|
||||
static void SetAmountBackgroundStars(const float pc) { amountOfBackgroundStarsDisplayed = Clamp(pc, 0.01f, 1.0f); bRefreshBackgroundStars = true; }
|
||||
static float GetAmountBackgroundStars() { return amountOfBackgroundStarsDisplayed; }
|
||||
static void RefreshBackground();
|
||||
static bool MustRefreshBackgroundClearFlag() {
|
||||
const bool bRet = bRefreshBackgroundStars;
|
||||
bRefreshBackgroundStars = false;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
#if WITH_DEVKEYS
|
||||
static bool showDebugInfo;
|
||||
|
@ -211,6 +215,7 @@ private:
|
|||
static bool navTunnelDisplayed;
|
||||
static bool speedLinesDisplayed;
|
||||
static bool hudTrailsDisplayed;
|
||||
static bool bRefreshBackgroundStars;
|
||||
static float amountOfBackgroundStarsDisplayed;
|
||||
|
||||
static Gui::Fixed *menu;
|
||||
|
|
|
@ -915,6 +915,10 @@ void Space::CollideFrame(Frame *f)
|
|||
void Space::TimeStep(float step)
|
||||
{
|
||||
PROFILE_SCOPED()
|
||||
|
||||
if( Pi::MustRefreshBackgroundClearFlag() )
|
||||
RefreshBackground();
|
||||
|
||||
m_frameIndexValid = m_bodyIndexValid = m_sbodyIndexValid = false;
|
||||
|
||||
// XXX does not need to be done this often
|
||||
|
|
Loading…
Reference in New Issue