logo
Google
 
Home

MHEG-5 Hello World Example

Firstly the Application. This contains a Link that triggers when the Application starts (IsRunning), which causes a transition to the Scene.


{:Application
    ( '/startup' 0 )        // Application content reference
    :Items (
        {:Link
            1
            :EventSource 0          // Check this application...
            :EventType IsRunning    // ... for the IsRunning event
            :LinkEffect (
                // Load the scene
                :TransitionTo (( '~/hello.mhg' 0 ) )
            )
        }
    )
    :BackgroundColour '=FF=FF=FF=00'    // White
    :TextCHook 10                       // Default text content hook
    :TextColour '=00=00=00=00'          // Black
    :Font "rec://font/uk1"              // Font to use for text rendering
    :FontAttributes "plain.26.32.0"     // Default font attributes
    :BitmapCHook 4                      // Default bitmap content hook
}

And secondly the "Scene". This displays a rectangle and some text. When the Blue button is pressed the Application is quit.


{:Scene
    ( "~/hello.mhg" 0 )
    :Items
    (
        // Declare a background Rectangle that covers the screen.
        {:Rectangle
            1
            :OrigBoxSize 720 576                // Size of rectangle
            :OrigPosition 0 0                   // Position at top left
            :OrigRefLineColour '=ff=ff=ff=00'   // White
            :OrigRefFillColour '=ff=ff=ff=00'   // White
        }

        // Place a Text box on the screen
        {:Text
            2
            :OrigContent "Hello World!"         // Text to display
            :OrigBoxSize 300 50                 // Size of text box
            :OrigPosition 200 100               // X,Y position
            :FontAttributes "plain.36.42.0"     // Use large characters
            :TextColour '=ff=00=00=00'          // Red
        }

        // Define a Link that triggers when the user presses the Blue key to
        // Quit the application.
        {:Link
            3
            :EventSource 0          // Source is this scene
            :EventType UserInput    // Event type that we are looking for
            :EventData 103          // 103 for the blue key
            :LinkEffect (
                :Quit ( ( '~/startup' 0 ) )
            )
        }
    )

    :InputEventReg 3
    :SceneCS 720 576
}

Want to see some more MHEG-5 in action? View and download a simple MHEG5 Invaders game example.

Digital Video
Glossary MPEG Bitrate

Video Editing
Intro

HDTV
Introduction Plasma LCD Projection HDTV Antennas

Freeview
Introduction Aerial Channels Coverage PVR Recording STB Guides TV

Media
VCD SVCD DVD DV

TMPGEnc
Beginners Settings

Encode

Author

MHEG-5

Software

Links

If you have any comments please use the feedback form.
Add to Favourites Privacy Policy
Copyright © 2002-2014 Ian Willis. All rights reserved.