MCPcopy Create free account
hub / github.com/Wassimulator/CactusViewer / update_logic

Function update_logic

src/source.cpp:4512–4771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4510}
4511
4512static void update_logic() {
4513 bool WantCaptureMouse = G->ui_want_capture_mouse;
4514 bool fullscreen = is_fullscreen(hwnd);
4515
4516 if (G->alert.timer > 0)
4517 G->alert.timer++;
4518 if (G->alert.timer == 300)
4519 G->alert.timer = 0;
4520
4521 paint_update();
4522
4523 if (keyup(Key_F11))
4524 toggle_fullscreen(hwnd);
4525 if (keyup(Key_Esc) && fullscreen)
4526 exit_fullscreen(hwnd);
4527 if (keyup(Key_Esc) && !fullscreen && G->settings_esc_to_quit)
4528 post_quit();
4529
4530 if (keyup(Key_F)) {
4531 //send_signal(G->signals.update_filtering);
4532 G->nearest_filtering = !G->nearest_filtering;
4533 }
4534 if (keyup(Key_G)) {
4535 G->pixel_grid = !G->pixel_grid;
4536 }
4537 if (G->files.Count > 0 && keyup(Key_R)) {
4538 scan_folder(G->files[G->current_file_index].file.path);
4539 }
4540 if (G->files.Count > 0 && keyup(Key_Delete)) {
4541 send_signal(G->signals.delete_current_image);
4542 }
4543
4544 if (G->paint_mode == false) {
4545 G->mouse_dragging = false;
4546 static int drag_index = drag_free;
4547 bool hovers[drag_count] = { 0 };
4548 if (!WantCaptureMouse) {
4549 if (G->crop_mode) {
4550 f32 threshold = 5 / G->truescale;
4551 SetCursor(G->hcursor[Cursor_Type_arrow]);
4552
4553 if (abso(G->pixel_mouse.x - (G->crop_a.x)) < threshold) {
4554 if (keydn(MouseL)) drag_index = drag_crop_a_x;
4555 hovers[drag_crop_a_x] = true;
4556 SetCursor(G->hcursor[Cursor_Type_resize_h]);
4557 } else if (abso(G->pixel_mouse.x - (G->crop_b.x)) < threshold) {
4558 if (keydn(MouseL)) drag_index = drag_crop_b_x;
4559 hovers[drag_crop_b_x] = true;
4560 SetCursor(G->hcursor[Cursor_Type_resize_h]);
4561 }
4562
4563 if (abso(G->pixel_mouse.y - (G->crop_a.y)) < threshold) {
4564 if (keydn(MouseL)) drag_index = drag_crop_a_y;
4565 hovers[drag_crop_a_y] = true;
4566 SetCursor(G->hcursor[Cursor_Type_resize_v]);
4567 } else if (abso(G->pixel_mouse.y - (G->crop_b.y)) < threshold) {
4568 if (keydn(MouseL)) drag_index = drag_crop_b_y;
4569 hovers[drag_crop_b_y] = true;

Callers 1

wmainFunction · 0.85

Calls 14

is_fullscreenFunction · 0.85
paint_updateFunction · 0.85
keyupFunction · 0.85
toggle_fullscreenFunction · 0.85
exit_fullscreenFunction · 0.85
post_quitFunction · 0.85
scan_folderFunction · 0.85
absoFunction · 0.85
keydnFunction · 0.85
keypressFunction · 0.85
_iv2Function · 0.85
save_imageFunction · 0.85

Tested by

no test coverage detected