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 

The mouse allways ontop?

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



Joined: 20 Jan 2006
Posts: 13

PostPosted: Tue Feb 21, 2006 8:18 pm    Post subject: The mouse allways ontop? Reply with quote

How do i do that if i want to blit: lets say a window which is a picture.
The window will be over the mouse because its further down the code,
but if i set the mouse blit after that it blits forever, you know when it blits over and over again, and when i move the mouse there is blits all over the place.

Please help me out here. Peace
Back to top
View user's profile Send private message
fattymc03



Joined: 11 Feb 2006
Posts: 18

PostPosted: Tue Feb 21, 2006 11:16 pm    Post subject: Reply with quote

make sure you are clearing the screen every time thru the loop
Back to top
View user's profile Send private message
haxx_blaster



Joined: 20 Jan 2006
Posts: 13

PostPosted: Wed Feb 22, 2006 3:15 am    Post subject: Reply with quote

If i do "screen:clear()" a huge black hole appears, can't i get it transparent in some way?
Back to top
View user's profile Send private message
fullerlee



Joined: 03 Nov 2005
Posts: 54

PostPosted: Wed Feb 22, 2006 3:31 am    Post subject: Reply with quote

You will generally have to redraw everything each cycle, even stuff that hasn't changed. If you bear that in mind, you should solve your problem.

Lee

eg:
Code:

while true do
   
   clearScreen()
   drawBackground()
   drawWindows()
   drawMouse()
   flip()

end
Back to top
View user's profile Send private message
haxx_blaster



Joined: 20 Jan 2006
Posts: 13

PostPosted: Wed Feb 22, 2006 6:05 am    Post subject: Reply with quote

Is that the only way to do it?
It will be fucking hard to make it like that because i have to remake everything.

Edit: I tryed it, and it makes everything go slower then a turtle. ;P
Back to top
View user's profile Send private message
fullerlee



Joined: 03 Nov 2005
Posts: 54

PostPosted: Wed Feb 22, 2006 7:03 am    Post subject: Reply with quote

Another way would be to cache the drawing of things that don't change.

So, say you have a background, and a bunch of windows to draw. You only really want to redraw windows that have changed, so you could draw each window to an image, and keep a reference to each image prior to blitting the images to the screen.

Something like this (pseudo code):

Code:

function redraw()
   backBuffer:clear()
   for eachWindow
      if eachWindow has changed
         eachWindow.windowImage = generateWindowImage()
      end
      backBuffer:blit(eachWindow.windowImage)
   end
   
   drawMouse(backBuffer)
 
   --Finally blit the backbuffer to the screen
   screen:blit(backBuffer)


Hopefully that will give you an idea.

Have a look at the bits of render code where you're doing the most complex calculations and see if the final image is cacheable.

For example, in the project I'm working on, I have an instructions screen which displays as long as the L button is held down. There's a fair bit of code which generates the instructions screen, but I only need execute it once, because I blit the instructions to an image, and then all I have to do each cycle is blit the final instructions image to the screen.

Lee
Back to top
View user's profile Send private message
haxx_blaster



Joined: 20 Jan 2006
Posts: 13

PostPosted: Wed Feb 22, 2006 9:45 pm    Post subject: Reply with quote

I dont really recognize that kind of code.
But, you know in the beginning of the code you can have "do while true" and blit pictures there, it all transparent.
Can't i redo that later down the code? Why is it so special?
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