Compare commits

...

4 Commits

Author SHA1 Message Date
7d0e5c80bd lil dep update 2024-02-04 12:48:04 +01:00
f716ad9dd1 limit max main loop sleep 2024-02-03 20:49:52 +01:00
671772a20e min fps for inactive reduced now 1fps 2024-02-03 19:07:14 +01:00
b0173f6d68 tox iterate interval pow(1.6)
fix faux offline inbetween timer
crop by default
2024-02-03 15:00:32 +01:00
6 changed files with 18 additions and 9 deletions

View File

@ -178,9 +178,13 @@ int main(int argc, char** argv) {
//)
//));
const float min_delay = std::min<float>(
screen->nextTick() - time_delta_tick,
screen->nextRender() - time_delta_render
const float min_delay =
std::min<float>(
std::min<float>(
screen->nextTick() - time_delta_tick,
screen->nextRender() - time_delta_render
),
0.25f // dont sleep too long
) * 1000.f;
if (min_delay > 0.f) {

View File

@ -5,6 +5,7 @@
#include <SDL3/SDL.h>
#include <memory>
#include <cmath>
MainScreen::MainScreen(SDL_Renderer* renderer_, std::string save_path, std::string save_password, std::vector<std::string> plugins) :
renderer(renderer_),
@ -227,7 +228,7 @@ Screen* MainScreen::render(float time_delta, bool&) {
_window_hidden
)
) {
_render_interval = std::min<float>(1.f/4.f, pm_interval);
_render_interval = std::min<float>(1.f/1.f, pm_interval);
} else {
_render_interval = std::min<float>(1.f/60.f, pm_interval);
}
@ -253,7 +254,9 @@ Screen* MainScreen::tick(float time_delta, bool& quit) {
mts.iterate(); // compute
_min_tick_interval = std::min<float>(
tc.toxIterationInterval()/1000.f,
// HACK: pow by 1.6 to increase 50 -> ~500 (~522)
// and it does not change 1
std::pow(tc.toxIterationInterval(), 1.6f)/1000.f,
pm_interval
);
_min_tick_interval = std::min<float>(
@ -261,6 +264,8 @@ Screen* MainScreen::tick(float time_delta, bool& quit) {
fo_interval
);
//std::cout << "MS: min tick interval: " << _min_tick_interval << "\n";
switch (_compute_perf_mode) {
// normal 1ms lower bound
case 0: _min_tick_interval = std::max<float>(_min_tick_interval, 0.001f); break;

View File

@ -32,7 +32,7 @@ struct SendImagePopup {
Rect crop_rect;
Rect crop_before_drag;
bool cropping {false};
bool cropping {true};
bool dragging_last_frame_ul {false};
bool dragging_last_frame_lr {false};

View File

@ -24,7 +24,7 @@ class ToxFriendFauxOfflineMessaging : public ToxEventI {
// TODO: increase timer?
const float _delay_after_cc {4.5f};
const float _delay_inbetween {1.3f};
const float _delay_inbetween {0.3f};
const float _delay_retry {10.f}; // retry sending after 10s
public: