forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem With My Code

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
ohemsted



Joined: 22 Apr 2006
Posts: 7

PostPosted: Sat Apr 22, 2006 1:00 am    Post subject: Problem With My Code Reply with quote

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
View user's profile Send private message
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Sat Apr 22, 2006 1:51 am    Post subject: Reply with quote

screen:flip() goes right before the end of while true do and screen.waitVblankStart goes right before screen:flip
_________________
- be2003
blog
Back to top
View user's profile Send private message
ohemsted



Joined: 22 Apr 2006
Posts: 7

PostPosted: Sat Apr 22, 2006 3:49 am    Post subject: I'm confused now... Reply with quote

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
View user's profile Send private message
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Sat Apr 22, 2006 5:06 am    Post subject: Reply with quote

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
View user's profile Send private message
romero126



Joined: 24 Dec 2005
Posts: 200

PostPosted: Sat Apr 22, 2006 9:51 am    Post subject: Reply with quote

add another flip on there.. Its a problem with windows lua player and faster machines. It tries to do double buffering.
Back to top
View user's profile Send private message
ohemsted



Joined: 22 Apr 2006
Posts: 7

PostPosted: Sat Apr 22, 2006 8:39 pm    Post subject: Thanks Reply with quote

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
View user's profile Send private message
ohemsted



Joined: 22 Apr 2006
Posts: 7

PostPosted: Mon Apr 24, 2006 3:47 am    Post subject: Support Reply with quote

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
View user's profile Send private message
ohemsted



Joined: 22 Apr 2006
Posts: 7

PostPosted: Mon Apr 24, 2006 4:11 am    Post subject: So you know Reply with quote

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
View user's profile Send private message
DiabloTerrorGF



Joined: 15 Jul 2005
Posts: 64

PostPosted: Mon Apr 24, 2006 5:16 am    Post subject: Reply with quote

Need a timer.
Back to top
View user's profile Send private message
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Mon Apr 24, 2006 2:16 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group