dos-vga-arena-shooter-game/system/vga.h

69 lines
1.2 KiB
C
Raw Normal View History

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;
};
2024-02-24 12:36:18 +00:00
struct CompiledSpriteRender {
void (*code)(byte *);
int x;
int y;
unsigned int width;
unsigned int height;
int offsetX;
int offsetY;
2024-02-24 12:36:18 +00:00
};
2024-02-20 11:48:12 +00:00
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-24 12:36:18 +00:00
void drawCompiledSprite(struct CompiledSpriteRender *compiledSprite);
2024-02-15 13:34:50 +00:00
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);
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