30 lines
565 B
C
30 lines
565 B
C
|
//
|
||
|
// Created by william on 16/05/24.
|
||
|
//
|
||
|
|
||
|
#ifndef NES_EMULATOR_CANVAS_H
|
||
|
#define NES_EMULATOR_CANVAS_H
|
||
|
|
||
|
#include "../include/types.h"
|
||
|
|
||
|
#define CANVAS_WIDTH 256
|
||
|
#define CANVAS_HEIGHT 240
|
||
|
#define CANVAS_PIXEL_COUNT (CANVAS_WIDTH * CANVAS_HEIGHT)
|
||
|
|
||
|
#define CANVAS_INDEX(x, y) (y * CANVAS_WIDTH + x)
|
||
|
|
||
|
typedef struct pixel {
|
||
|
byte r;
|
||
|
byte g;
|
||
|
byte b;
|
||
|
} Pixel;
|
||
|
|
||
|
typedef struct canvas {
|
||
|
Pixel pixels[CANVAS_PIXEL_COUNT];
|
||
|
} Canvas;
|
||
|
|
||
|
void canvas_draw(Canvas *canvas, Pixel pixel, int x, int y);
|
||
|
void canvas_reset(Canvas *canvas);
|
||
|
|
||
|
#endif //NES_EMULATOR_CANVAS_H
|