cool-bun-demo/screen.h

51 lines
945 B
C
Raw Normal View History

2024-05-02 16:52:06 +00:00
#ifndef __SCREEN_H__
#define __SCREEN_H__
#include "types.h"
2024-05-28 12:02:28 +00:00
#define SCREEN_WIDTH (320)
#define SCREEN_HEIGHT (256)
2024-05-02 16:52:06 +00:00
struct ScreenSetup {
2024-05-28 12:02:28 +00:00
// human entered
uint16_t width;
uint16_t height;
2024-05-02 16:52:06 +00:00
short int bitplanes;
2024-05-28 12:02:28 +00:00
// calculated
unsigned char *memoryStart;
uint16_t byteWidth;
uint16_t nextBitplaneAdvance;
uint16_t nextBufferAdvance;
2024-05-27 20:50:56 +00:00
};
2024-05-02 16:52:06 +00:00
2024-05-28 12:02:28 +00:00
struct CurrentScreen {
uint16_t currentBuffer;
unsigned char *planes[8];
};
2024-05-02 16:52:06 +00:00
2024-05-28 12:02:28 +00:00
void setupScreen(
2024-05-02 16:52:06 +00:00
struct ScreenSetup *screenSetup,
uint16_t width,
uint16_t height,
uint8_t bitplanes
);
2024-05-28 12:02:28 +00:00
void teardownScreen(struct ScreenSetup *screenSetup);
2024-05-02 16:52:06 +00:00
2024-05-28 12:02:28 +00:00
void setCurrentScreen(
struct ScreenSetup *screenSetup,
struct CurrentScreen *currentScreen,
short int buffer
);
2024-06-01 11:42:11 +00:00
void swapCurrentScreenBuffer(
struct ScreenSetup *screenSetup,
struct CurrentScreen *currentScreen
);
void setupInitialCurrentScreen(
struct ScreenSetup *screenSetup,
struct CurrentScreen *currentScreen
);
2024-05-02 16:52:06 +00:00
#endif