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 

Is this a know bug in the Windows Luaplayer?

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



Joined: 01 Feb 2006
Posts: 5

PostPosted: Thu Feb 02, 2006 12:09 am    Post subject: Is this a know bug in the Windows Luaplayer? Reply with quote

I seem to have to do two flips to get my back buffer presented.

Just to get myself familiar with Lua and the PSP LuaPlayer I have been modifying the tutorial examples and doing simple test apps.

The following code is supposed to print hello world and count the number of presses of the up button (ooh exciting!).

However to get this to work it requires two flips rather than the one that should be required.

Code:

green = Color.new(0, 255, 0)
Count=0
background = Image.load("background.png")

bInit = true
while true do
   pad = Controls.read()
   if(pad ~= oldpad) then
      bInit =true
        oldpad=pad
   end

   if(bInit ==true) then
      bInit = false
        if pad:start() then
           break
      end

      if pad:up() then
         Count=Count+1
      end

        screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
      screen:print(200, 100, "Hello World!", green)
      screen:print(200,150,Count,green)
        -- wait for vertical sync and show new screen
        screen.waitVblankStart()
        screen:flip()
               -- why the extra flip?
        screen:flip()
   end
end


Not a big deal to work around, and in cases where you are drawing all the time it would not be noticable (I only update when there has been a keypress), you would simply lag a frame.

I will try this out on an actual PSP once the Luaplayer is running on the GTA eboot loader.

Just wondering if this has been seen before (I noticed when I did a search of the forums that there are references to flickering on the windows player, possibly related?).

CC
Back to top
View user's profile Send private message
SeparateEntity



Joined: 09 Feb 2006
Posts: 3

PostPosted: Thu Feb 09, 2006 5:33 am    Post subject: Reply with quote

Put the rendering code outside of the bInit check, and don't forget to clear screen at the beginning of the main loop.
Code:
green = Color.new(0, 255, 0)
Count=0
background = Image.load("background.png")

bInit = true
while true do
   screen:clear()
   pad = Controls.read()
   if(pad ~= oldpad) then
      bInit =true
        oldpad=pad
   end

   if(bInit ==true) then
      bInit = false
        if pad:start() then
           break
      end

      if pad:up() then
         Count=Count+1
      end       
   end
   screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
      screen:print(200, 100, "Hello World!", green)
      screen:print(200,150,Count,green)
        -- wait for vertical sync and show new screen
        screen.waitVblankStart()
        screen:flip()
end
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