Custom Windows
Author: | Liquixcat
|
Submitted: | 26th July, 2005
|
Views: | 6977
| Rated: |
|
|
This article is really just for people who couldn't figure this out. Most of you likely know how, but some may not.
Note: This is the MMF version, but aside from different locations of propeties, this can still be achieved in TGF.
.::Custom Windows Made Easy
1) Prerequisites
First and most important, you will need two extensions that will able you to control the window, and input actual mouse coordinates.
I recommend:
Window Object - Christopher Lightfoot
http://www.nemonix.fsnet.co.uk
Mouse Object - Marcello Bastea-Forte
http://www.cellosoft.com
This may be a given, but a custom window with a normal Windows frame on top will look stupid, so you'll have to turn off the heading properties.
How:
>>Start a new application
>>Double click on 'Properties' (not frame properties)
>>Click on 'Window'
>>Unselect 'Heading', 'Application to include menu-bar', 'Menu displayed on boot-up'
Now you have to design a custom window. Launch your favorite drawing program, and create a window with the same dimensions as your application.
How:
>>The dimensions of your application will be shown to you in the same screen that the window properties were in.
>>Include a title, possibly a reserve space for a close buttom, and a thin frame (most likely black, but any color works)
2) Programming
Now that you have the prerequisites met, it's time to make this custom window work.
How:
>>Load the extensions into MMF's first frame
>>Load 3 Hidden Counter Objects
>>Load the picture (your custom frame) as an active object, and align the picture to fit
>>Go into Event Editor
---Start Code---
()Mouse pointer lays within zone (note: dragable area)
&Repeat while mouse key is clicked
@Set CounterA to 1
()Always
&CounterA <> 1
@Set CounterB to MouseX( "Mouse object" ) - WinLeft( "Window Object" )
@Set CounterC to MouseY( "Mouse object" ) - WinRight( "Window Object" )
()CounterA = 1
@Set Window Object Horizontal to MouseX( "Mouse object" ) - value( "CounterB" )
@Set Window Object Vertical to MouseY( "Mouse object" ) - value( "CounterC" )
()Mouse pointer lays within zone (Note: close frame area)
&User clicks with left button
@End the Application
---End Code---
3) Notes
For your game I recommend using 'Sub-App' starting from Frame 2. Just put it inside your custom window located in Frame 1, adjust it to load Frame 2, and start making your game from Frame 2 instead of Frame 1.
Thank-you, I hope you have learned something.
|
|
LiquixcatAdministrator
Lazy Coder Registered 08/12/2002
Points 201
|