int TouchScreenControl(volatile unsigned int *pIsrFlag) { int xCoOd = 0, yCoOd = 0; int retVal = FALSE; do { if(TRUE == WaitForTouch(pIsrFlag)) /* Check if any coordinates are */ { ResolveCoordinates(&xCoOd, &yCoOd); if(TRUE == WasNextTouched(xCoOd, yCoOd)) { retVal = TRUE; break; } } }while(0 == *pIsrFlag); return retVal; }
/* ** This function initializes the touch screen and waits for a touch to happen. ** When the touch screen is pressed, it resolves the coordinates and checks if ** the 'Next' icon was touched. This function returns only if the 'Next' icon ** is touched. */ int TouchWaitProcess() { int xCoOd = 0, yCoOd = 0; /*Initializes the Touch Screen*/ InitTouchScreen(); while(1) { /* wait until touch is detected */ if(TRUE == WaitForTouch(&timerIsrFlag)) { ResolveCoordinates(&xCoOd, &yCoOd); if(TRUE == WasNextTouched(xCoOd, yCoOd)) { break; } } } return 0; }
void executeMapPress(Button theButton, int choice) { if (choice == 1 || choice == 2 || choice == 3) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; Object *o7; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); o7 = malloc(sizeof(Object)); buildObject(560, 70, 301, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: Kaiser Building", o, strlen("Name: Kaiser Building")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latitude = 49.2622103", o2, strlen("Latitude = 49.2622103")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 155, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude = -123.2501992", o3, strlen("Longitude = -123.2501992")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "2332 Main Mall V6T 1Z4", o4, strlen("2332 Main Mall V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Faculty of Electrical", o5, strlen("Faculty of Electrical")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "And Computer Engineering", o6, strlen("And Computer Engineering")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); buildObject(560, 348, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Offices of the Dean", o7, strlen("Offices of the Dean")); drawObject(o7); writeCaptionObjectLarge(o7, BLACK, WHITE); WaitForTouch(); free(o); free(o2); free(o3); free(o4); free(o5); free(o6); } else if (choice == 4 || choice == 5 || choice == 6) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); buildObject(560, 70, 301, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: MacLeod Building", o, strlen("Name: MacLeod Building")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latitude = 49.2617596", o2, strlen("Latitude = 49.2617596")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 158, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude = -123.2493528", o3, strlen("Longitude = -123.2493528")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "2356 Main Mall V6T 1Z4", o4, strlen("2356 Main Mall V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Electrical and Computer", o5, strlen("Electrical and Computer")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Engineering Building", o6, strlen("Engineering Building")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); WaitForTouch(); free(o); free(o2); } else if (choice == 10) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); buildObject(560, 70, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: The Cheeze Factory", o, strlen("Name: The Cheeze Factory")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latitude =49.26216059", o2, strlen("Latitude =49.26216059")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 158, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude = -123.249256100", o3, strlen("Longitude = -123.249256100")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "2335 Engineering Road V6T 1Z4", o4, strlen("2335 Engineering Road V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Dairy Products", o5, strlen("Dairy Products")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 325, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Manufacturing laboratory", o6, strlen("Manufacturing laboratory")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); WaitForTouch(); free(o); free(o2); } else if (choice == 11 || choice == 12) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; Object *o7; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); o7 = malloc(sizeof(Object)); buildObject(560, 70, 301, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: Brimacombe", o, strlen("Name: Brimacombe")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latidude = 49.261883399", o2, strlen("Latidude = 49.261883399 ")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 158, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude =-123.24831760", o3, strlen("Longitude =-123.24831760")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "2355 East Mall V6T 1Z4", o4, strlen("2355 East Mall V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Advanced Materials ", o5, strlen("Advanced Materials ")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "And Process Engineering", o6, strlen("And Process Engineering")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); buildObject(560, 348, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Laboratory", o7, strlen("Laboratory")); drawObject(o7); writeCaptionObjectLarge(o7, BLACK, WHITE); WaitForTouch(); free(o); free(o2); } else if (choice == 7 || choice == 8 || choice == 9) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); buildObject(560, 70, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: CEME", o, strlen("Name: CEME")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latitude = 49.2626097", o2, strlen("Latitude = 49.2626097")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 158, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude = -123.249115899", o3, strlen("Longitude = -123.249256100")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "6250 Applied Science Lane V6T 1Z4", o4, strlen("6250 Applied Science Lane V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Civil And Mechanical", o5, strlen("Civil And Mechanical")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 365, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Engineering Building", o6, strlen("Engineering Building")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); WaitForTouch(); free(o); free(o2); free(o3); } else if (choice == 13 || choice == 14) { Object *o; Object *o2; Object *o3; Object *o4; Object *o5; Object *o6; Object *o7; o = malloc(sizeof(Object)); o2 = malloc(sizeof(Object)); o3 = malloc(sizeof(Object)); o4 = malloc(sizeof(Object)); o5 = malloc(sizeof(Object)); o6 = malloc(sizeof(Object)); o7 = malloc(sizeof(Object)); buildObject(560, 70, 301, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Name: ICICS", o, strlen("Name: ICICS")); drawObject(o); writeCaptionObjectLarge(o, BLACK, WHITE); buildObject(560, 115, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Latitude = 49.2611776", o2, strlen("Latitude = 49.2611776")); drawObject(o2); writeCaptionObjectLarge(o2, BLACK, WHITE); buildObject(560, 158, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Longitude =-123.24880439", o3, strlen("Longitude =-123.24880439")); drawObject(o3); writeCaptionObjectLarge(o3, BLACK, WHITE); buildObject(560, 200, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "2366 Main Mall V6T 1Z4", o4, strlen("2366 Main Mall V6T 1Z4")); drawObject(o4); writeCaptionObjectLarge(o4, BLACK, WHITE); buildObject(560, 246, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Cognative Systems", o5, strlen("Cognative Systems")); drawObject(o5); writeCaptionObjectLarge(o5, BLACK, WHITE); buildObject(560, 295, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "And Computer Science", o6, strlen("And Computer Engineering")); drawObject(o6); writeCaptionObjectLarge(o6, BLACK, WHITE); buildObject(560, 348, 300, OBJECT_HEIGHT, WHITE, WHITE, BLACK, "Building", o7, strlen("Building")); drawObject(o7); writeCaptionObjectLarge(o7, BLACK, WHITE); WaitForTouch(); free(o); free(o2); free(o3); } else { globalCurrentPage = theButton.targetPage; } }