Is this a know bug in the Windows Luaplayer?

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
CaptainChickenpants
Posts: 5
Joined: Wed Feb 01, 2006 2:29 am

Is this a know bug in the Windows Luaplayer?

Post by CaptainChickenpants »

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: Select all

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
SeparateEntity
Posts: 3
Joined: Thu Feb 09, 2006 5:30 am

Post by SeparateEntity »

Put the rendering code outside of the bInit check, and don't forget to clear screen at the beginning of the main loop.

Code: Select all

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
Post Reply