Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.
2010-06-25
Edit: This post concerns “The Wall”, a discontinued project.
The Wall has some support for free drawing. This can either be done before or after updating the screen. Any drawing that is done before updating will be displayed behind registered objects (se the Hello World example) and any drawing that is done after updating will be displayed on top of registered objects. The coordinate system of registered objects use characters, and by default a character is 25 pixels wide and 42 pixels high.
The Hello World application in The Wall Looks like this…
BackgroundColor = "#445566" RegisterTextItem 0, "A", 4, 4, "#aabbcc", "InitializeText" Sub InitializeText(ByVal Item) Item.Value = "Hello!" End Sub
…and the result looks like this:
The code I add to illustrate how graphics can be added behind registered objects is red and bold in the following listing. BeforeUpdate “MyBeforeFunction” tells The Wall to call a function before drawing the registered items. The argument is the name of the function.
BackgroundColor = "#445566"
RegisterTextItem 0, "A", 1, 1, "#aabbcc", "InitializeText"
BeforeUpdate "MyBeforeFunction"
Sub MyBeforeFunction(ByVal G)
G.DrawLine 0, 70, 100, 70
End Sub
Sub InitializeText(ByVal Item)
Item.Value = "Hello!"
Item.Shadowed = True
End Sub
The result is the word “Hello!” with a white line behind it. I added a shadow behind the text to make the effect more visible.
To draw graphics in front of the registered items, use the AfterUpdate function to register a callback for that. This code (new lines are red and bold) also draws a line in front of “Hello!”.
BackgroundColor = "#445566" RegisterTextItem 0, "A", 1, 1, "#aabbcc", "InitializeText" BeforeUpdate "MyBeforeFunction" AfterUpdate "MyAfterFunction" Sub MyBeforeFunction(ByVal G) G.DrawLine "#ffffff", 0, 60, 300, 60 End Sub Sub MyAfterFunction(ByVal G) G.DrawLine "#ffffff", 0, 62, 300, 62 End Sub Sub InitializeText(ByVal Item) Item.Value = "Hello!" Item.Shadowed = True End Sub
This is the result:
Categories: Programs
Tags: The Wall
Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!
Leave a Reply