summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-25 16:56:28 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-25 16:56:28 -0500
commit3ff107c7ca438749a8425feef9eefb67c7a8abfc (patch)
treed42f3526c3bc36383e3979c50142b2c7c200b220 /main.c
parent6d77e94b652ab4b8070b5acf1c6febfe77fc41c3 (diff)
resizing nodes (not fully working yet?)
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/main.c b/main.c
index 70200f2..724c2e8 100644
--- a/main.c
+++ b/main.c
@@ -380,7 +380,7 @@ int main(int argc, char **argv) {
{ // get mouse position
int mouse_x = 0, mouse_y = 0;
- SDL_GetMouseState(&mouse_x, &mouse_y);
+ ted->mouse_state = SDL_GetMouseState(&mouse_x, &mouse_y);
ted->mouse_pos = V2((float)mouse_x, (float)mouse_y);
}
bool ctrl_down = keyboard_state[SDL_SCANCODE_LCTRL] || keyboard_state[SDL_SCANCODE_RCTRL];
@@ -528,8 +528,7 @@ int main(int argc, char **argv) {
// default to arrow cursor
ted->cursor = ted->cursor_arrow;
-
- if (!(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_LMASK)) {
+ if (!(ted->mouse_state & SDL_BUTTON_LMASK)) {
// originally this was done on SDL_MOUSEBUTTONUP events but for some reason
// I was getting a bunch of those even when I was holding down the mouse.
// This makes it much smoother.