home *** CD-ROM | disk | FTP | other *** search
-
- /* IPAS 3 Mouse usage demo by Tom Hudson 5/11/94 */
-
- /* Displays mouse coordinates and button status until ALT key is pressed */
-
- #include <stdio.h>
- #include <math.h>
- #include <stdlib.h>
- #include "pxp.h"
-
- /* Variable definitions */
-
- /************************/
-
- /* Dialog description */
-
- DlgEntry cdialog[]={
- 0,NULL
- };
-
- /* Version test value */
-
- #define VERSION 0x0000
-
- typedef struct {
- ulong version;
- } State;
-
- /* the "state" struct MUST start with a "ulong" which is the version#,
- to prevent using data from old versions of this program.
- This verification is performed automatically. */
-
- static State init_state = { VERSION };
- static State state = { VERSION };
-
- /*----------------------------------------------------------------*/
-
- int ClientUsesInitDialog(void) {
- return(0);
- }
-
- void ClientSetStateVar(int id, void *ptr) {
- OVL o;
- ulong *ul;
- char *s;
-
- ul=(ulong *)ptr;
- s=(char *)ptr;
- o.ul = *ul;
- switch(id) {
- }
- }
-
- ulong ClientGetStateVar(int id) {
- OVL o;
- switch(id) {
- }
- return(o.ul);
- }
-
- int ClientVarSize(int id)
- {
- switch(id)
- {
- default:
- return(1);
- }
- }
-
- char *ClientGetState(int *size) {
- *size = sizeof(State);
- return((char *)&state);
- }
-
- void ClientResetState() {
- state = init_state;
- }
-
- void ClientStartup(EXPbuf *buf) {
- do_mouse_test();
- buf->opcode=buf->usercode=EXP_TERMINATE;
- }
-
- /* User routines -- use user codes to process your data */
-
- void ClientUserCode(EXPbuf *buf)
- {
- switch(buf->usercode)
- {
- default:
- terminate:
- buf->opcode=buf->usercode=EXP_TERMINATE;
- buf->status=0;
- break;
- }
- }
-
- void ClientTerminate(void) {
- /* free any data structures, etc. */
- }
-
- DlgEntry *ClientDialog(int n) {
- return(&cdialog[n]);
- }
-
- /* Format your floating-point strings */
-
- void
- ClientFormatString(int id,float value,char *string)
- {
- switch(id)
- {
- }
- }
-
- /* This function should return 1 if the PXP can function in any module, */
- /* otherwise, it should return 0. */
-
- int
- ClientIsUniversal(void)
- {
- return(1);
- }
-
- do_mouse_test()
- {
- while(1)
- {
- int state;
- gfx_wait_input();
- sprintf(gp_buffer,"[%04d %04d %c %c] Press ALT to exit",
- GC->mouse_x,GC->mouse_y,
- (GC->mouse_button & 1)?'L':' ',(GC->mouse_button & 2)?'R':' ');
- gfx_2text(gp_buffer,0,0,WHITE,BLACK);
- gfx_kstate(state);
- if(state & 8)
- break;
- }
- gfx_redraw();
- }
-