Mercurial
view sori/main.c @ 279:b3b547563ec7
Add Google connector service and agent wiki
Implement the C/Seobeo Google Drive and Gmail connector with encrypted OAuth storage, Zenbu authentication, browser testing, AI tool discovery, chunked HTTP decoding, and Bazel coverage. Consolidate repository guidance into progressive wiki documentation and enforce arena-first allocation for new first-party C code.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 84c338fd-0939-4bb3-b7f3-1062eb213e5d
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 17 Aug 2026 22:22:36 -0700 |
| parents | a58a663dae68 |
| children |
line wrap: on
line source
#include <stdio.h> #include "dowa/dowa.h" #include "third_party/raylib/include/raylib.h" #include "third_party/raylib/include/raymath.h" typedef struct { char *texts; Vector2 position; } PopUpText; typedef struct { Vector2 position; Vector2 size; Vector2 velocity; } Entity; Entity *Shoot(Entity *player) { Entity *box = malloc(sizeof(Entity)); box->velocity = (Vector2){ .x=1, .y=-10 }; box->position = player->position; box->size = (Vector2){ .x=10, .y=2 }; return box; } void Entity_Update(Entity *player, Entity *object) { int gravity = 1; player->velocity.y += gravity; player->position = Vector2Add(player->position, player->velocity); if ( player->position.y + player->size.y > object->position.y ) { player->position.y = object->position.y - player->size.y; } } int main() { char mouse_position[256]; InitWindow(800, 450, "Sori the game"); SetTargetFPS(120); Entity player = { .size = (Vector2){ .x = 20, .y = 20 }, .position = (Vector2){ .x = 10, .y = 10}, .velocity = (Vector2){ .x = 0, .y = 0}, }; Entity ground = { .size = (Vector2){ .x = 800, .y = 100 }, .position = (Vector2){ .x = 0, .y = 350}, .velocity = (Vector2){ .x = 0, .y = 0}, }; Entity *bullet; Entity **bullets = malloc(sizeof(Entity) * 100); PopUpText *curr_values = malloc(sizeof(PopUpText) * 100); int size_bullets = 0; int size_texts = 0; int frame = 0; while (!WindowShouldClose()) { BeginDrawing(); ClearBackground(RAYWHITE); int x = GetMouseX(); int y = GetMouseY(); sprintf( mouse_position, "Mouse position %d, %d", x, y ); if (IsMouseButtonPressed(0)) { curr_values[size_texts].texts = "hello good sir"; curr_values[size_texts].position = (Vector2){ .x = (float)x, .y = (float)y, }; size_texts++; Entity *bullet = Shoot(&player); bullets[size_bullets] = bullet; size_bullets++; } if (frame > 2) { Entity_Update(&player, &ground); frame = 0; for (uint32 i = 0; i < size_texts; i++) { Entity_Update(bullets[i], &ground); } } int key = GetKeyPressed(); if (IsKeyDown(KEY_W)) { player.position.y -= 1; } if (IsKeyDown(KEY_S)) { player.position.y += 1; } if (IsKeyDown(KEY_A)) { player.position.x -= 1; } if (IsKeyDown(KEY_D)) { player.position.x += 1; } DrawRectangleV(player.position, player.size, RED); DrawRectangleV(ground.position, ground.size, BLUE); for (uint32 i = 0; i < size_texts; i++) { DrawText(curr_values[i].texts, curr_values[i].position.x, curr_values[i].position.y, 20, LIGHTGRAY); DrawRectangleV(bullets[i]->position, bullets[i]->size, BLACK); } DrawText(mouse_position, 190, 200, 20, LIGHTGRAY); EndDrawing(); frame++; } CloseWindow(); return 0; }