module world.rigid; import world.world_object; import world.screen; import raylib; import std.conv; class Rigid : WorldObject { Texture2D sprite; override void render(float) { if(IsTextureReady(sprite)){ // Get position int drawX = to!int(Screen.px_width*(position.x + hitbox.x - Screen.x)/Screen.width); int drawY = to!int(Screen.px_height*(position.y + hitbox.y - Screen.y)/Screen.height); float scale = Screen.px_height/Screen.height; // Culling if(drawX > Screen.width || drawX + sprite.width*scale < 0) return; if(drawY > Screen.height || drawY + sprite.height*scale < 0) return; DrawTextureEx(sprite, Vector2(drawX, drawY), 0, scale, Colors.WHITE); } } }