#pragma once

#include "raylib.h"

#define MODE_CHIP8 0 // Chip-8 64x32
#define MODE_SCHIP 1 // Super-Chip 128x64 (not supported yet)

typedef struct SCREEN_DATA {
  int width, height;
  int originX;
  int originY;
  int pixel;
  char pixels[64*32];
} SCREEN_DATA;

/**
 * @brief Must be called first!
 * 
 * @param width 
 * @param height 
 */
void ScreenInit(int width, int height);

/**
 * @brief Clear the entire simulated screen
 * 
 */
void ScreenClear();

/**
 * @brief Set the pixel's state of the simulated screen (follow the chip-8 specification)
 * 
 * @param x 
 * @param y 
 * @param state 
 * @return char 1 if pixel was already on and 0 otherwise
 */
char ScreenPixelApply(int x, int y, unsigned char state);

/**
 * @brief Get simulated screen dimensions
 * 
 * @param width 
 * @param height 
 */
void ScreenWH(int *width, int *height);

/**
 * @brief Draw simulated screen instantly
 * 
 */
void ScreenUpdate();

/**
 * @brief Close screen (must be called before quit)
 * 
 */
void ScreenClose();
