2024-02-15 01:15:55 +00:00
|
|
|
#ifndef __VGA_H__
|
|
|
|
#define __VGA_H__
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
|
2024-02-20 13:00:13 +00:00
|
|
|
#include "../types.h"
|
|
|
|
#include "../bmpload.h"
|
2024-02-15 13:34:50 +00:00
|
|
|
|
2024-02-15 01:15:55 +00:00
|
|
|
#define VGA_DISPLAY_WIDTH (320)
|
|
|
|
#define VGA_DISPLAY_HEIGHT (200)
|
|
|
|
|
|
|
|
struct VGAColor {
|
|
|
|
byte red;
|
|
|
|
byte green;
|
|
|
|
byte blue;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpriteRender {
|
|
|
|
byte* data;
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
unsigned int width;
|
|
|
|
unsigned int height;
|
|
|
|
int transparentColor;
|
|
|
|
unsigned int modulo;
|
2024-02-20 11:48:12 +00:00
|
|
|
|
|
|
|
int offsetX;
|
|
|
|
int offsetY;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SpriteBounds {
|
|
|
|
int top;
|
|
|
|
int right;
|
|
|
|
int bottom;
|
|
|
|
int left;
|
2024-02-15 01:15:55 +00:00
|
|
|
};
|
|
|
|
|
2024-02-20 17:39:28 +00:00
|
|
|
void drawPixel(int x, int y, int color);
|
|
|
|
|
2024-02-15 01:15:55 +00:00
|
|
|
void drawSprite(struct SpriteRender *sprite);
|
2024-02-15 13:34:50 +00:00
|
|
|
void buildSpriteFromSpritesheet(struct BMPImage*, struct SpriteRender*, int, int, int, int);
|
2024-02-20 11:48:12 +00:00
|
|
|
void getSpriteBounds(struct SpriteRender *sprite, struct SpriteBounds *bounds);
|
2024-02-15 01:15:55 +00:00
|
|
|
|
2024-02-15 13:34:50 +00:00
|
|
|
byte *initializeDrawBuffer();
|
|
|
|
byte *getDrawBuffer();
|
2024-02-15 01:15:55 +00:00
|
|
|
void freeDrawBuffer();
|
2024-02-15 13:34:50 +00:00
|
|
|
void copyDrawBufferToDisplay();
|
2024-02-15 01:15:55 +00:00
|
|
|
|
2024-02-15 13:34:50 +00:00
|
|
|
void setVGAColors(struct VGAColor[], int);
|
2024-02-15 01:15:55 +00:00
|
|
|
|
|
|
|
#endif
|