Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacCG Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/Wrap Window
This example is the version from Sun, 17th Mar 2012.
Project "Wrap Window.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action()
dim n as integer
count=count+1
n=count mod 20
if n>10 then
n=20-n
end if
run n/10.0
End EventHandler
End Control
EventHandler Function MouseDown(X As Integer, Y As Integer) As Boolean
Title=str(x)+" "+str(y)
End EventHandler
Sub run(percent as double)
dim c as CGSConnectionMBS
dim win as CGSWindowMBS
dim m as MemoryBlock
dim w,h,w1,h1,o as integer
dim waveAmount,x,y as Single
dim slumpAmount,slump as Single
dim ch,cw,ww,hh,yy,xx as integer
System.DebugLog str(percent)
c=new CGSConnectionMBS
win=c.CGSWindow(self)
if win=nil then
Return
end if
ww=Width
hh=Height
xx=left
yy=top
ch=64
cw=2
slump = (rnd)
if rnd>0.5 then
slump=-slump
end if
const kWaveOffset = 16
m=NewMemoryBlock(ch*cw*4*4)
o=0 // offset in MemoryBlock
h1=ch-1
w1=cw-1
for h=0 to h1
for w=0 to w1
'point.local.x
x=w*ww/w1
m.SingleValue(o)=x
o=o+4
'point.local.y
y=h*hh/h1
m.SingleValue(o)=y
o=o+4
waveAmount = kWaveOffset * sin(y / 10.0) * percent
slumpAmount = (1.0 / (2.0 * (y / hh) + 0.73) - 0.365) * slump * percent
x = x + xx + waveAmount + slumpAmount
y = y + yy + (abs(slumpAmount) / 3)
'global.local.x
m.SingleValue(o)=x
o=o+4
'global.local.y
m.SingleValue(o)=y
o=o+4
next
next
win.Warp(cw,ch,m)
End Sub
Property count As Integer
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCG Plugin.