#include "tap.h"
#include "gif.h"
#include "pic.gd"

#define ID_LOGO 0x80000108

TAP_ID( ID_LOGO );
TAP_PROGRAM_NAME("LOGO");
TAP_AUTHOR_NAME("TOPFIELD");
TAP_DESCRIPTION("Our picture");
TAP_ETCINFO(__DATE__);


bool _exitFlag = FALSE;
word rgn;

dword TAP_EventHandler( word event, dword param1, dword param2 )
{
    if( event == EVT_KEY )
    {
        _exitFlag = TRUE;
	    return 0;
    }
    return event;
}

int TAP_Main(void)
{
    int tvRadio, svcNum;
    TAP_Channel_GetCurrent( &tvRadio, &svcNum );

    // you must restore pointer value in struct data.
//    _picGd.data = _picCpm;

    TAP_Channel_Stop( 1 );
	rgn = TAP_Osd_Create( 0, 0, 720, 576, 0, FALSE );
    TAP_Osd_PutGd( rgn, (720-_picGd.width)/2 , (576-_picGd.height)/2, &_picGd, FALSE );
    
    while( _exitFlag == FALSE )
    {
        TAP_SystemProc();
    }
    TAP_Osd_Delete( rgn );
    TAP_Channel_Start( 1, tvRadio, svcNum );
    return 0;
}


