Changed keyboard register to mem map
This commit is contained in:
parent
59c3b0d640
commit
a5e914de4b
@ -2,10 +2,10 @@
|
|||||||
#include <SFML/Window.h>
|
#include <SFML/Window.h>
|
||||||
|
|
||||||
extern uint8_t systemRegister;
|
extern uint8_t systemRegister;
|
||||||
|
extern uint8_t keyboardResult;
|
||||||
|
extern sfKeyCode currentKey;
|
||||||
|
|
||||||
static uint8_t keyboardResult;
|
const static sfKeyCode scanMatrix[48] = {
|
||||||
|
|
||||||
static sfKeyCode scanMatrix[48] = {
|
|
||||||
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
|
sfKeyNum1, sfKeyNum2, sfKeyNum3, sfKeyNum4, sfKeyNum5, sfKeyNum6, sfKeyNum7, sfKeyNum8,
|
||||||
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
|
sfKeyQ, sfKeyW, sfKeyE, sfKeyR, sfKeyT, sfKeyY, sfKeyU, sfKeyI,
|
||||||
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
|
sfKeyA, sfKeyS, sfKeyD, sfKeyF, sfKeyG, sfKeyH, sfKeyJ, sfKeyK,
|
||||||
@ -15,11 +15,11 @@ static sfKeyCode scanMatrix[48] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void scanKeyboard(const sfKeyCode key){
|
void scanKeyboard(){
|
||||||
keyboardResult = 0;
|
keyboardResult = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
if (key == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){
|
if (currentKey == scanMatrix[i + (((systemRegister & 0x07) % 6) * 8)]){
|
||||||
keyboardResult |= (0x80 >> i);
|
keyboardResult |= (0x80 >> i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user