Files
libretro-atari800/libretro/vkbd.c
T
Pecusx c39dc2ab03 Third (final??) attemp at a new Virtual Keyboard (#75)
* Atari Console keys

Added: Help, Start, Select, Option and Reset keys.

* Atari TAB, RETURN and SPACE keys

* Return?

* Start, Option, Help and Emulator Menu buttons

* Help key on Pad

Added Atari Help key to joypad mapping.

* First try to new keyboard

* Shit on VKBD

* Control key handle

* Shift text UPPER when pressed

* Atari 8bit font

* Virtual Keyboard keys with Control

* Minor error

* 1st attemp to new vkbd layout

Virtual Keyoboard recreated. Added atari font, Ctrl and Shift funcionality.
Console buttons on second page.

* % and null character display on VKBD

* Revert "% and null character display on VKBD"

This reverts commit f4eb848f26.

* Displaying % and heart on VKBD - maybe...

* Set max key description lenght to 3

* Always display only 3 characters of key desc.

* Schift & Control status on VKBD

* Second page of VKBD

New second page.
New layout, atari cursor keys and F1-F4 now working.

* Minor mistake :)

* Correct atari F1-F4 handling

* Oooops... minor error

* Better keys handling

* Better Shift & Control indicators

* Much better Shift and Control colors :)

* Disable joystick input if Virtual Keyboard active

Only for testing

* Revert "Disable joystick input if Virtual Keyboard active"

This reverts commit 8b942c29e0.

* One page VKBD layout

Atari keyboard fits in one page!

* Atari del/Bk Sp properly handling

* VKBD opacity

Only for testing

* Keys names opacity

Test only

* Still testing VKBD opacity

* minor error

Still testing opacity

* Added VKbd opacity witch switch.

* Oppps...
2021-05-29 09:37:42 +02:00

96 lines
2.6 KiB
C

#include "libretro.h"
#include "retroscreen.h"
#include "libretro-core.h"
#include "vkbd_def.h"
#include "graph.h"
extern int NPAGE;
extern int KCOL;
extern int BKGCOLOR;
extern int SHIFTON;
extern int CTRLON;
void virtual_kdb(char *buffer,int vx,int vy)
{
int x, y, page;
unsigned coul;
#if defined PITCH && PITCH == 4
unsigned *pix=(unsigned*)buffer;
#else
unsigned short *pix=(unsigned short *)buffer;
#endif
page = (NPAGE == -1) ? 0 : NLIGN*NPLGN;
coul = RGB565(28, 28, 31);
BKGCOLOR = (KCOL>0?0xFF808080:0);
for(x=0;x<NPLGN;x++)
{
for(y=0;y<NLIGN;y++)
{
DrawBoxBmp((char*)pix,XBASE3+x*XSIDE,YBASE3+y*YSIDE, XSIDE,YSIDE, RGB565(7, 2, 1));
if (SHIFTON==1)
{
Draw_text((char*)pix,XBASE0-2+x*XSIDE ,YBASE0+YSIDE*y,coul, BKGCOLOR ,1, 1,3,MVk[(y*NPLGN)+x+page].shift);
}
else if (CTRLON==1)
{
Draw_text((char*)pix,XBASE0-2+x*XSIDE ,YBASE0+YSIDE*y,coul, BKGCOLOR ,1, 1,3,MVk[(y*NPLGN)+x+page].ctrl);
}
else
{
Draw_text((char*)pix,XBASE0-2+x*XSIDE ,YBASE0+YSIDE*y,coul, BKGCOLOR ,1, 1,3,MVk[(y*NPLGN)+x+page].norml);
}
}
}
// draw Shift and Control keys status
// Shift - position 0,4
if (SHIFTON==1)
{
Draw_text((char*)pix,XBASE0-2+0*XSIDE ,YBASE0+YSIDE*4,RGB565(2,2,31), BKGCOLOR ,1, 1,3,MVk[(4*NPLGN)+0+page].shift);
}
// Control - position 0,3
if (CTRLON==1)
{
Draw_text((char*)pix,XBASE0-2+0*XSIDE ,YBASE0+YSIDE*3,RGB565(2,2,31), BKGCOLOR ,1, 1,3,MVk[(3*NPLGN)+0+page].ctrl);
}
DrawBoxBmp((char*)pix,XBASE3+vx*XSIDE,YBASE3+vy*YSIDE, XSIDE,YSIDE, RGB565(31, 2, 1));
if (SHIFTON==1)
{
Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,1), BKGCOLOR ,1, 1,3,MVk[(vy*NPLGN)+vx+page].shift);
}
else if (CTRLON==1)
{
Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,1), BKGCOLOR ,1, 1,3,MVk[(vy*NPLGN)+vx+page].ctrl);
}
else
{
Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,1), BKGCOLOR ,1, 1,3,MVk[(vy*NPLGN)+vx+page].norml);
}
if (vx==0 && vy==4 && SHIFTON==1) // diferent Shift color if Shift is ON - position 0,4
{
Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,21), BKGCOLOR ,1, 1,3,MVk[(vy*NPLGN)+vx+page].shift);
}
if (vx==0 && vy==3 && CTRLON==1) // diferent Conrol color if Control is ON - position 0,3
{
Draw_text((char*)pix,XBASE0-2+vx*XSIDE ,YBASE0+YSIDE*vy,RGB565(2,31,21), BKGCOLOR ,1, 1,3,MVk[(vy*NPLGN)+vx+page].ctrl);
}
}
int check_vkey2(int x,int y)
{
int page;
//check which key is press
page= (NPAGE==-1) ? 0 : 5*NPLGN;
return MVk[y*NPLGN+x+page].val;
}