Here is my code:
#include "../Kernel/system.h"
#include "../Drivers/vga.h"
#include "../Graphics/double_buffer.h"
int gameRunning = 0;
int it = 0;
Code: Select all
void mainLoop() {
wait(16);
clearBuffer();
unsigned int c = 0xffffff;
// plotPixle(3, 30, c);
// plotPixle(4, 30, c);
// plotPixle(5, 30, c);
// plotPixle(6, 30, c);
// plotPixle(7, 30, c);
// drawRectangleBuffer(10+it, 30, 30, 40, c);
swapBuffers();
it = it + 1;
mainLoop();
//gameRunning = 0;
}
// Handle a keypress
void pongHandler(char c) {
drawRectangleBuffer(10, 30, 30, 40, c);
swapBuffers();
}
void loadPong() {
changeProcess("pong");
gameRunning = 1;
mainLoop();
}
wait(ms) halts the cpu for however many ms specified
drawRectangleBuffer() Draws a rectangle to the backbuffer
swapBuffers() Swaps the backbuffer with video memory
changeProcess() Changes where a keyboard input will go. In this case, it goes to pongHandler().
It works when it's not in a loop. Any solutions to this problem?
EDIT: No interrupts are being called while in the loop.