Updated to support propper video scaling
This commit is contained in:
parent
8581e53373
commit
de0686edb7
22
src/video.c
22
src/video.c
@ -6,6 +6,7 @@
|
|||||||
#define LOWCOLOR 96
|
#define LOWCOLOR 96
|
||||||
|
|
||||||
extern float displayScale;
|
extern float displayScale;
|
||||||
|
extern uint8_t randomize;
|
||||||
|
|
||||||
/* Public Variables */
|
/* Public Variables */
|
||||||
int8_t videoModified;
|
int8_t videoModified;
|
||||||
@ -50,9 +51,10 @@ void initVideo(){
|
|||||||
videoMode = 0x01;
|
videoMode = 0x01;
|
||||||
updatePalette();
|
updatePalette();
|
||||||
|
|
||||||
/* Fill VRAM with random values, just for fun */
|
if (randomize) {
|
||||||
for (int i = 0; i < 0x8000; i++) videoMemory[i] = rand();
|
for (int i = 0; i < 0x8000; i++) videoMemory[i] = rand();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void writeVideo(){
|
void writeVideo(){
|
||||||
videoMemory[videoX + (videoY * 128)] = videoA;
|
videoMemory[videoX + (videoY * 128)] = videoA;
|
||||||
@ -86,26 +88,16 @@ void setPixels(uint8_t x, uint8_t y){
|
|||||||
videoColorValue = videoMemory[(y * 128) + (x | 0x40)];
|
videoColorValue = videoMemory[(y * 128) + (x | 0x40)];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Snipping out the upper 8 colors
|
|
||||||
// videoColorValue &= 0x77;
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 8; i++){
|
for (uint8_t i = 0; i < 8; i++){
|
||||||
if (displayScale == 1){
|
renderMemory[(y * SDL_X_SIZE) + ((x * 8) + i)] =
|
||||||
renderMemory[(y * SDL_X_SIZE) + ((x * 8) + i)] = (videoValue & (128 >> i)) ? videoColorIndex[((videoColorValue & 0xF0) >> 4)] : videoColorIndex[(videoColorValue & 0x0F)];
|
(videoValue & (128 >> i)) ?
|
||||||
} else {
|
videoColorIndex[((videoColorValue & 0xF0) >> 4)] :
|
||||||
for (uint8_t _x = 0; _x < displayScale; _x++){
|
videoColorIndex[(videoColorValue & 0x0F)];
|
||||||
for (uint8_t _y = 0; _y < displayScale; _y++){
|
|
||||||
renderMemory[(((y * (int)displayScale) + _y) * SDL_X_SIZE) + ((((x * (int)displayScale) * 8) + (i * (int)displayScale)) + _x)] = (videoValue & (128 >> i)) ? videoColorIndex[((videoColorValue & 0xF0) >> 4)] : videoColorIndex[(videoColorValue & 0x0F)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateVideo(){
|
void updateVideo(){
|
||||||
if (videoModified){
|
if (videoModified){
|
||||||
//sfVertexArray_clear(renderArray);
|
|
||||||
|
|
||||||
for (uint16_t y = 0; y < 256; y++){
|
for (uint16_t y = 0; y < 256; y++){
|
||||||
for (uint8_t x = 0; x < 48; x++){
|
for (uint8_t x = 0; x < 48; x++){
|
||||||
setPixels(x, (uint8_t)y);
|
setPixels(x, (uint8_t)y);
|
||||||
|
Loading…
Reference in New Issue
Block a user