#platform "uOLED-32028-PMD3T" #inherit "4DGL_16bitColours.fnc"
/* 4DGL Demo Application - Exploding Screen - - Test for uSD_Image(x,y) - - for the following PICASO Platforms - - uOLED-32024-PMD3T - - uOLED-32028-PMD3T -
Requires Graphics Composer version 2.0.1.0
The video formats under 4DGL has changed slightly from the serial platform versions. The video height, width, colour_mode(colour bits per pixel), number of frames, frame delay parameters are now embedded into the video data block and does not require the user to pass these parameters to the video display functions.
Getting Started: - Make sure to download the latest Graphics Composer version 2.0.1.0 or above - You'll need a SD card reader/writer. - Run the GC and create a new project. - Enable the following settings:
"Device" -> "Load Options" -> "Com Port/Drive" = (your drive name for the card reader, eg J:) "Device" -> "Load Options" -> "Write Command Block" = NO "Device" -> "Load Options" -> "Image Format" = Image & Pixel Data
- Change the properties of the display resolution to
X = 240, Y = 320
- On the left "Actions" window pane right click the mouse button and add the following gif movie:
..\4DGL_Workshop_Version_a1.0\Images\Gif\Explode-02-june.gif"
- Save your project, e.g ExplodingScreen.gcs - Select "Device" -> "Load" to save all of the movie data into the uSD card. - Using a text editor (eg Notepad) open the ExplodingScreen.txt file the GC has created. Note down each of the sector addresses for movie file. You will need this for the uSD_SetSector(SectHiWord, SectLoWord) function. In this case the sector addresses have already been inserted into the uSD_SetSector() function calls for the exploding movie clip for this example program as can be seen below.
*/
//---------------------------------------------------------------------------------------- #constant LEFT 30 #constant TOP 150 #constant TEXTWIDTH 2 #constant TEXTHEIGHT 2 //----------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------- func main() // enable touch screen touch_Set(TOUCH_ENABLE);
if(!uSD_Init())
print("Please Insert uSD Card!!"); while(1);
endif
// Draw the Text Box (indented) gfx_Button(DOWN, 0, 30, GREEN, WHITE, FONT4, TEXTWIDTH, TEXTHEIGHT, "4DGL-Demo");
// Draw the Push Button (raised) gfx_Button(UP, LEFT, TOP, BLUE, RED, FONT4, TEXTWIDTH, TEXTHEIGHT, " PRESS ");
// set touch detect region to that of the push button touch_DetectRegion(LEFT, TOP, gfx_Get(RIGHT_POS), gfx_Get(BOTTOM_POS));
// Wait until the button is pressed while(touch_Get(TOUCH_STATUS) != TOUCH_PRESS);
// Draw the Push Button (depressed) gfx_Button(DOWN, LEFT, TOP, BLUE, WHITE, FONT4, TEXTWIDTH, TEXTHEIGHT, " PRESS ");
// Wait until the button is pressed while(touch_Get(TOUCH_STATUS) != TOUCH_RELEASE);
// Clear Screen gfx_Cls(); // enable touch region over full screen touch_Set(TOUCH_REGIONDEFAULT);
// video start sector address for ../4DGL_Workshop_Version_a1.0/Images/Gif/Explode-02-june.gif" uSD_SetSector(0x0000, 0x1000);
repeat
if(touch_Get(TOUCH_STATUS) == TOUCH_RELEASE)
// over-ride the built in inter-frame delay and set it to 10ms ... seems a little slow gfx_Set(FRAME_DELAY, 10); // now play video at the x,y obtained from touch screen uSD_Video(touch_Get(TOUCH_GETX)-40, touch_Get(TOUCH_GETY)-40);
endif
forever
endfunc //--------------------------------------------------------------------------------------- |