diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-25 14:30:27 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-02-25 14:30:27 -0500 |
commit | 6d77e94b652ab4b8070b5acf1c6febfe77fc41c3 (patch) | |
tree | 371459fb5c1eb323959c365f8b39fe5a53631681 /main.c | |
parent | 047764ebab345a2bcb3a856c1f1956e849f52354 (diff) |
change cursor
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -360,6 +360,11 @@ int main(int argc, char **argv) { u32 *colors = settings->colors; (void)colors; + ted->cursor_ibeam = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_IBEAM); + ted->cursor_arrow = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW); + ted->cursor_resize_h = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZEWE); + ted->cursor_resize_v = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_SIZENS); + Uint32 time_at_last_frame = SDL_GetTicks(); while (!ted->quit) { @@ -521,6 +526,9 @@ int main(int argc, char **argv) { } } + // default to arrow cursor + ted->cursor = ted->cursor_arrow; + if (!(SDL_GetMouseState(NULL, NULL) & 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. @@ -713,6 +721,7 @@ int main(int argc, char **argv) { #endif SDL_SetWindowTitle(window, ted->window_title); + SDL_SetCursor(ted->cursor); SDL_GL_SwapWindow(window); PROFILE_TIME(frame_end); @@ -735,6 +744,10 @@ int main(int argc, char **argv) { if (log) fclose(log); + SDL_FreeCursor(ted->cursor_arrow); + SDL_FreeCursor(ted->cursor_ibeam); + SDL_FreeCursor(ted->cursor_resize_h); + SDL_FreeCursor(ted->cursor_resize_v); SDL_GL_DeleteContext(glctx); SDL_DestroyWindow(window); SDL_Quit(); |