Function Main()
while true
Draw()
end while
end Function
Function Draw()
screen = CreateObject("roscreen", false, 640,480)
player = CreateObject("robitmap","pkg:/images/truck.png")
region = createobject("roregion", player, 0,0,64,64)
compositor = createobject("rocompositor","pkg:/images/truck.png")
compositor.draw()
screen.drawobject(0,0,player)
return true
end Function
BrightScript Component function call does not have the correct number of parameters. (runtime error &hf5) in ...AA9QwPvk/pkg:/source/Main.brs(18)
018: compositor = createobject("rocompositor","pkg:/images/truck.png")
Sub Main()
W = 640
H = 480
screen=CreateObject("roScreen", true, W, H)
if type(screen) <> "roScreen"
print "Unable to open screen"
return
endif
msgport = CreateObject("roMessagePort")
screen.SetPort(msgport)
DrawImg(screen)
End Sub
Sub DrawImg(scr as object)
port = scr.GetPort()
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
logo = CreateObject("roBitmap", "pkg:/images/logo.png")
while true
BackGround(scr)
scr.drawobject(cw-280, ch-160, logo)
scr.swapbuffers()
msg = wait(0, port)
if type(msg) = "roUniversalControlEvent" then
if (i = 6) then
exit while
end if
end if
end while
end sub
Sub Background(scr as object)
scr.clear(0)
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
bg = CreateObject("roBitmap", "pkg:/images/background.png")
scr.drawobject(cw-360, ch-240, bg)
End Sub
"AngelWire" wrote:
Thanks for the help YungBlood, But I have another question: How would I make the image transparent? I'm using a png with transparency, but there's still a black box around the image. By the way, is there any information about roscreens in the documentation?
while true
'...do a bunch of calculations....
' now draw everything:
screen.setalphaenable(false) 'set transparent alph blend OFF
starsregion.offset((movex/2),0,0,0) 'move background starfield
screen.drawobject(0,-150,starsregion) 'draw starfield at new position
screen.setalphaenable(true) 'set transparency ON
earthregion.Offset(movex,0,0,0) 'move earth
screen.drawobject(0,-250,earthregion) 'draw landscape on top of starfield
playsprite.moveto(ps.posx,ps.posy) 'move player's character
compositor.drawall() 'draw all sprites
screen.SwapBuffers() 'swap screen buffers
end while
Sub Main()
W = 640
H = 480
screen=CreateObject("roScreen", true, W, H)
if type(screen) <> "roScreen"
print "Unable to open screen"
return
endif
msgport = CreateObject("roMessagePort")
screen.SetPort(msgport)
DrawImg(screen)
End Sub
Sub DrawImg(scr as object)
x = int(128)
y = int(128)
port = scr.GetPort()
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
logo = CreateObject("roBitmap", "pkg:/images/corporal.png")
while true
BackGround(scr)
scr.drawobject(x, y, logo)
scr.swapbuffers()
msg = wait(0, port)
if type(msg) = "roUniversalControlEvent" then
if (i = 3) then
scr.setalphaenable(true)
else
scr.setalphaenable(false)
end if
end if
end while
end sub
Sub Background(scr as object)
scr.clear(0)
cw = int(scr.getwidth()/2)
ch = int(scr.getheight()/2)
bg = CreateObject("roBitmap", "pkg:/images/grass.png")
scr.drawobject(cw-360, ch-240, bg)
End Sub
Use of uninitialized variable. (runtime error &he9) in ...aaNP9/pkg:/source/appMain.brs(29)
029: if (i = 3) then