implement touch. add one pixel to window X.
This commit is contained in:
parent
a7bbae82e0
commit
f865bef335
35
screen.c
35
screen.c
|
@ -15,6 +15,7 @@
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
#include "touch.h"
|
||||||
|
|
||||||
#define true 1
|
#define true 1
|
||||||
#define false 0
|
#define false 0
|
||||||
|
@ -109,7 +110,7 @@ void screen_init(void)
|
||||||
|
|
||||||
screenRect=qd.screenBits.bounds;
|
screenRect=qd.screenBits.bounds;
|
||||||
windowRect.left=0;
|
windowRect.left=0;
|
||||||
windowRect.right=511;
|
windowRect.right=512;
|
||||||
|
|
||||||
/* Set window size depending on screen size. */
|
/* Set window size depending on screen size. */
|
||||||
if (screenRect.bottom < 468)
|
if (screenRect.bottom < 468)
|
||||||
|
@ -198,6 +199,32 @@ void screen_menu_command(long menu_command)
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* screen_handle_touch(where) - Handle touch events
|
||||||
|
*/
|
||||||
|
void screen_handle_touch(Point* where)
|
||||||
|
{
|
||||||
|
padPt temp;
|
||||||
|
SetPort(win);
|
||||||
|
GlobalToLocal(where);
|
||||||
|
temp.x = ((long)where->h * PLATOSize.x) / windowWidth;
|
||||||
|
temp.y = (PLATOSize.y - 1) - (((long)where->v * PLATOSize.y) /
|
||||||
|
windowHeight);
|
||||||
|
|
||||||
|
touch_main(&temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* screen_show_cursor - Hide mouse cursor
|
||||||
|
*/
|
||||||
|
void screen_show_cursor(padBool show)
|
||||||
|
{
|
||||||
|
if (show==padT)
|
||||||
|
ShowCursor();
|
||||||
|
else if (show==padF)
|
||||||
|
ObscureCursor();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* screen_main(void)
|
* screen_main(void)
|
||||||
*/
|
*/
|
||||||
|
@ -224,7 +251,10 @@ void screen_main(void)
|
||||||
screen_menu_command(MenuSelect(theEvent.where));
|
screen_menu_command(MenuSelect(theEvent.where));
|
||||||
break;
|
break;
|
||||||
case inContent:
|
case inContent:
|
||||||
SelectWindow(currentWindow);
|
if (FrontWindow()!=currentWindow)
|
||||||
|
SelectWindow(currentWindow);
|
||||||
|
else
|
||||||
|
screen_handle_touch(&theEvent.where);
|
||||||
break;
|
break;
|
||||||
case inSysWindow:
|
case inSysWindow:
|
||||||
SystemClick(&theEvent,currentWindow);
|
SystemClick(&theEvent,currentWindow);
|
||||||
|
@ -232,6 +262,7 @@ void screen_main(void)
|
||||||
}
|
}
|
||||||
case keyDown:
|
case keyDown:
|
||||||
case autoKey:
|
case autoKey:
|
||||||
|
screen_show_cursor(padF);
|
||||||
keyboard_main(&theEvent);
|
keyboard_main(&theEvent);
|
||||||
break;
|
break;
|
||||||
case updateEvt:
|
case updateEvt:
|
||||||
|
|
4
screen.h
4
screen.h
|
@ -27,6 +27,10 @@ void screen_update_menus(void);
|
||||||
*/
|
*/
|
||||||
void screen_menu_command(long menu_command);
|
void screen_menu_command(long menu_command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* screen_show_cursor - Hide mouse cursor
|
||||||
|
*/
|
||||||
|
void screen_show_cursor(padBool show);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* screen_main(void)
|
* screen_main(void)
|
||||||
|
|
14
touch.c
14
touch.c
|
@ -21,14 +21,18 @@ void touch_init(void)
|
||||||
*/
|
*/
|
||||||
void touch_allow(padBool allow)
|
void touch_allow(padBool allow)
|
||||||
{
|
{
|
||||||
|
isAllowed=allow;
|
||||||
|
if (isAllowed==padT)
|
||||||
|
screen_show_cursor(padT);
|
||||||
|
else
|
||||||
|
screen_show_cursor(padF);
|
||||||
}
|
}
|
||||||
|
|
||||||
padBool touch_lmb(void)
|
void touch_main(padPt* Coord)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void touch_main(void)
|
|
||||||
{
|
{
|
||||||
|
if (isAllowed==padF)
|
||||||
|
return;
|
||||||
|
Touch(Coord);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue