raycast start

This commit is contained in:
2025-10-04 17:36:47 +01:00
parent a6266a336b
commit 31ba002ac7
5 changed files with 59 additions and 11 deletions

View File

@@ -9,6 +9,7 @@
#include "vulkan/core.h"
#include "game/impl/player.c"
#include "game/impl/aabb.c"
int main(int argc, char **argv)
{
@@ -34,11 +35,31 @@ int main(int argc, char **argv)
Player player;
player.pos.x = 0;
player.pos.y = 0;
AABB a;
a.pos.x = 10;
a.pos.y = 10;
a.size.x = 10;
a.size.y = 10;
while (running)
{
SDL_Event e;
while (SDL_PollEvent(&e))
{
SDL_MouseButtonEvent mouseBtn = e.button;
if (mouseBtn.clicks == 1)
{
V2f point;
point.x = mouseBtn.x;
point.y = mouseBtn.y;
if (AABB_Slab(player.pos, point, a))
{
printf("hit");
}
else
{
printf("miss");
}
}
PlayerUpdate(&e, &player);
if (e.type == SDL_EVENT_QUIT)
{