Sprite.cpp
Sprite.cpp
CPP1/* Copyright Statement:2 *3 * (C) 2021-2024 Cubios Inc. All rights reserved.4 */5#include "Sprite.h"6#include "Screen.h"78namespace Cubios9{10namespace Gfx11{12Sprite::Sprite(std::string name)13{14 this->Color.Set(255,0,255);15 this->resourceId = Cubios::GFX_getAssetId(name.c_str());16}1718Sprite::Sprite(std::string name, const Cubios::Math::Transform& t)19{20 this->Transform = t;21 this->Color.Set(255,0,255);22 this->resourceId = Cubios::GFX_getAssetId(name.c_str());23}2425Sprite::Sprite(std::string name, float x, float y)26{27 this->Transform.Position.X = x;28 this->Transform.Position.Y = y;29 this->Color.Set(255,0,255);3031 this->resourceId = Cubios::GFX_getAssetId(name.c_str());32}3334Sprite::Sprite(const Sprite& sprite)35{36 this->Transform = sprite.Transform;37 this->resourceId = sprite.resourceId;38 this->Color = sprite.Color;39}4041Sprite::~Sprite() {}4243void Sprite::Render()44{45 Math::Vec2 pos = this->ScreenPosition();46 Cubios::GFX_drawImage(resourceId, pos.X, pos.Y, Color.A(), Color.Value(),Transform.ScaleX, Transform.ScaleY, Transform.SafeRotation()+ScreenAngle, Transform.Mirroring);47}48}49}50
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.