translate keyboard scancode
This commit is contained in:
@@ -25,6 +25,15 @@ void BasicRenderer::PutChar(char chr, unsigned int xOff, unsigned int yOff) {
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::PutChar(char chr) {
|
||||
PutChar(chr, cursorPosition.x, cursorPosition.y);
|
||||
cursorPosition.x += 8;
|
||||
if (cursorPosition.x + 8 > targetFramebuffer->Width) {
|
||||
cursorPosition.x = 0;
|
||||
cursorPosition.y += 16;
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::Print(const char* str) {
|
||||
unsigned int x = 0;
|
||||
char* chr = (char*)str;
|
||||
@@ -42,7 +51,7 @@ void BasicRenderer::Print(const char* str) {
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::Clear(uint32_t colour) {
|
||||
void BasicRenderer::Clear() {
|
||||
uint64_t fbBase = (uint64_t)targetFramebuffer->BaseAddress;
|
||||
uint64_t bytesPerScanline = targetFramebuffer->PixelsPerScanline * 4;
|
||||
uint64_t fbHeight = targetFramebuffer->Height;
|
||||
@@ -51,11 +60,39 @@ void BasicRenderer::Clear(uint32_t colour) {
|
||||
for (int verticalScanline = 0; verticalScanline < fbHeight; verticalScanline ++){
|
||||
uint64_t pixPtrBase = fbBase + (bytesPerScanline * verticalScanline);
|
||||
for (uint32_t* pixPtr = (uint32_t*)pixPtrBase; pixPtr < (uint32_t*)(pixPtrBase + bytesPerScanline); pixPtr ++){
|
||||
*pixPtr = colour;
|
||||
*pixPtr = ClearColour;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BasicRenderer::ClearChar(){
|
||||
|
||||
if (cursorPosition.x == 0){
|
||||
cursorPosition.x = targetFramebuffer->Width;
|
||||
cursorPosition.y -= 16;
|
||||
if (cursorPosition.y < 0) cursorPosition.y = 0;
|
||||
}
|
||||
|
||||
unsigned int xOff = cursorPosition.x;
|
||||
unsigned int yOff = cursorPosition.y;
|
||||
|
||||
unsigned int* pixPtr = (unsigned int*)targetFramebuffer->BaseAddress;
|
||||
for (unsigned long y = yOff; y < yOff + 16; y++){
|
||||
for (unsigned long x = xOff - 8; x < xOff; x++){
|
||||
*(unsigned int*)(pixPtr + x + (y * targetFramebuffer->PixelsPerScanline)) = ClearColour;
|
||||
}
|
||||
}
|
||||
|
||||
cursorPosition.x -= 8;
|
||||
|
||||
if (cursorPosition.x < 0){
|
||||
cursorPosition.x = targetFramebuffer->Width;
|
||||
cursorPosition.y -= 16;
|
||||
if (cursorPosition.y < 0) cursorPosition.y = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BasicRenderer::Next() {
|
||||
cursorPosition.x = 0;
|
||||
cursorPosition.y += 16;
|
||||
|
||||
Reference in New Issue
Block a user