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 

screen:blit

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



Joined: 28 Apr 2005
Posts: 91

PostPosted: Mon Aug 22, 2005 10:05 am    Post subject: screen:blit Reply with quote

it seems that after i blit a second png the size of the full screen everything slows down is there a way to unblit the first background then re blit it once you close the second background?
Back to top
View user's profile Send private message AIM Address
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Aug 27, 2005 7:33 am    Post subject: Reply with quote

Do you have some code, which is too slow? I don't understand your problem.
Back to top
View user's profile Send private message
Squall333



Joined: 28 Apr 2005
Posts: 91

PostPosted: Sat Aug 27, 2005 12:38 pm    Post subject: Reply with quote

as ugly as it may be here it is
Code:

System.usbDiskModeActivate()

-- load images
background = Image.load("img/background.png")
bar = Image.load("img/bar.png")
bar_bright = Image.load("img/bar_bright.png")
pointer = Image.load("img/pointer.png")
programs = Image.load("img/programs.png")
exit_bright = Image.load("img/exit_bright.png")
my_comp = Image.load("img/my_computer.png")
my_computer = Image.load("img/my computer.png")

pad = Controls.read()

color = Color.new(255, 255, 255)
-- Variables
   x0 = 0
   y0 = 0
   x1 = 0
   y1 = 0

r=2
MYCOMP = false
MYCOMPUTER = false
Programs = 1
BarBrght = false



-- Main
while true do

function DRAW()

   screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)

   if BarBrght == true then
              screen:blit(0, 0, bar_bright)
            if y0 > 249 and x0 < 60 and pad:cross() then
      screen.waitVblankStart(15)
      Programs = Programs + 1
      end
   end   

   if math.mod(Programs,r) == 0 then
   screen:blit(0, 0, programs)
      if x0>75 and y0>220 and x0<90 and y0<235 then
         screen:blit(0,0,exit_bright)
            if pad:cross() then
               return
            end
   
            end
   if y0 > 249 and x0 < 60 and pad:cross() then
      PRGRAMS = false
   end
   end   
    
   if x0 > 70 and y0 > 135 and x0 < 144 and y0 < 154 then
              screen:blit(0,0,my_comp)
         if pad:cross() then
          MYCOMPUTER = true
         end      
   end



   if MYCOMPUTER == true then
      screen:blit(0,0,my_computer)
   end
end


-- Analog Control

   pad = Controls.read()
   dx = pad:analogX()
   if math.abs(dx) > 32 then
      x0 = x0 + dx / 64
   end
   dy = pad:analogY()
   if math.abs(dy) > 32 then
      y0 = y0 + dy / 64
   end

   if x0 > 470 then
      x0 = 470
   end
   if x0 < 0 then
      x0 = 0
   end
   if y0 > 270 then
      y0 = 270
   end
   if y0 < 0 then
      y0 = 0
   end



-- Time      
   time = os.time()
   dateString = os.date("%c", time)
   dateFields = os.date("*t", time)
   hour = dateFields.hour
   if hour < 12 then
      c = "AM"
   else
      c = "PM"
   end

   if hour < 10 then
      hour = "0" .. hour
   end
   min = dateFields.min
   if min < 10 then
      min = "0" .. min
   end

-- Cursor Highlighting
                     
   if y0 > 249 and x0 < 60 then
                         BarBrght = true
      end
                               
   if pad:cross() and x0>449 and y0>0 and x0<470 and y0<20 then
      MYCOMPUTER=false
   end

   if pad:cross() and x0>5 and y0>54 and x0<54 and y0<85 then
      MYCOMPUTER=false
   end

-- Always up
   
   screen:blit(0, 0, bar)
   screen:print(400, 265, hour +7 .. ":" ..min .. " " .. c,color)
   screen:blit(x0, y0, pointer)
   
   screen.waitVblankStart()
   screen.flip()
   if pad:start() then
   break
   end
DRAW()
end
Back to top
View user's profile Send private message AIM Address
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