|
@@ -126,13 +126,17 @@ slop::SlopSelection slop::XShapeSlopSelect( slop::SlopOptions* options, bool* ca
|
126
|
126
|
// We have no GL context, so the matrix is useless...
|
127
|
127
|
glm::mat4 fake;
|
128
|
128
|
// This is where we'll run through all of our stuffs
|
|
129
|
+ auto last = std::chrono::high_resolution_clock::now();
|
129
|
130
|
while( memory.running ) {
|
130
|
131
|
slop::mouse->update();
|
131
|
132
|
if ( !options->nokeyboard ) {
|
132
|
133
|
slop::keyboard->update();
|
133
|
134
|
}
|
134
|
135
|
// We move our statemachine forward.
|
135
|
|
- memory.update( 1 );
|
|
136
|
+ auto current = std::chrono::high_resolution_clock::now();
|
|
137
|
+ std::chrono::duration<double, std::milli> frametime = current-last;
|
|
138
|
+ last = current;
|
|
139
|
+ memory.update( frametime.count()/1000.f );
|
136
|
140
|
|
137
|
141
|
// We don't actually draw anything, but the state machine uses
|
138
|
142
|
// this to know when to spawn the window.
|
|
@@ -189,13 +193,17 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
|
189
|
193
|
|
190
|
194
|
// This is where we'll run through all of our stuffs
|
191
|
195
|
auto start = std::chrono::high_resolution_clock::now();
|
|
196
|
+ auto last = start;
|
192
|
197
|
while( memory.running ) {
|
193
|
198
|
slop::mouse->update();
|
194
|
199
|
if ( !options->nokeyboard ) {
|
195
|
200
|
slop::keyboard->update();
|
196
|
201
|
}
|
197
|
202
|
// We move our statemachine forward.
|
198
|
|
- memory.update( 1 );
|
|
203
|
+ auto current = std::chrono::high_resolution_clock::now();
|
|
204
|
+ std::chrono::duration<double, std::milli> frametime = current-last;
|
|
205
|
+ last = current;
|
|
206
|
+ memory.update( frametime.count()/1000.f );
|
199
|
207
|
|
200
|
208
|
// Then we draw our junk to a framebuffer.
|
201
|
209
|
window->framebuffer->setShader( textured );
|
|
@@ -205,8 +213,7 @@ slop::SlopSelection slop::GLSlopSelect( slop::SlopOptions* options, bool* cancel
|
205
|
213
|
memory.draw( window->camera );
|
206
|
214
|
window->framebuffer->unbind();
|
207
|
215
|
|
208
|
|
- auto end = std::chrono::high_resolution_clock::now();
|
209
|
|
- std::chrono::duration<double, std::milli> elapsed = end-start;
|
|
216
|
+ std::chrono::duration<double, std::milli> elapsed = current-start;
|
210
|
217
|
if ( shaders.size() > 1 ) {
|
211
|
218
|
int i;
|
212
|
219
|
// We have our clean buffer, now to slather it with some juicy shader chains.
|