Merge branch 'main' of yibble.dev:bulmanator/ld58

Fixed conflicts
Added "code" directory for include to make it easier to include core
headers
Stopped warnings (probably cl specific)
This commit is contained in:
2025-10-04 21:58:14 +01:00
19 changed files with 366 additions and 20 deletions

View File

@@ -6,23 +6,25 @@
#include <stb_image.h>
#include "core/core.h"
#include "core/types.h"
#include "os/core.h"
#include "vulkan/core.h"
#include "game/core.h"
int main(int argc, char **argv) {
(void) argc;
(void) argv;
if (!SDL_Init(SDL_INIT_VIDEO)) {
if (!SDL_Init(SDL_INIT_VIDEO))
{
printf("[Error] :: Failed to initialise SDL3 (%s)\n", SDL_GetError());
return 1;
}
SDL_Window *window = SDL_CreateWindow("Ludum", 1280, 720, SDL_WINDOW_HIGH_PIXEL_DENSITY);
if (!window) {
if (!window)
{
printf("[Error] :: Failed to create window (%s)\n", SDL_GetError());
return 1;
}
@@ -58,12 +60,22 @@ int main(int argc, char **argv) {
}
bool running = true;
while (running) {
Player player;
player.pos.x = 0;
player.pos.y = 0;
while (running)
{
SDL_Event e;
while (SDL_PollEvent(&e)) {
if (e.type == SDL_EVENT_QUIT) { running = false; }
while (SDL_PollEvent(&e))
{
PlayerUpdate(&e, &player);
if (e.type == SDL_EVENT_QUIT)
{
running = false;
}
}
int w, h;
SDL_GetWindowSizeInPixels(window, &w, &h);
@@ -76,20 +88,20 @@ int main(int argc, char **argv) {
clear_colour.color.float32[2] = 0.0f;
clear_colour.color.float32[3] = 1.0f;
VkRenderingAttachmentInfo colour_attachment = { 0 };
colour_attachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
colour_attachment.imageView = vk.swapchain.views[frame->image];
VkRenderingAttachmentInfo colour_attachment = {0};
colour_attachment.sType = VK_STRUCTURE_TYPE_RENDERING_ATTACHMENT_INFO;
colour_attachment.imageView = vk.swapchain.views[frame->image];
colour_attachment.imageLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
colour_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
colour_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
colour_attachment.clearValue = clear_colour;
colour_attachment.loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR;
colour_attachment.storeOp = VK_ATTACHMENT_STORE_OP_STORE;
colour_attachment.clearValue = clear_colour;
VkRenderingInfo rendering_info = { 0 };
rendering_info.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
rendering_info.renderArea = (VkRect2D) { 0, 0, w, h };
rendering_info.layerCount = 1;
VkRenderingInfo rendering_info = {0};
rendering_info.sType = VK_STRUCTURE_TYPE_RENDERING_INFO;
rendering_info.renderArea = (VkRect2D){0, 0, w, h};
rendering_info.layerCount = 1;
rendering_info.colorAttachmentCount = 1;
rendering_info.pColorAttachments = &colour_attachment;
rendering_info.pColorAttachments = &colour_attachment;
vk.CmdBeginRendering(cmd, &rendering_info);
@@ -148,6 +160,7 @@ int main(int argc, char **argv) {
vk.CmdEndRendering(cmd);
Vk_FrameEnd();
}