Update samples/UsingLibUI/test6.ring - Add some comments
load "libui.ring"
-load "stdlibcore.ring"
-oWindow = uiNewWindow( "Drawing", 400, 400, True)
+oWindow = uiNewWindow( "Drawing Sample", 400, 400, True)
uiWindowOnClosing(oWindow,"closeApp()")
oAreaHandler = uiNewAreaHandler("draw()","","","","")
@@ -20,11 +19,14 @@ uiMain()
func draw
oContext = uiEventContext()
+
+ # Define some colors
colorWhite = dec("FFFFFF")
colorRed = dec("FF0000")
colorGreen = dec("00FF00")
colorBlue = dec("0000FF")
+ # Draw White Rectangle
oBrush = uiNewSolidBrush(colorWhite)
oPath = uiDrawNewPath(uiDrawFillModeWinding)
uiDrawPathAddRectangle(oPath, 0, 0, 400, 400)
@@ -32,6 +34,7 @@ func draw
uiDrawFill(oContext, oPath, oBrush)
uiDrawFreePath(oPath)
+ # Draw Red Rectangle
oBrush = uiNewSolidBrush(colorRed)
oPath = uiDrawNewPath(uiDrawFillModeWinding)
uiDrawPathAddRectangle(oPath, 10, 10, 20, 20)
@@ -39,6 +42,7 @@ func draw
uiDrawFill(oContext, oPath, oBrush)
uiDrawFreePath(oPath)
+ # Draw Green Rectangle
oBrush = uiNewSolidBrush(colorGreen)
oPath = uiDrawNewPath(uiDrawFillModeWinding)
uiDrawPathAddRectangle(oPath, 30, 30, 30, 30)
@@ -46,6 +50,7 @@ func draw
uiDrawFill(oContext, oPath, oBrush)
uiDrawFreePath(oPath)
+ # Draw Blue Rectangle
oBrush = uiNewSolidBrush(colorBlue)
oPath = uiDrawNewPath(uiDrawFillModeWinding)
uiDrawPathAddRectangle(oPath, 60, 60, 40, 40)
