void SpeedDemo(void) { uint16_t counter =0; float randl,randt,randr,randb,temp; while(counter++ < 150) { // draw random bars in the middle of the screen GFX_ColorSet(rand()%65536); randl = rand()%GFX_MaxXGet(); randr = rand()%GFX_MaxXGet(); if(randl > randr) { temp = randl; randl = randr; randr = temp; } randt = rand()%GFX_MaxYGet(); randb = rand()%GFX_MaxYGet(); if(randt > randb) { temp = randt; randt = randb; randb = temp; } while(GFX_RectangleFillDraw(randl,randt,randr,randb) == GFX_STATUS_FAILURE); } }
void ScrollScreen(uint8_t direction, uint16_t delay) { scrollPage = 1; //Up = 1, Down = 2, Left = 3, Right = 4 switch(direction) { case 1: scroll = 1; scrollLine = GFX_MaxYGet(); while(scrollLine > 0) { SYS_TMR_DelayMS(delay); scrollLine--; } break; case 2: scroll = 2; scrollLine = 0; while(scrollLine < GFX_MaxYGet()) { SYS_TMR_DelayMS(delay); scrollLine++; } break; case 3: scroll = 3; scrollLine = GFX_MaxXGet(); while(scrollLine > 1) { SYS_TMR_DelayMS(delay); scrollLine--; } break; case 4: scroll = 4; scrollLine = 1; while(scrollLine < (GFX_MaxXGet())) { SYS_TMR_DelayMS(delay); scrollLine++; } break; } scroll = 0; }
/***************************************************************************** * void CreatePreLoadScreen(void) *****************************************************************************/ void CreatePreLoadScreen(void) { static uint8_t currentPage; currentPage = GFX_ActivePageGet(); while (GFX_PageSet(ACTIVE_PAGE, BACKGROUND_BUFFER) == GFX_STATUS_FAILURE); //Draw Image to be shown fading in if(preLoadBackGroundScheme == PRE_LOAD_BACKGROUND_SCHEME_RAINBOW) { GFX_GradientColorSet(BRIGHTBLUE,BRIGHTRED); GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_RIGHT); //Rainbow Background GFX_GradientColorSet(RED,DARKORANGE); while(GFX_BarGradientDraw(0,0,GFX_MaxXGet()>>2,GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_GradientColorSet(DARKORANGE,GREEN); while(GFX_BarGradientDraw(GFX_MaxXGet()>>2,0,GFX_MaxXGet()>>1,GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_GradientColorSet(GREEN,BLUE); while(GFX_BarGradientDraw(GFX_MaxXGet()>>1,0,(GFX_MaxXGet()*3)>>2,GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_GradientColorSet(BLUE,GFX_RGBConvert(128,0,255)); while(GFX_BarGradientDraw((GFX_MaxXGet()*3)>>2,0,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); }
/********************************************************************* * Function: int16_t TouchGetX() * * PreCondition: none * * Input: none * * Output: x coordinate * * Side Effects: none * * Overview: returns x coordinate if touch screen is pressed * and -1 if not * * Note: none * ********************************************************************/ int16_t TouchGetX(void) { long result; result = TouchGetRawX(); if(result >= 0) { result = (long)((((long)_trC*result) + _trD)>>TOUCHSCREEN_RESISTIVE_CALIBRATION_SCALE_FACTOR); #ifdef TOUCHSCREEN_RESISTIVE_FLIP_X result = GFX_MaxXGet() - result; #endif }
void APP_EPD_CreateGlobalImageScreen(void) { uint16_t left, top, right, bottom; GFX_GOL_ObjectListFree(); GFX_ColorSet(WHITE); GFX_ScreenClear(); //clear screen of EPD left = (GFX_MaxXGet() - global_image_WIDTH) >> 1; top = (GFX_MaxYGet() - global_image_HEIGHT) >> 1; right = left + global_image_WIDTH - 1; bottom = top + global_image_HEIGHT - 1; GFX_GOL_PictureControlCreate( ID_PDI_Logo, left, top, right, bottom, GFX_GOL_PICTURECONTROL_DRAW_STATE, 1, (void *)&global_image, (GFX_GOL_OBJ_SCHEME*)&homeDemoScheme); }
/************************************************************************ Function: WORD GOLDrawCallback() Overview: This function must be implemented by user. GOLDraw() function calls it each time when GOL objects drawing is completed. User drawing should be done here. GOL will not change color, line type and clipping region settings while this function returns zero. Input: none Output: If the function returns non-zero the draw control will be passed to GOL. GOLDraw() can proceed and re-draw objects that needs to be redrawn. ************************************************************************/ bool GFX_GOL_DrawCallback(void) { static uint32_t timeClock = 0; // GFX_GOL_ANALOGCLOCK *pAc; switch(screenState) { case CREATE_BACKGROUND: screenState = DISPLAY_BACKGROUND; // switch to next state return (1); case DISPLAY_BACKGROUND: CreatePreLoadScreen(); screenState = CREATE_MAIN; return(1); case CREATE_MAIN: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); CreateMainScreen(1); screenState = DISPLAY_MAIN; // switch to next state timeClock =0; return (1); // draw objects created case DISPLAY_MAIN: if((TimerTick_GetTick() - timeClock) >= 5000) { timeClock = TimerTick_GetTick(); // pAc = (GFX_GOL_ANALOGCLOCK *)GFX_GOL_ObjectFind(MAIN_SCREEN_ID_ANALOG_CLOCK); // GFX_GOL_ObjectStateSet(pAc, GFX_GOL_ANALOGCLOCK_TICK); } return (1); case CREATE_INFO: //Use PIP for this screen CreateInfo(); while(GFX_Layer(PIP1, SET_PAGE_START, 164,0) == GFX_STATUS_FAILURE); while(GFX_Layer(PIP1, SET_SIZE, GFX_MaxXGet()-164,GFX_MaxYGet()) == GFX_STATUS_FAILURE); while(GFX_Layer(PIP1, SET_PAGE, PIP_PAGE_BUFFER, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(PIP1, SET_LAYER_START, 160,0) == GFX_STATUS_FAILURE); while(GFX_Layer(PIP1, ENABLE, 0, 0) == GFX_STATUS_FAILURE); screenState = DISPLAY_INFO; // switch to next state return (0); case CREATE_SPEED: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); CreateSpeed(); screenState = CREATE_MAIN; // switch to next state return (1); // draw objects created case CREATE_COMFORT: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); CreateComfortScreen(); // create window and sliders screenState = DISPLAY_COMFORT; // switch to next state return (1); // draw objects created case CREATE_SCROLLING: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); GFX_TransitionParametersSet(0,0,PUSH, GFX_ActivePageGet(), BACKGROUND_BUFFER, 1,16,LEFT_TO_RIGHT); while(GFX_Transition(&GFX_Primitive_instance.transitionParams,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_TransitionParametersSet(0,0,PUSH,BACKGROUND_BUFFER,GFX_ActivePageGet(), 1,10,TOP_TO_BOTTOM); while(GFX_Transition(&GFX_Primitive_instance.transitionParams,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_TransitionParametersSet(0,0,PUSH,GFX_ActivePageGet(),BACKGROUND_BUFFER, 1,8,RIGHT_TO_LEFT); while(GFX_Transition(&GFX_Primitive_instance.transitionParams,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_TransitionParametersSet(0,0,PUSH,BACKGROUND_BUFFER,GFX_ActivePageGet(), 1,5,BOTTOM_TO_TOP); while(GFX_Transition(&GFX_Primitive_instance.transitionParams,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); screenState = CREATE_MAIN; return(1); // draw objects created case CREATE_GRADIENT: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); CreateGradientScreen(); // create window screenState = DISPLAY_GRADIENT; // switch to next state return (1); // draw objects created case DISPLAY_SCROLLING: case DISPLAY_GRADIENT: case DISPLAY_COMFORT: case DISPLAY_SPEED: case DISPLAY_INFO: return (1); // redraw objects if needed case CREATE_ALPHABLEND: while(GFX_Layer(PIP1, DISABLE, 0, 0) == GFX_STATUS_FAILURE); CreateAlphaBlendScreen(); screenState = DISPLAY_ALPHABLEND; return(1); case DISPLAY_ALPHABLEND: if((TimerTick_GetTick() - timeClock) >= 500) { if(DisplayAlphaBlendScreen() == true) screenState = CREATE_MAIN; } return (1); // redraw objects if needed default: break; } return (1); // release drawing control to GOL }
uint16_t CreateOptions(void) { int width = GFX_MaxXGet(); int height = GFX_TextStringHeightGet(optscheme.pFont); uint16_t newstate; if (GFX_GOL_GroupboxCreate(ID_CONTYPE_BOX, 0, 0, width, (height * 2) + 10, GFX_GOL_GROUPBOX_DRAW_STATE, "Connection type", GFX_ALIGN_VCENTER, &optscheme) == NULL) { return -1; } newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE | GFX_GOL_RADIOBUTTON_GROUP_STATE; if (CONNECT_TYPE == ISO_9141_SLOW) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE; width -= 3; if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON1, 3, height + 2, (width / 3), (height * 2) + 6, newstate, "ISO 9141 SLOW", GFX_ALIGN_CENTER, &optscheme) == NULL) { return -1; }; newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE; if (CONNECT_TYPE == KWP_SLOW) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE; if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON2, (width / 3), height + 2, (width / 3) * 2, (height * 2) + 6, newstate, "KWP SLOW", GFX_ALIGN_CENTER, &optscheme) == NULL) { return -1; }; newstate = GFX_GOL_RADIOBUTTON_DRAW_STATE; if (CONNECT_TYPE == KWP_FAST) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE; if (GFX_GOL_RadioButtonCreate(ID_RADIOBUTTON3, (width / 3) * 2, height + 2, width, (height * 2) + 6, newstate, "KWP FAST", GFX_ALIGN_CENTER, &optscheme) == NULL) { return -1; }; newstate = GFX_GOL_CHECKBOX_DRAW_STATE; if (TRYING_CONN) newstate |= GFX_GOL_CHECKBOX_CHECKED_STATE; if (GFX_GOL_CheckBoxCreate(ID_AUTO_CHECKBOX, 3, (height * 3) + 12, (width / 2), (height * 4) + 20, newstate, "AUTO CONNECT", GFX_ALIGN_CENTER, &optscheme) == NULL) { return -1; }; if (GFX_GOL_CheckBoxCreate (ID_TESTKLINE_BUT, 3, (height * 5) + 12, (width / 2), (height * 6) + 20, GFX_GOL_CHECKBOX_DRAW_STATE, "TEST K LINE", GFX_ALIGN_HCENTER | GFX_ALIGN_VCENTER, &optscheme) == NULL) { return -1; } pKLINE_INPUT_TERMINAL = (GFX_GOL_StaticTextCreate ( ID_TESTKLINE_INPUT, (width / 2) + 3, (height * 5) + 12, width, (height * 6) + 20, GFX_GOL_STATICTEXT_DRAW_STATE, GetHighLowString(true), GFX_ALIGN_LEFT | GFX_ALIGN_TOP, &optscheme)); if (pKLINE_INPUT_TERMINAL == NULL) { return -1; }else // use given scheme { // pKLINE_INPUT_TERMINAL->hdr.actionGet = TerminalActionGet; } if (GFX_GOL_CheckBoxCreate (ID_TESTKLINE_INPUT, 3, (height * 5) + 12, (width / 2), (height * 6) + 20, GFX_GOL_CHECKBOX_DRAW_STATE, "TEST K LINE", GFX_ALIGN_HCENTER | GFX_ALIGN_VCENTER, &optscheme) == NULL) { return -1; } /* newstate = GFX_GOL_CHECKBOX_DRAW_STATE; if (TRYING_CONN) newstate |= GFX_GOL_RADIOBUTTON_CHECKED_STATE; if (GFX_GOL_CheckBoxCreate(ID_MANUAL_RADIO, (width / 2), (height * 3) + 12, (width / 2) * 2, (height * 4) + 20, newstate, "MANU", GFX_ALIGN_CENTER, &optscheme) == NULL) { return -1; };*/ return 0; }
void PagingDemo(void) { int x,y; GFX_XCHAR Scroll[] = {'C','o','l','o','r','s',' ','C','h','a','n','g','e',' ','w',' ','T','e','m','p','s',0}; GFX_XCHAR Cloud[] = {'C','l','o','u','d','y',0}; GFX_XCHAR Temper[] = {'T','e','m','p','e','r','a','t','u','r','e',0}; GFX_XCHAR SetTemp[] = {'S','e','t',' ','T','e','m','p',0}; GFX_XCHAR Time[] = {'8',':','2','0',' ','P','M',0}; GFX_XCHAR Date[] = {'J','u','n','e',' ','1','1',',',' ','2','0','1','2',0}; GFX_XCHAR Room[] = {'7','4',0}; while(GFX_PageSet(ACTIVE_PAGE,PIP_BUFFER) == GFX_STATUS_FAILURE); GFX_GradientColorSet(GFX_RGBConvert(55,0,0),BLACK); GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN); while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),55) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); GFX_FontSet((void *) &Monospaced_plain_36); while(GFX_TextStringBoxDraw(0,0,0,0,(GFX_XCHAR*)Scroll,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_XCHAR Temp[] ={'7','3',0}; for(x=0;x<2;x++) { while(GFX_PageSet(ACTIVE_PAGE,x) == GFX_STATUS_FAILURE); if(x==0) { GFX_GradientColorSet(BRIGHTRED,BLACK); while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),GFX_MaxYGet())== GFX_STATUS_FAILURE); } else { GFX_GradientColorSet(BRIGHTBLUE,BLACK); while(GFX_BarGradientDraw(0,0,GFX_MaxXGet(),GFX_MaxYGet()) == GFX_STATUS_FAILURE); } GFX_GradientColorSet(WHITE,BLACK); while(GFX_BevelGradientDraw(340,120,370,140,10) == GFX_STATUS_FAILURE); while(GFX_BevelGradientDraw(340,165,370,185,10) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); GFX_FontSet((void *) &Gentium_16); while(GFX_TextStringBoxDraw(50,75,0,0,(GFX_XCHAR*)Cloud,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(190,75,0,0,(GFX_XCHAR*)Temper,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(380,75,0,0,(GFX_XCHAR*)SetTemp,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); while(GFX_TextStringBoxDraw(GFX_MaxXGet()-80,0,0,0,(GFX_XCHAR*)Time,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(10,0,0,0,(GFX_XCHAR*)Date,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_FontSet((void *) &Monospaced_plain_36); while(GFX_TextStringBoxDraw(345,100,0,0,(GFX_XCHAR*)"+",0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(345,145,0,0,(GFX_XCHAR*)"-",0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_FontSet((void *) &Monospaced_bold_Bold_72); if(x==0) { while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); //Room Temp } while(GFX_TextStringBoxDraw(385,100,0,0,(GFX_XCHAR*)Room,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(ImageDecode ( (void *)&clouds, IMG_JPEG, 10, 100, 10 + clouds_WIDTH, 100 + clouds_HEIGHT, 0, &_jpegFileApi, NULL ) == 0xff); } while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE); while(GFX_PageSet(VISUAL_PAGE,0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_PAGE, PIP_BUFFER, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_SIZE, GFX_MaxXGet()-10, 55) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_PAGE_START, 0, GFX_MaxYGet()-56) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_LAYER_START, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(1000); x=0; while(x++ < 3) { while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(500); while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(500); } x = 0; while(x++ < 465) { while(GFX_Layer(0, SET_LAYER_START, x, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_SIZE, GFX_MaxXGet()-10-x, 55) == GFX_STATUS_FAILURE); while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(10); } while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); for(x=0;x<1;x++) { Temp[1] += 1; SYS_TMR_DelayMS(1000); GFX_GradientColorSet(GFX_RGBConvert(148,0,0),BLACK); GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN); while(GFX_BarGradientDraw(250,116,300,GFX_MaxYGet()) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); GFX_FontSet((void *) &Gentium_16); while(GFX_TextStringBoxDraw(190,75,0,0,(GFX_XCHAR*)Temper,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_FontSet((void *) &Monospaced_bold_Bold_72); while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); } while(GFX_PageSet(ACTIVE_PAGE,1) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(210,100,0,0,(GFX_XCHAR*)Temp,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_PageSet(VISUAL_PAGE,1) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(2000); while(GFX_PageSet(ACTIVE_PAGE, 0) == GFX_STATUS_FAILURE); while(GFX_PageSet(VISUAL_PAGE, 0) == GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); while(GFX_ScreenClear() == GFX_STATUS_FAILURE); }
void PIPDemo(void) { int x,y; GFX_XCHAR Title1[] = {'P','I','P',' ','D','e','m','o',0}; GFX_XCHAR Title2[] = {'P','a','g','e',0}; GFX_XCHAR Title3[] = {'S','t','a','r','t',0}; while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE); while(GFX_PageSet(VISUAL_PAGE,0) == GFX_STATUS_FAILURE); GFX_ColorSet(BLACK); while(GFX_ScreenClear() == GFX_STATUS_FAILURE); while(GFX_PageSet(ACTIVE_PAGE,PIP_BUFFER) == GFX_STATUS_FAILURE); GFX_ColorSet(BLACK); while(GFX_ScreenClear() == GFX_STATUS_FAILURE); while(GFX_ImageDraw(0,0, (void*)&mouse) == GFX_STATUS_FAILURE); //Draw Mouse in cursor area while(GFX_ImageDraw(15,0, (void*)&Pacman) == GFX_STATUS_FAILURE); //Draw Pacman in cursor area while(GFX_PageSet(ACTIVE_PAGE,0) == GFX_STATUS_FAILURE); GFX_FontSet((void *) &Monospaced_plain_36); GFX_ColorSet(WHITE); while(GFX_TextStringBoxDraw(0,40,0,0,(GFX_XCHAR*)Title1,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_TextStringBoxDraw(0,90,0,0,(GFX_XCHAR*)Title2,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); GFX_GradientColorSet(WHITE,BLACK); GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN); while(GFX_BevelGradientDraw(200,125,300,165,5) == GFX_STATUS_FAILURE); GFX_ColorSet(BLACK); while(GFX_TextStringBoxDraw(195,115,0,0,(GFX_XCHAR*)Title3,0,GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_PAGE, PIP_BUFFER, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_SIZE, 15, 15) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_LAYER_START, 0, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE); x = 0; y = 224; while(x<280) { while(GFX_Layer(0, SET_PAGE_START, x, y) == GFX_STATUS_FAILURE); while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE); y--; SYS_TMR_DelayMS(40); x+=5; } SYS_TMR_DelayMS(500); GFX_GradientColorSet(BLUE,BLACK); GFX_GradientTypeSet(GFX_FILL_STYLE_GRADIENT_DOWN); while(GFX_BevelGradientDraw(200,125,300,165,5)==GFX_STATUS_FAILURE); GFX_ColorSet(WHITE); while(GFX_TextStringBoxDraw(195,115,0,0,(GFX_XCHAR*)Title3,0, GFX_ALIGN_LEFT) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(1000); while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(1000); x = GFX_MaxXGet()-50; GFX_ColorSet(BLACK); while(GFX_Layer(0, SET_SIZE, 45, 45) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_LAYER_START, 15, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, ENABLE, 0, 0) == GFX_STATUS_FAILURE); while(x>5) { while(GFX_Layer(0, SET_PAGE_START, x, 32) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_LAYER_START, 15, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(40); while(GFX_Layer(0, SET_PAGE_START, x-5, 32) == GFX_STATUS_FAILURE); while(GFX_Layer(0, SET_LAYER_START, 60, 0) == GFX_STATUS_FAILURE); while(GFX_Layer(0, UPDATE, 0, 0) == GFX_STATUS_FAILURE); SYS_TMR_DelayMS(40); x -= 10; } while(GFX_Layer(0, DISABLE, 0, 0) == GFX_STATUS_FAILURE); }
///////////////////////////////////////////////////////////////////////////// // Function: WORD CreateMainMenu() // Input: none // Output: Returns 0 if the screen is created and 0 if not. // Overview: Creates the four icons to launch each of the application // note demos. ///////////////////////////////////////////////////////////////////////////// uint16_t CreateMainMenu() { int i; short left = 0, top = 0, right = 0, bottom = 0; while(GFX_DoubleBufferEnable() == GFX_STATUS_FAILURE); GFX_GOL_ButtonCreate ( ID_SCROLL1, // object�s ID 0, 26, 25, GFX_MaxYGet()-26, 0, GFX_GOL_BUTTON_DRAW_STATE, NULL, // use this bitmap NULL, Scroll[0], // use this text GFX_ALIGN_HCENTER, demoScheme); // use alternative style scheme GFX_GOL_ButtonCreate ( ID_SCROLL2, // object�s ID 0, 0, GFX_MaxXGet(), 25, 0, GFX_GOL_BUTTON_DRAW_STATE, NULL, // use this bitmap NULL, Scroll[1], // use this text GFX_ALIGN_HCENTER, demoScheme); // use alternative style scheme GFX_GOL_ButtonCreate ( ID_SCROLL3, // object�s ID GFX_MaxXGet()-25, 26, GFX_MaxXGet(), GFX_MaxYGet()-26, 0, // radius if rounded edge // draw the object after creation with // text drawn at the bottom and no panel GFX_GOL_BUTTON_DRAW_STATE, NULL, // use this bitmap NULL, Scroll[2], // use this text GFX_ALIGN_HCENTER, demoScheme); // use alternative style scheme GFX_GOL_ButtonCreate( ID_SCROLL4, // object�s ID 0, GFX_MaxYGet()-25, GFX_MaxXGet(), GFX_MaxYGet(), 0, GFX_GOL_BUTTON_DRAW_STATE, NULL, // use this bitmap NULL, Scroll[3], // use this text GFX_ALIGN_HCENTER, demoScheme); // use alternative style scheme // loop to create the four icons for (i=0; i<4; i++) { switch (i) { case 0: top = IconTop(0); bottom = IconBottom(0); left = IconLeft(0); right = IconRight(0); break; case 1: top = IconTop(0); bottom = IconBottom(0); left = IconLeft(1); right = IconRight(1); break; case 2: top = IconTop(1); bottom = IconBottom(1); left = IconLeft(0); right = IconRight(0); break; case 3: top = IconTop(1); bottom = IconBottom(1); left = IconLeft(1); right = IconRight(1); break; default: break; } if (!GFX_GOL_ButtonCreate ( ID_ICON1+i, // object�s ID left, top, right, bottom, 0, // radius if rounded edge // draw the object after creation with // text drawn at the bottom and no panel GFX_GOL_BUTTON_DRAW_STATE|GFX_GOL_BUTTON_NOPANEL_STATE, (void*) &MCHPFolderFile_8bpp_72x72, // use this bitmap (void*) &MCHPFolderEmpty_8bpp_72x72, Labels[i], // use this text GFX_ALIGN_HCENTER|GFX_ALIGN_BOTTOM, demoScheme // use alternative style scheme ) ) return 0; } return 1; }