comments mostly

This commit is contained in:
Tobin
2026-04-25 14:46:52 -04:00
parent 6bd50b041c
commit d46a436303
3 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
https://www.beepbox.co/#9n31sbk0l00e05t1-a7g0fj07r4i0o432T1v1u61f0qwx10v311d08A5F2B6Q0530Pf636E2b677T5v1u53f0qwx10h511d03H_RIBJAAAzrrrqhh0E1b4T1v1ue7f10p7q0331d08A0F5B3Q0140Pea77E361b627638T2v1u15f10w4qw02d03w0E0b4id50000000id3g00000018Qd00000004h400000000p22PAqq_7jhWttlh7llCoyCnC0Pif0E7uOaWaYyl8Y2O-mJPs1FEIP4SnXNk0CLXFEY1vtjhjnrAkY9W3w5uVytdtOq3CG0JI2Q4L5Pq-HdE8kxAh26kUxMgx2I4894gxA127rEW14S135L46OJz84kqh45w11wFJvlglYDHlRO6Bl0MeJnpk00
https://www.beepbox.co/#9n31sbk0l00e05t1-a7g0fj07r4i0o432T1v1u61f0qwx10v311d08A5F2B6Q0530Pf636E2b677T5v1u53f0qwx10h511d03H_RIBJAAAzrrrqhh0E1b4T1v1ue7f10p7q0331d08A0F5B3Q0140Pea77E361b627638T2v1u15f10w4qw02d03w0E0b5yd50000000id3g00000018Qd00000004h400000000p236Aqq_7jhWttlh7llCoCCnKLc8Zq2SYyKyL8B2f0sLBHsT0GqbcNdB-Yl09H-Wqf0nTkQkRSV5f2uwU1nKoDjnsCwVGwbr0J1bV7jKg5lh7llwe8sP0pF6ndHWISwxi6h48pjy7124aMgwAh26g48tKzE4jo4cmYgraScwhhF4gm0462CRZl1nOuJnn8qlk30WRtBg00
+11
View File
@@ -1,3 +1,14 @@
/* yields
cat_init();
cat_create_window();
cat_pixel();
cat_fill();
cat_render();
cat_play_wav();
cat_stop_audio();
cat_get_event();
*/
#include <stdio.h>
#include <stdlib.h>
#include <SDL2/SDL.h>
+16 -6
View File
@@ -1,6 +1,12 @@
#include "cat_api.h"
#include <time.h>
/* TODO:
- *forces* as linked list struct? entity can have a list of forces acting on it
if force is 0N cleanup remove from list every tick.
or every few ticks do a cleanup routine that also frees memory and stuff
*/
void bye(void)
{
printf("bye!\n");
@@ -60,13 +66,14 @@ struct entity
{
int is_player;
int is_static;
int x;
int y;
int width;
int height;
int in_freefall;
float x;
float y;
int width; /**/
int height; /**/
unsigned char r; /* replace this with sprite TODO */
unsigned char g;
unsigned char b;
unsigned char g; /**/
unsigned char b; /**/
float vx;
float vy;
float ax;
@@ -212,6 +219,8 @@ void apply_friction(void) /* FIXME */
else if (p->vy < 0) p->vy += 1;
}
/* FIXME */ static int tick_count = 0;
void tick(void)
{
/* run every N milliseconds... nanoseconds? idk */
@@ -224,6 +233,7 @@ void tick(void)
/* do a tick */
yes: last_sec = t.tv_sec;
last_nsec = t.tv_nsec;
printf("tick %d!\n", tick_count++);
/* code to run every tick goes here */
erase_entities();