8 Color default_color = { 255, 255, 255, 255 };
10 Color color = { 255, 255, 255, 255 };
26 void init()
override {
30 void update(
float deltaTime)
override {
40 glm::vec2 size((
float)transform->size.x, (
float)transform->size.y);
41 batch.
draw(v_index, size, transform->bodyCenter, transform->rotation, color);
44 void setColor(
Color clr) {
49 void SetFlashAnimation(
int idX,
int idY,
size_t fr,
float sp,
const Animation::animType type,
const std::vector<float>& flashTimes,
Color flashC,
int reps = 0)
51 flash_animation =
FlashAnimation(idX, idY, fr, sp, type, flashTimes, flashC, reps);
54 void setFlashFrame() {
55 float t = this->flash_animation.interpolation_a;
56 this->color = Color::fromVec4(glm::mix(default_color.toVec4(), this->flash_animation.flashColor.toVec4(), t));
62 std::string GetComponentName()
override {
63 return "Rectangle_w_Color";
66 void showGUI()
override {
69 ImVec4 a_color = ImVec4(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f, color.a / 255.0f);
70 if(ImGui::ColorPicker4(
"Color", (
float*)&a_color)) {
72 (GLubyte)(a_color.x * 255),
73 (GLubyte)(a_color.y * 255),
74 (GLubyte)(a_color.z * 255),
75 (GLubyte)(a_color.w * 255)
void draw(size_t v_index, const glm::vec2 &rectSize, const glm::vec3 &bodyCenter, const glm::vec3 &mRotation, const Color &color)
draws are needed to convert the pos and size to vertices
Definition PlaneColorRenderer.cpp:72