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

52 lines
1.1 KiB
C

#ifndef __VGA_H__
#define __VGA_H__
#include "types.h"
#include <time.h>
#define PLANE_PIXEL_DISTANCE (4)
#define VGA_DISPLAY_WIDTH (320)
#define VGA_DISPLAY_HEIGHT (200)
#define VGA_UNCHAINED_LINE_WIDTH (VGA_DISPLAY_WIDTH / PLANE_PIXEL_DISTANCE)
// there are four of these in a row
#define PAGE_SIZE (VGA_DISPLAY_WIDTH*VGA_DISPLAY_HEIGHT/4)
#define SCRATCH_PAGE (PAGE_SIZE * 2)
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;
};
extern clock_t startTime, endTime;
void enableUnchainedVGAMode();
void enable320x256VGAMode();
void setVGAColors(struct VGAColor[], int);
void copyUnchainedMemoryToActive();
void copyScratchPlanesToActive();
void copyScratchPlanesToActiveViaLatches();
void drawSprite(struct SpriteRender *sprite);
void swapPlanes();
void setActiveVGAMemoryPlanes(int);
void clearWithColor(byte);
void initializeDrawBuffer();
void freeDrawBuffer();
void drawBufferToUnchainedMemory();
byte *getDrawBuffer();
#endif