 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Stretch Arm-Strong
Joined: 11 Oct 2005 Posts: 5
|
Posted: Wed Oct 12, 2005 6:46 am Post subject: Adding custom image to cursor tut |
|
|
I took the cursor script, and used it...but than im like, how cool would it be to slap a pic. of myself or a pic. of my teacher for instance haha, and be able to draw all over that....instead of having CANVAS = CLEAR(WHITE) i tried the following....
+++++++++++++++++++++++++++++++++++++++++++
System.usbDiskModeActivate()
pink = Color.new(255, 0, 255);
white = Color.new(255, 255, 255);
canvas = Image.load("background.png")
canvas:background.png
brush = {}
eraser = {}
x0 = 0
y0 = 0
x1 = 0
y1 = 0
while true do
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 pad:cross() then
canvas:drawLine(x0, y0, x1, y1, white)
end
x1 = x0
y1 = y0
screen:blit(0, 0, canvas, 0, 0, canvas:width(), canvas:height(), false)
screen:drawLine(x1 - 5, y1, x1 + 5, y1, pink)
screen:drawLine(x1, y1 - 5, x1, y1 + 5, pink)
screen.waitVblankStart()
screen.flip()
if pad:start() then break end
if pad:select() then screen:save("screenshot.tga") end
end
++++++++++++++++++++++++++++++++++++++++
what did i do wrong and what do i do to fix it
--Stretch Arm-Strong |
|
| Back to top |
|
 |
JoshDB

Joined: 05 Oct 2005 Posts: 87
|
Posted: Wed Oct 12, 2005 8:38 am Post subject: |
|
|
x1 = 240
y1 = 136
X_MAX = 480
Y_MAX = 272
X_MIN = 0
Y_MIN = 0
speed = 32
cursor = Image.load("CURSOR.png")
function CursorPos()
dx = button:analogX()
if math.abs(dx) > 32 then
x1 = x1 + dx / speed
if x1 > X_MAX then
x1 = X_MAX
end
if x1 < X_MIN then
x1 = X_MIN
end
end
dy = button:analogY()
if math.abs(dy) > 32 then
y1 = y1 + dy / speed
if y1 > Y_MAX then
y1 = Y_MAX
end
if y1 < Y_MIN then
y1 = Y_MIN
end
end
end
function PSPEnvCreate:Render()
screen:blit(x1, y1, cursor)
end
while true do
screen:clear()
button = Controls.read()
CursorPos()
Render()
screen.waitVblankStart(1)
screen.flip()
end |
|
| Back to top |
|
 |
Stretch Arm-Strong
Joined: 11 Oct 2005 Posts: 5
|
Posted: Wed Oct 12, 2005 9:13 am Post subject: |
|
|
| i didnt want the cursor to be a pic. i wanted the canvas to be a pic... thnx for that anyway |
|
| Back to top |
|
 |
Stretch Arm-Strong
Joined: 11 Oct 2005 Posts: 5
|
Posted: Wed Oct 12, 2005 10:31 am Post subject: |
|
|
| FIGURED IT OUT |
|
| Back to top |
|
 |
|
|
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
|