Commit Graph

146 Commits (a741f3c473c30ca1fb398801a88259eaab807aea)

Author SHA1 Message Date
Sara b8c856bf56 split the world module into world, physics, and object 2023-06-24 22:03:28 +02:00
Sara 43fa322409 removed debug prints from _slide_collision solver 2023-06-24 20:34:35 +02:00
Sara 4271ee8f8d fully implemented slide collision for any combination of aabb and circle colliders 2023-06-24 20:32:54 +02:00
Sara daa53c6ef0 movetowards now also works in cases where x == 0 && y != 0 || x != 0 && y == 0 2023-06-24 20:32:31 +02:00
Sara 3df374b3b9 interpolate move will now immediately stop if destination is reached 2023-06-18 22:45:06 +02:00
Sara fab7338891 axis now keeps a history for both keys 2023-06-18 22:22:16 +02:00
Sara cfcd31cee8 more explicit typing and casting in timespec_to_sec 2023-06-18 22:17:38 +02:00
Sara fc1f3499e3 input events are now still pumped during frame downtime 2023-06-18 22:17:25 +02:00
Sara 14b8b2f380 delta time is now updated before evaluating minimum delta time/ 2023-06-18 22:17:06 +02:00
Sara a93d09c96c reworked most input listener types to use OS events instead of checking state on update
this allows for them to be more reliable with low framerates
2023-06-18 22:14:16 +02:00
Sara b30df338ac no longer zeroing _delta_time if nanosecond element of difference between last and next time is negative 2023-06-18 19:04:22 +02:00
Sara a49ac0db93 timespec_to_sec now first multiplies tv_nsec by 1E-09 to convert to seconds 2023-06-18 18:04:49 +02:00
Sara 56679110e3 added frame limiting 2023-06-18 18:02:22 +02:00
Sara d69b92a464 delta_time is now calculating by converting timespec to seconds 2023-06-18 17:59:50 +02:00
Sara fcb9645dbe added NORMALIZE #define macro
avoids pointers and the accompanying dereference operations of normalize(...)
2023-06-18 16:34:28 +02:00
Sara 6f78731d8f normalize will now normalize if either x or y is non-zero
previously 100,0 would return 100,0 instead of 1,0
2023-06-18 16:33:39 +02:00
Sara 494dbfedb3 clamp_magnitude no longer outputs input x,y regardless of checks 2023-06-18 16:14:30 +02:00
Sara 1df623e669 move_towards now compares absolutes of diff and dir to check if the destination will be reached 2023-06-18 16:09:43 +02:00
Sara fa2a911732 added corelib/math/vec.h single header vector math library 2023-06-18 14:39:04 +02:00
Sara ea3beddfec inverted correction collision_check 2023-06-18 14:27:24 +02:00
Sara dff8e8304d iteration count for interpolate_move now based on number of steps required to fullfill move in theory 2023-06-18 14:24:38 +02:00
Sara 0a8aac2325 implemented slide 2023-06-18 14:18:37 +02:00
Sara 81e242532b added argument to interpolate_move, removed return value from interpolate_move 2023-06-18 14:08:55 +02:00
Sara bd87bcf8af bbminy in _collision_circle_aabb is now calculated correctly using y 2023-06-18 13:45:53 +02:00
Sara d134df5847 position now resets to last when interpolate_move collides 2023-06-18 13:42:20 +02:00
Sara 4bf759d224 added broadcast collision 2023-06-18 13:22:35 +02:00
Sara e32eb731c2 simplified interpolate move comparison condition 2023-06-18 13:15:03 +02:00
Sara 0b32967c20 removed requirement for a evt_collision listener from _can_collide 2023-06-18 13:13:35 +02:00
Sara 8ae7d302fe inverted _can_collide guard clause in interpolate_move 2023-06-18 11:59:13 +02:00
Sara f8d69e3537 reversed order of operations in interpolate_move 2023-06-18 11:39:16 +02:00
Sara d067ea6df8 default sprite origin in is now 0,0 2023-06-16 13:35:33 +02:00
Sara 0a6242ef3c sprite origin is now applied to untransformed rect 2023-06-14 18:50:55 +02:00
Sara 17eef0eb20 added interpolate move 2023-05-28 23:59:24 +02:00
Sara 6c16e8cdbd implemented simple aabb and circle collision 2023-05-24 21:31:50 +02:00
Sara 42ee0c4a26 fixed error in comment 2023-05-22 08:15:40 +02:00
Sara e03037acbe sprite x,y now defines location of origin on sprite 2023-05-22 08:10:55 +02:00
Sara 89db4253ae sprites now support specifying flip 2023-05-14 15:04:29 +02:00
Sara ce4638d1e9 origin now relative to dest size 2023-05-14 14:58:34 +02:00
Sara 62b4515585 sprite origin now percentage of source rect 2023-05-14 14:56:06 +02:00
Sara 04101f6427 fixed broken scaling in sprite rendering 2023-05-14 14:46:12 +02:00
Sara 2e7b3d3c4a moved update_objects to after update_game 2023-05-14 14:20:25 +02:00
Sara 44a4b6928c engine now uses displaymode to automatically start at desktop size 2023-05-11 21:09:49 +02:00
Sara 4d4547551c make_spritesheet now works with number of tiles on x and y rather than tile width and height 2023-05-11 21:09:23 +02:00
Sara 6fb60c254d renamed input_*down functions to input_get_*down 2023-05-11 21:08:13 +02:00
Sara 0a37a3278d renamed input_event to input_notify_event to clarify the function 2023-05-11 21:07:07 +02:00
Sara 22d0200d84 input internal variables and functions are now static and static inline respectively 2023-05-11 21:05:46 +02:00
Sara dfcc030f4d removed player.c and player.h
these were for testing anyway
2023-05-11 19:50:14 +02:00
Sara ce8cf1a0ea removed load_game() because of redundancy with start_game 2023-05-11 19:49:58 +02:00
Sara 1e184d43c7 world objects and input are now managed in engine.c rather than game.c 2023-05-11 19:49:40 +02:00
Sara f7696c4ea8 moved world functionality to corelib 2023-05-11 19:49:03 +02:00
Sara 9f9cc446fe switched testing player controller to wasd (from arrows) 2023-05-07 17:55:22 +02:00
Sara 8f7792c673 removed all references of ui module
since this is now a separate branch/pr
2023-05-07 17:55:08 +02:00
Sara 1021d04013 fixed nan issue in player 2023-05-07 16:09:19 +02:00
Sara d28305920f added inline to static functions 2023-05-06 00:05:05 +02:00
Sara a55bf84aef engine internal functions are now static inline 2023-05-05 23:27:08 +02:00
Sara 182cfc66cb added delta_time to engine.c 2023-05-05 23:26:30 +02:00
Sara cc08588b17 internal asset functions are now static 2023-05-05 23:23:41 +02:00
Sara 64b8dbcbf3 removed one use of memcpy and replaced with *a = *b 2023-05-05 23:23:04 +02:00
Sara 2457858399 changed many of the functions to now be static 2023-05-05 23:22:32 +02:00
Sara ee2dd74566 added updated game to test world 2023-05-05 23:20:38 +02:00
Sara 6afac70411 added player to test world 2023-05-05 23:20:23 +02:00
Sara 465551e981 replaced tilemap with world 2023-05-05 23:20:07 +02:00
Sara b898fd5b31 added return in guard clause for empty drawcmd buffer
draw(cmd) had a bug causing the first drawcmd in every frame to be added twice, for text this would cause a double free
2023-05-05 22:17:28 +02:00
Sara 2b927259a8 draw(cmd) is now no longer in declared in header 2023-05-05 22:14:30 +02:00
Sara 750b30aa89 no_sprite is now a #define for a all-zero sprite 2023-05-05 22:14:01 +02:00
Sara 3a5ec4a0d1 finished basic text rendering 2023-04-26 00:34:11 +02:00
Sara 3c3c565bfa finished text scaling code 2023-04-23 00:47:49 +02:00
Sara 5686c17fee started work on text rendering 2023-04-21 00:27:05 +02:00
Sara 55311d0bb8 fixed translation issue with ninesliced images 2023-04-21 00:26:36 +02:00
Sara 4c4851546f now quitting sdl-ttf correctly 2023-04-21 00:25:28 +02:00
Sara a5d9d5ec96 updated font asset handling 2023-04-21 00:25:05 +02:00
Sara dd40766fca added ninesliced and text rendering commands 2023-04-20 23:04:04 +02:00
Sara b9d0d70e5a removed C++ dependencies and reverted tilemap, engine and game files to C source files 2023-04-20 22:59:34 +02:00
Sara 61f9de5256 remove mouse listener min delta param 2023-04-20 22:57:51 +02:00
Sara fb6b76f0cf removed add_*_listener return types / added scroll input event type 2023-04-20 22:57:10 +02:00
Sara 85182ed22c added more by-name asset lookup options 2023-04-20 22:55:05 +02:00
Sara 6d27dd4c12 added font file and arbitrary memory asset types 2023-04-20 10:10:27 +02:00
Sara 6fc06012b6 updated ui input function 2023-04-11 08:11:56 +02:00
Sara 8d644c6d4c reordered spritesheet loading to be more userfriendly 2023-04-11 08:11:21 +02:00
Sara c22c090c42 increased default tilemap size to 128 2023-04-11 08:10:46 +02:00
Sara 783c545244 increased max drawcmd count 2023-04-11 08:08:59 +02:00
Sara 89cc8b9969 fixed out of bounds write in load_tilemap 2023-04-11 08:07:26 +02:00
Sara 34593e0701 added comments to render-related structs 2023-04-10 16:57:59 +02:00
Sara 9dbb5a1566 further fixes to render ordering 2023-04-10 16:57:45 +02:00
Sara 3e8eef4200 added debug render frame flag 2023-04-10 16:57:09 +02:00
Sara 96ffaf5f9e added ui layers and made all layers relative to sprites at zero 2023-04-10 16:56:30 +02:00
Sara 4b080adfde added more controls and generalized tile previews 2023-04-10 16:55:33 +02:00
Sara f4ccfd43a7 removed draw_ functions and replaced with just update_ 2023-04-10 16:54:05 +02:00
Sara 94d39e2913 reworked tileset 2023-04-10 16:53:23 +02:00
Sara c9c5cf4935 fixed bad condition causing incorrect ordering on ui 2023-04-10 13:27:12 +02:00
Sara e6a011c12b got my shit in order regarding tilemaps 2023-04-10 00:14:53 +02:00
Sara 544e604349 updated includes 2023-04-08 00:26:52 +02:00
Sara 3ffa531b55 created corelib folder 2023-04-08 00:23:30 +02:00
Sara 6e09b0f61e improved layering 2023-04-07 23:25:46 +02:00
Sara 93b6b898cf added more extern C markers to keep as muh of the libraries C 2023-04-07 21:13:54 +02:00
Sara 97d6dda15a added source 2023-04-06 15:20:08 +02:00