started grphic.h and cleaned a bit more main.c

This commit is contained in:
Emilia(SleepeeSoftware) 2026-03-03 01:49:43 +01:00
parent 0a66fcbd80
commit 97d0e0f955
2 changed files with 20 additions and 0 deletions

View File

@ -1,7 +1,22 @@
#ifndef GRAPHIC_H
# define GRAPHIC_H
#include <math.h>
//software renderer allowing for system agnostic rendering (other then drawing the frame on the screen)
typedef struct Vec3_s{
float x, y, z;
} Vec3_t;
//internal framebuffer
char framebuffer[65536]; //256 * 256
//limited to 255 color
void DrawPoint(Vec3_t point, char color) {
int x = floorf(point.x / point.z);
int y = floorf(point.y / point.z);
//need to work on projection, screen space and 3d space
framebuffer[x + y * 256] = color;
}
#endif

View File

@ -80,6 +80,11 @@ int main(int ac, char **av) {
tkn_lst = SeparateString(data);
//second pass on ; and \n
//third pass on \t and space
//give each token a context
//let's replace preprocessor
//let's do recursive parsing everywhere that need it
//compile time reflection
//metaprogramming logic annotation if i do it lastly
for (int i = 0; i < tkn_lst.size; i++) {
free(tkn_lst.token[i].data);
}