#include #include "static_body.h" #include "node.h" #include "window.h" StaticBody::StaticBody(float size_x, float size_y) : Node() { if (scene != nullptr) { size = Vec2(size_x, size_y); b_body_def.position.Set(world_position.x, world_position.y); b_body = scene->b_world->CreateBody(&b_body_def); b_shape.SetAsBox(size.x, size.y); b_body->CreateFixture(&b_shape, 0.0f); } else { Util::Log(ERROR, "Failed to initialize physics, scene is nullptr", __FILE__, __LINE__); } } StaticBody::~StaticBody() { } void StaticBody::Update() { // Call Baseclass update Node::Update(); // Call logic updates here // Call Render for graphical elements Render(); } void StaticBody::Render() { printf("Called static_body render\n"); SDL_Color color = {100, 100, 100}; Vec2 position_offset = (world_position + local_position); printf("{%f,%f}\n", position_offset.x, position_offset.y); GPU_Rectangle(Window::window_target, position_offset.x, position_offset.y, position_offset.x + 10, position_offset.y + 10, color); }