Download 4DGL
 
About 4D Systems LTD
4D Systems, Australia
Home Company Products 4DGL Developers Center Downloads Support forum Distributors News & Events Contact us

uSD_Video

Back to listing | Print document

uSD_Video(x, y);

Description:
Plays a Video/Animation clip from the uSD card at screen location specified by x,y (top left corner). The location of the Video clip in the uSD card must be specified by uSD_SetSector() function. Video parameters such as width, height, frames, and inter-frame delay are embedded into the video data block.

Parameters:
x, y: specifies the horizonal and vertical position of the top left corner of the Video.

Example:

#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
//---------------------------------------------------------------------------------------

 

Supported Goldelox 4DGL Platforms:
μOLED-96-G1
μOLED-128-G1
μOLED-160-G1
μOLED-128-GMD1
μOLED-160-GMD1

Supported Picaso 4DGL Platforms:
μLCD-320-PMD2 
μLCD-32032-P1T 
μOLED-32024-PMD3 
μOLED-32024-PMD3T 
μOLED-32028-PMD3 
μOLED-32028-PMD3T
 
μOLED-32024-P1
μOLED-32024-P1T 
μOLED-32028-P1 
μOLED-32028-P1T 

 

Copyright © 2007 4D Systems Pty Ltd, Sydney, Australia - All Rights Reserved