more component stuff

This commit is contained in:
Josh Lyon
2025-08-13 22:21:37 -06:00
parent f6de0ed9f3
commit 7259d9307b
8 changed files with 151 additions and 43 deletions

View File

@@ -1,11 +1,31 @@
#pragma once
#include "GameObject.h"
#include "Graphics.h"
#include "GraphicsComponent.h"
#include <print>
#include <SDL3/SDL_pixels.h>
#include <SDL3/SDL_rect.h>
#include <SDL3/SDL_stdinc.h>
class PlayerGraphics : public GraphicsComponent {
void update(Graphics &graphics) {
std::print("Updating player graphics");
public:
void setPos(int x, int y) {
hitbox.x = x;
hitbox.y = y;
}
void update(GameObject const& object, Graphics &graphics) {
SDL_Color color = { .r = 0, .g = 255, .b = 0, .a = 255};
graphics.drawRect(hitbox, color);
}
private:
SDL_FRect hitbox = {
.x = 40,
.y = 40,
.w = 300,
.h = 300,
};
};