| View previous topic :: View next topic |
| Author |
Message |
ohemsted
Joined: 22 Apr 2006 Posts: 7
|
Posted: Sat Apr 22, 2006 1:00 am Post subject: Problem With My Code |
|
|
Hello everyone, I was wondering because I'm a newbie to lua coding why my application was popping up in windows lua then disappearing straight away there is a copy of the cody below can someone please take a look.
| Quote: |
-- Images
author = Image.load("images/author.png") -- 480 x 272
luaplayer = Image.load("images/lua.png") -- 480 x 272
premenu = Image.load("images/premenu.png") -- 480 x 272
menu = Image.load("images/menu.png") -- 480 x 272
gameboard = Image.load("images/board.png") -- 480 x 272
icon1 = Image.load("images/icon1.png") -- 30 x 30
icon2 = Image.load("images/icon2.png") -- 30 x 30
-- Color
white = Color.new(255,255,255)
while true do -- Start the loop
screen.flip() -- Screen Buffer
screen.waitVblankStart()
screen:blit(0,0,luaplayer,true)
screen:blit(0,0,author,false)
screen:blit(0,0,premenu,false)
screen:blit(0,0,menu,false)
end |
|
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Sat Apr 22, 2006 1:51 am Post subject: |
|
|
screen:flip() goes right before the end of while true do and screen.waitVblankStart goes right before screen:flip _________________ - be2003
blog |
|
| Back to top |
|
 |
ohemsted
Joined: 22 Apr 2006 Posts: 7
|
Posted: Sat Apr 22, 2006 3:49 am Post subject: I'm confused now... |
|
|
I have simplified my code right down and it is still failing, any ideas?
| Quote: | author = Image.load("images/author.png") -- 480 x 272
luaplayer = Image.load("images/lua.png") -- 480 x 272
premenu = Image.load("images/premenu.png") -- 480 x 272
menu = Image.load("images/menu.png") -- 480 x 272
gameboard = Image.load("images/board.png") -- 480 x 272
icon1 = Image.load("images/icon1.png") -- 30 x 30
icon2 = Image.load("images/icon2.png") -- 30 x 30
white = Color.new(255,255,255)
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,author)
screen.waitVblankStart()
screen.flip()
end
|
|
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Sat Apr 22, 2006 5:06 am Post subject: |
|
|
right after the screen:blit line make a new line like this:
| Code: | screen:print(0,0,"",black)
and define black at the beginning of the file:
black = Color.new(0,0,0)
|
_________________ - be2003
blog |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Sat Apr 22, 2006 9:51 am Post subject: |
|
|
| add another flip on there.. Its a problem with windows lua player and faster machines. It tries to do double buffering. |
|
| Back to top |
|
 |
ohemsted
Joined: 22 Apr 2006 Posts: 7
|
Posted: Sat Apr 22, 2006 8:39 pm Post subject: Thanks |
|
|
Ok I am glad your helping me out but it's still just flashing up and disappearing again.
Here is a sample of my current code
| Quote: |
author = Image.load("images/author.png") -- 480 x 272
luaplayer = Image.load("images/lua.png") -- 480 x 272
premenu = Image.load("images/premenu.png") -- 480 x 272
menu = Image.load("images/menu.png") -- 480 x 272
gameboard = Image.load("images/board.png") -- 480 x 272
icon1 = Image.load("images/icon1.png") -- 30 x 30
icon2 = Image.load("images/icon2.png") -- 30 x 30
white = Color.new(255,255,255)
black = Color.new(0,0,0)
while true do
pad = Controls.read()
screen:clear()
screen:blit(0,0,author)
screen:print(0,0,"",black)
screen.waitVblankStart()
screen.flip()
screen.flip()
end
|
I would be very grateful if you could make the code correct and send it back to me in full.
Thanks again. |
|
| Back to top |
|
 |
ohemsted
Joined: 22 Apr 2006 Posts: 7
|
Posted: Mon Apr 24, 2006 3:47 am Post subject: Support |
|
|
I would like some full help with this program so if you would like to help me with this lua program please either PM me or e-mail on | Quote: | | ohemsted@gmail.com |
Thanks |
|
| Back to top |
|
 |
ohemsted
Joined: 22 Apr 2006 Posts: 7
|
Posted: Mon Apr 24, 2006 4:11 am Post subject: So you know |
|
|
| I have re-written my code and it is all working ok but I need to find a way to make the program watch one image for abuot 3 seconds then change to another for 3 seconds any ideas? |
|
| Back to top |
|
 |
DiabloTerrorGF
Joined: 15 Jul 2005 Posts: 64
|
Posted: Mon Apr 24, 2006 5:16 am Post subject: |
|
|
| Need a timer. |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Mon Apr 24, 2006 2:16 pm Post subject: |
|
|
| Code: |
-- switches between 2 images at 5 sec intervals
temp = 0
tempimg = 0 -- or false
imga = Image.load("jmtjhndb.png")
imgb = Image.load("jmg.png")
topscrn=Image.createEmpty(480,272)
while not Controls.read():start() do
temp=temp+1
if temp==3 then temp==1 end
if temp==1 then
tempimg=imga
end
if temp==2 then
tempimg=imgb
end
topscrn:blit(0,0,tempimg)
screen:blit(0,0,topscrn)
screen.waitVblankStart()
screen:flip()
System.sleep(300)
end
|
_________________ - be2003
blog |
|
| Back to top |
|
 |
|