2023-10-29 20:03:23 +03:00
|
|
|
#ifndef __SCREEN_H__
|
|
|
|
#define __SCREEN_H__
|
|
|
|
|
2023-11-30 17:52:46 +03:00
|
|
|
#include <string.h>
|
|
|
|
|
2023-10-30 02:36:03 +03:00
|
|
|
typedef char Point;
|
2023-10-29 20:03:23 +03:00
|
|
|
typedef struct screen_t
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
int height;
|
2023-10-30 02:36:03 +03:00
|
|
|
Point *screen;
|
2023-10-29 20:03:23 +03:00
|
|
|
} Screen;
|
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
void screenCreate(Screen *buffer, int width, int height, Point fill_value);
|
|
|
|
void screenShow(Screen screen);
|
2023-11-30 17:52:46 +03:00
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
static inline Point *screenGetPoint(Screen screen, int x, int y)
|
2023-11-30 17:52:46 +03:00
|
|
|
{
|
2023-12-09 00:35:49 +03:00
|
|
|
return screen.screen + x + (y * screen.width);
|
2023-11-30 17:52:46 +03:00
|
|
|
}
|
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
static inline void screenSet(Screen screen, Point fill_value)
|
2023-11-30 17:52:46 +03:00
|
|
|
{
|
2023-12-09 00:35:49 +03:00
|
|
|
memset(screen.screen, fill_value, screen.width * screen.height * sizeof(char));
|
2023-11-30 17:52:46 +03:00
|
|
|
}
|
|
|
|
|
2023-10-29 20:03:23 +03:00
|
|
|
|
|
|
|
#endif /* __SCREEN_H__ */
|