File tree 4 files changed +24
-12
lines changed
4 files changed +24
-12
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,12 @@ LoadingState :: LoadingState(Qor* qor):
115
115
// fade_to(Color::white(), m_FadeTime);
116
116
m_Fade.frame (Frame<Color>(
117
117
Color::white (),
118
- Freq::Time::seconds (0 .25f ),
118
+ Freq::Time::seconds (0 .5f ),
119
119
INTERPOLATE (out_sine<Color>)
120
120
));
121
121
// m_Fade.frame(Frame<Color>(
122
122
// Color::white(), // wait a while
123
- // Freq::Time::seconds(0.25f ),
123
+ // Freq::Time::seconds(0.5f ),
124
124
// INTERPOLATE(Color, out_sine)
125
125
// ));
126
126
#ifndef QOR_NO_AUDIO
@@ -207,7 +207,7 @@ void LoadingState :: logic(Freq::Time t)
207
207
{
208
208
m_Fade.frame (Frame<Color>(
209
209
Color::black (),
210
- Freq::Time::seconds (0 .25f ),
210
+ Freq::Time::seconds (0 .5f ),
211
211
INTERPOLATE (out_sine<Color>)
212
212
));
213
213
}
@@ -231,6 +231,8 @@ void LoadingState :: logic(Freq::Time t)
231
231
}
232
232
}
233
233
}
234
+
235
+ m_pPipeline->redraw ();
234
236
}
235
237
236
238
void LoadingState :: render() const
Original file line number Diff line number Diff line change @@ -22,9 +22,6 @@ int main(int argc, char* argv[])
22
22
23
23
auto engine = kit::make_unique<Qor>(args, Info::Program);
24
24
25
- // engine->max_tick(300.0f);
26
- // engine->max_fps(30.0f);
27
-
28
25
if (engine->args ().value_or (" mod" , " " ).empty ())
29
26
engine->states ().register_class <BasicState>(); // run basic state
30
27
else
Original file line number Diff line number Diff line change @@ -182,6 +182,15 @@ Qor :: ~Qor()
182
182
m_pPipeline.reset ();
183
183
}
184
184
185
+ bool Qor :: needs_render() const
186
+ {
187
+ bool pipeline_dirty = m_pPipeline->dirty ();
188
+ int pipeline_idlemode = m_pPipeline->idle ();
189
+ if (not (pipeline_idlemode & Pipeline::IDLE_RENDER) || pipeline_dirty)
190
+ return true ;
191
+ return false ;
192
+ }
193
+
185
194
void Qor :: logic()
186
195
{
187
196
Freq::Time t;
@@ -200,17 +209,21 @@ void Qor :: logic()
200
209
m_FrameAccum += t.s ();
201
210
if (m_MaxTick < K_EPSILON) // MaxTick==0 for unlimited ticks
202
211
break ;
203
- if ((m_TickAccum > 1 .0f /m_MaxTick) ||
204
- (m_MaxFPS > K_EPSILON && m_FrameAccum > 1 .0f /m_MaxFPS))
212
+ if (m_TickAccum > 1 .0f /m_MaxTick)
205
213
break ;
214
+ if (m_MaxFPS > K_EPSILON && m_FrameAccum > 1 .0f /m_MaxFPS) {
215
+ if (needs_render ())
216
+ break ;
217
+ }
206
218
try {
219
+ // SDL_Delay(1);
207
220
this_thread::yield ();
208
221
}catch (...){
209
222
quit ();
210
223
return ;
211
224
}
212
225
}
213
- // LOGf("%s", m_TickAccum);
226
+ t = Freq::Time::seconds ( m_TickAccum);
214
227
215
228
++m_TicksLastSecond;
216
229
@@ -239,9 +252,7 @@ void Qor :: render()
239
252
if (Headless::enabled ())
240
253
return ;
241
254
242
- bool pipeline_dirty = m_pPipeline->dirty ();
243
- int pipeline_idlemode = m_pPipeline->idle ();
244
- if ((pipeline_idlemode & Pipeline::IDLE_RENDER) && not pipeline_dirty)
255
+ if (!needs_render ())
245
256
return ;
246
257
247
258
if (m_FPSAlarm.elapsed ()) {
Original file line number Diff line number Diff line change @@ -220,6 +220,8 @@ class Qor:
220
220
mutable std::mutex m_TasksMutex;
221
221
std::thread::id m_HandlerThreadID = std::this_thread::get_id();
222
222
std::deque<std::function<void ()>> m_Tasks;
223
+
224
+ bool needs_render () const ;
223
225
224
226
void async_load (State* s)
225
227
{
You can’t perform that action at this time.
0 commit comments