70 lines
1.3 KiB
C
70 lines
1.3 KiB
C
#ifndef __VGA_H__
|
|
#define __VGA_H__
|
|
|
|
#include <time.h>
|
|
|
|
#include "../types.h"
|
|
#include "../bmpload.h"
|
|
|
|
#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;
|
|
|
|
int offsetX;
|
|
int offsetY;
|
|
};
|
|
|
|
struct CompiledSpriteRender {
|
|
void (*code)(byte *);
|
|
int x;
|
|
int y;
|
|
unsigned int width;
|
|
unsigned int height;
|
|
int offsetX;
|
|
int offsetY;
|
|
};
|
|
|
|
struct SpriteBounds {
|
|
int top;
|
|
int right;
|
|
int bottom;
|
|
int left;
|
|
};
|
|
|
|
void drawPixel(int x, int y, int color);
|
|
|
|
void drawSprite(struct SpriteRender *sprite);
|
|
void drawCompiledSprite(struct CompiledSpriteRender *compiledSprite);
|
|
void buildSpriteFromSpritesheet(struct BMPImage*, struct SpriteRender*, int, int, int, int);
|
|
void buildCompiledSprite(
|
|
void (*)(byte *),
|
|
struct CompiledSpriteRender*,
|
|
int width, int height,
|
|
int offsetX, int offsetY
|
|
);
|
|
void getSpriteBounds(struct CompiledSpriteRender *sprite, struct SpriteBounds *bounds);
|
|
|
|
byte *initializeDrawBuffer();
|
|
byte *getDrawBuffer();
|
|
void freeDrawBuffer();
|
|
void copyDrawBufferToDisplay();
|
|
|
|
void setVGAColors(struct VGAColor[], int);
|
|
void renderStringToDrawBuffer(char *, int color, int backgroundColor, int x, int y);
|
|
|
|
#endif
|