program HowToDrawAPanel; uses SwinGame,sgTypes,sgUserInterface; procedure Main(); var p : Panel; begin OpenGraphicsWindow('How To Draw A Panel' ,800 ,600 ); LoadDefaultColors(); p := LoadPanel('panelwithlabel.txt' ); ShowPanel(p ); ClearScreen(ColorWhite ); GUISetBackgroundColor(ColorBlack ); DrawInterface(); RefreshScreen(); Delay(10000 ); ReleaseAllResources(); end; begin Main(); end.
How To Draw A Panel
This how to introduce you to the User Interface functionality of SwinGame by demonstrate how to draw a basic panel on to the screen.
To create a panel in your program it is mandatory to input the x, y, w, h and region data into a text file that will be stored in the Resources\panels folder. A snip set of the text file will be display below.
// Panel data: x: 5 y: 5 w: 600 h: 300 // Region data // Format: r: x, y, w, h, kind r: 10, 10, 80, 20, Label, Label1, courierSmall, l, Hello World
Once the text file has been configured then the panel can be load through your program by using LoadPanel function. ShowPanel need to be call so that the panel will be set to display on screen, to draw the panel on screen DrawPanels procedure will be call. This DrawPanels will draw the entire panels that have been called by ShowPanel to the screen.
To demonstrate the above scenarios a screenshot will be display on the right showing the program created from the code below.
Suggested projects will appear here.