mirror of
https://github.com/fruit-bat/pico-zxspectrum.git
synced 2025-04-19 00:04:01 +03:00
bobvgalcd
This commit is contained in:
parent
099bf06895
commit
2e2d56cc32
@ -38,23 +38,27 @@ PicoOnScreenKeyboard::PicoOnScreenKeyboard(
|
||||
});
|
||||
|
||||
onPaint([=](PicoPen *pen) {
|
||||
pen->printAt(0, 0, false, getKeyboardLine(0));
|
||||
pen->printAt(1, 2, false, getKeyboardLine(1));
|
||||
pen->printAt(2, 4, false, getKeyboardLine(2));
|
||||
pen->printAt(0, 6, false, getKeyboardLine(3));
|
||||
});
|
||||
if (ww() > 42) {
|
||||
paintRow(pen, 0, 0);
|
||||
paintRow(pen, 1, 1);
|
||||
paintRow(pen, 2, 2);
|
||||
paintRow(pen, 0, 3);
|
||||
}
|
||||
else {
|
||||
paintRow(pen, 0, 0);
|
||||
paintRow(pen, 0, 1);
|
||||
paintRow(pen, 0, 2);
|
||||
paintRow(pen, 0, 3);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const char* PicoOnScreenKeyboard::getKeyboardLine(uint8_t which) {
|
||||
|
||||
int Pos=0;
|
||||
for (int i=0; i < 10; i++) {
|
||||
Pos+=sprintf(Buff+Pos," %s",Line[which][i].Name);
|
||||
void PicoOnScreenKeyboard::paintRow(PicoPen *pen, int32_t ox, uint8_t r) {
|
||||
const int32_t y = r << 1;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
const bool c = r == _y && i == _x;
|
||||
if (c) pen->setAttrInverse(true);
|
||||
pen->printAt(ox + (i << 2), y, false, Line[r][i].Name);
|
||||
if (c) pen->setAttrInverse(false);
|
||||
}
|
||||
//Selected symbol
|
||||
if(which==_y) {
|
||||
Buff[_x*4]='[';
|
||||
Buff[_x*4+4]=']';
|
||||
}
|
||||
return Buff;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ class PicoOnScreenKeyboard : public PicoWin {
|
||||
|
||||
int8_t _x=0;
|
||||
int8_t _y=0;
|
||||
char Buff[52];
|
||||
|
||||
#define BIT0 0x01
|
||||
#define BIT1 0x02
|
||||
@ -80,12 +79,6 @@ const ZxSpectrumKey Line[4][10]={
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
const uint8_t Line[4][10]={{'1','2','3','4','5','6','7','8','9','0'},
|
||||
{'Q','W','E','R','T','Y','U','I','O','P'},
|
||||
{'A','S','D','F','G','H','J','K','L','<'},
|
||||
{'*','Z','X','C','V','B','N','M','*','_'}};
|
||||
*/
|
||||
public:
|
||||
PicoOnScreenKeyboard(int32_t x, int32_t y, int32_t w,int32_t h);
|
||||
|
||||
@ -95,5 +88,5 @@ public:
|
||||
_press = press;
|
||||
}
|
||||
|
||||
const char* getKeyboardLine(uint8_t which);
|
||||
void paintRow(PicoPen *pen, int32_t ox, uint8_t r);
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ static const char *fext(const char *filename) {
|
||||
return dot + 1;
|
||||
}
|
||||
|
||||
void ZxSpectrumMenu::setWizLayout(int32_t margin, int32_t cols1, int32_t cols2) {
|
||||
void ZxSpectrumMenu::setWizLayout(int32_t margin, int32_t cols1, int32_t cols2, int32_t w) {
|
||||
_wizCol1Width = cols1;
|
||||
_wizCol2Width = cols2;
|
||||
_wizLeftMargin = margin;
|
||||
@ -76,6 +76,7 @@ void ZxSpectrumMenu::setWizLayout(int32_t margin, int32_t cols1, int32_t cols2)
|
||||
_mouse.move(0, 0, _wizCols, _mouse.wh());
|
||||
_devices.move(0, 2, _wizCols, _devices.wh());
|
||||
_tzxSelect.move(0, 0, _wizCols, _tzxSelect.wh());
|
||||
_keyboard.move(0 , 0, w, 10),
|
||||
repaint();
|
||||
}
|
||||
|
||||
@ -138,7 +139,7 @@ ZxSpectrumMenu::ZxSpectrumMenu(
|
||||
_systemBootSelOp("Boot select"),
|
||||
|
||||
_volume(0, 0, 16, 16),
|
||||
_keyboard(((SZ_FRAME_COLS-54)/2)-2 , 0, 52, 30),
|
||||
_keyboard(((SZ_FRAME_COLS-44)/2)-2 , 0, 52, 10),
|
||||
|
||||
_devices(0, 2, _wizCols, 2),
|
||||
|
||||
|
@ -131,7 +131,7 @@ public:
|
||||
void nextSnap(int d);
|
||||
void quickSave(int slot);
|
||||
void quickLoad(int slot);
|
||||
void setWizLayout(int32_t margin, int32_t cols1, int32_t cols2);
|
||||
void setWizLayout(int32_t margin, int32_t cols1, int32_t cols2, int32_t w);
|
||||
void initialise();
|
||||
void saveSettings();
|
||||
void loadSettings();
|
||||
|
@ -232,7 +232,7 @@ void __not_in_flash_func(core1_main)() {
|
||||
#endif
|
||||
|
||||
picoRootWin.move(0,0,40,30);
|
||||
picoRootWin.setWizLayout(0, 12, 18);
|
||||
picoRootWin.setWizLayout(0, 12, 18, 40);
|
||||
|
||||
// Start up the LCD
|
||||
st7789_init(pio, sm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user