예제 #1
0
파일: GOL.c 프로젝트: varesa/SnakePIC32
/*********************************************************************
* Function: WORD GOLDraw()
*
* PreCondition: none
*
* Input: none
*
* Output: non-zero if drawing is complete
*
* Side Effects: none
*
* Overview: redraws objects in the current linked list
*
* Note: none
*
********************************************************************/
WORD GOLDraw(void)
{
    static OBJ_HEADER   *pCurrentObj = NULL;
    SHORT               done;

    #ifdef USE_DOUBLE_BUFFERING
    static BYTE         DisplayUpdated = 0;
    if(IsDisplayUpdatePending())
    {
        return 0;
    }
    #endif // USE_DOUBLE_BUFFERING

    if(pCurrentObj == NULL)
    {
        if(GOLDrawCallback())
        {
            #ifdef USE_DOUBLE_BUFFERING
				#ifdef USE_TRANSITION_EFFECTS
                if(TransitionPendingStatus)
                {
                    TransitionPendingStatus = 0;
	                while(IsDisplayUpdatePending());
                   	GFXExecutePendingTransition(GetDrawBufferAddress(), GetFrameBufferAddress());
                }
				#endif
            #endif //USE_DOUBLE_BUFFERING
            
            // It's last object jump to head
            pCurrentObj = _pGolObjects;

            #ifdef USE_DOUBLE_BUFFERING
            if(DisplayUpdated)
            {
                RequestDisplayUpdate();
                DisplayUpdated = 0;
                return(0);
            }
            #endif //USE_DOUBLE_BUFFERING
        }
        else
        {
            return (0);     // drawing is not done
        }
    }

    done = 0;
    while(pCurrentObj != NULL)
    {
        if(IsObjUpdated(pCurrentObj))
        {
            done = pCurrentObj->DrawObj(pCurrentObj);

            if(done)
            {
                GOLDrawComplete(pCurrentObj);

			#ifdef USE_DOUBLE_BUFFERING

			    InvalidateRectangle(pCurrentObj->left, pCurrentObj->top,
			                        pCurrentObj->right, pCurrentObj->bottom);
                DisplayUpdated = 1;

			#endif //USE_DOUBLE_BUFFERING

            }
            else
            {
                return (0); // drawing is not done
            }
        }

        pCurrentObj = (OBJ_HEADER *)pCurrentObj->pNxtObj;
    }

	#if defined(USE_TRANSITION_EFFECTS) && defined(USE_DOUBLE_BUFFERING)

        TransitionPendingStatus = GFXIsTransitionPending();
	    InvalidateAll(); //If needed, invalidate only the transition rectangle instead

	#endif

    return (1);             // drawing is completed
}
예제 #2
0
파일: GOL.c 프로젝트: gexueyuan/11-ru
/*********************************************************************
* Function: WORD GOLDraw()
*
* PreCondition: none
*
* Input: none
*
* Output: non-zero if drawing is complete
*
* Side Effects: none
*
* Overview: redraws objects in the current linked list
*
* Note: none
*
********************************************************************/
WORD GOLDraw(){
static OBJ_HEADER *pCurrentObj = NULL;
SHORT done;

    if(pCurrentObj == NULL){
        if(GOLDrawCallback()){
            // It's last object jump to head
            pCurrentObj = _pGolObjects;
        }else{
            return 0;  // drawing is not done
        }
    }

    done = 0;
    while(pCurrentObj != NULL){
        
        if(IsObjUpdated(pCurrentObj)){

            switch(pCurrentObj->type){
                #ifdef USE_BUTTON
	            case OBJ_BUTTON:
                    done = BtnDraw((BUTTON*)pCurrentObj);
              //***********************************************//
                      //  TouchGetX();
                      //  TouchGetY();
              //**************************************************//					
                    break;
                #endif
                #ifdef USE_WINDOW
	            case OBJ_WINDOW:
                    done = WndDraw((WINDOW*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_CHECKBOX
	            case OBJ_CHECKBOX:
                    done = CbDraw((CHECKBOX*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_RADIOBUTTON
	            case OBJ_RADIOBUTTON:
                    done = RbDraw((RADIOBUTTON*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_EDITBOX
	            case OBJ_EDITBOX:
                    done = EbDraw((EDITBOX*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_LISTBOX
	            case OBJ_LISTBOX:
                    done = LbDraw((LISTBOX*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_SLIDER
	            case OBJ_SLIDER:
                    done = SldDraw((SLIDER*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_PROGRESSBAR
	            case OBJ_PROGRESSBAR:
                    done = PbDraw((PROGRESSBAR*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_STATICTEXT
	            case OBJ_STATICTEXT:
                    done = StDraw((STATICTEXT*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_PICTURE
	            case OBJ_PICTURE:
                    done = PictDraw((PICTURE*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_GROUPBOX
	            case OBJ_GROUPBOX:
                    done = GbDraw((GROUPBOX*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_ROUNDDIAL
	            case OBJ_ROUNDDIAL:
                    done = RdiaDraw((ROUNDDIAL*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_METER
	            case OBJ_METER:
                    done = MtrDraw((METER*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_CUSTOM
	            case OBJ_CUSTOM:
                    done = CcDraw((CUSTOM*)pCurrentObj);
                    break;
                #endif
                #ifdef USE_GRID
                case OBJ_GRID:
                    done = GridDraw( (GRID *)pCurrentObj );
                    break;
                #endif
                default:
                    break;
            }
            if(done){
                GOLDrawComplete(pCurrentObj);
            }else{
                return 0; // drawing is not done
            }
        }
        pCurrentObj = pCurrentObj->pNxtObj;
    }
    return 1;   // drawing is completed
}