2024-06-16 19:22:40 -04:00
|
|
|
//
|
|
|
|
// Created by william on 6/14/24.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef NES_EMULATOR_PATTERN_WINDOW_H
|
|
|
|
#define NES_EMULATOR_PATTERN_WINDOW_H
|
|
|
|
|
|
|
|
#include "../include/types.h"
|
2024-09-01 15:54:41 -04:00
|
|
|
#include "components/window.h"
|
2024-06-16 19:22:40 -04:00
|
|
|
|
2024-07-23 18:50:11 -04:00
|
|
|
#define PW_SCALE 2
|
2024-06-16 19:22:40 -04:00
|
|
|
#define PW_ROW_TILE_COUNT 16
|
2024-08-06 17:30:57 -04:00
|
|
|
#define PW_PALETTE_MAX 3
|
2024-06-16 19:22:40 -04:00
|
|
|
|
|
|
|
typedef struct nes_pattern_window {
|
2024-09-01 15:54:41 -04:00
|
|
|
Window window;
|
2024-07-21 16:41:38 -04:00
|
|
|
SDL_Texture *texture;
|
2024-08-06 17:30:57 -04:00
|
|
|
byte palette;
|
2024-10-03 19:24:03 -04:00
|
|
|
} PatternWindow;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a pattern window instance.
|
|
|
|
* @return A reference to the created window instance
|
|
|
|
*/
|
|
|
|
PatternWindow *pattern_window_create(int *window_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroys a pattern window instance.
|
|
|
|
* @param window A reference to the window to destroy
|
|
|
|
*/
|
|
|
|
void pattern_window_destroy(PatternWindow *window);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the content of a pattern window with the current data from the ROM mapper.
|
|
|
|
* @param window A reference to the window to update
|
|
|
|
*/
|
|
|
|
void pattern_window_update(PatternWindow *window);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders a pattern window to the screen.
|
|
|
|
* @param window A reference to the window to render
|
|
|
|
*/
|
|
|
|
void pattern_window_render(PatternWindow *window);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends a key up event to a pattern window.
|
|
|
|
* @param window A reference to the window to send the event to
|
|
|
|
* @param keycode The code of the key of the event
|
|
|
|
*/
|
|
|
|
void pattern_window_key_up(PatternWindow *window, SDL_KeyCode keycode);
|
2024-06-16 19:22:40 -04:00
|
|
|
|
|
|
|
#endif //NES_EMULATOR_PATTERN_WINDOW_H
|