//
// Created by bruno on 17.2.2025.
//

#ifndef RISCB_SWITCHES_H
#define RISCB_SWITCHES_H

#include <SDL_rect.h>
#include <SDL_render.h>
#include <stdlib.h>

typedef struct {
    uint16_t value;
    uint16_t oldValue;
    SDL_Rect *rect;
    SDL_Rect *outRect;
    SDL_Texture *texture;
    SDL_Rect rects[16];
    SDL_Rect outRects[16];
} Switches;

void render_switch_matrix(SDL_Renderer *renderer, Switches *switches);

void update_switches_texture(SDL_Renderer *renderer, Switches *display);

void toggle_switch(SDL_Rect rect, Switches *switches);

void init_switches(Switches *switches, SDL_Renderer *renderer, int x, int y, int width, int height);

void render_switches_segment(Switches *display, SDL_Renderer *renderer);

void destroy_switches_segment(Switches *switches);

#endif //RISCB_SWITCHES_H
