 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Tue Oct 11, 2005 3:30 am Post subject: screen:drawLine(-10, -10, 100, 50, red) ie off screen |
|
|
will result in the same as a screen:drawLine(0, 0, 100, 50, red)
my question, how do you make it so that the line goes in the right place?
ie to the edge of the screen as though it would end at -10, -10. im new to lua and building off of the paint tutorial :). if you need to see my code i can post it for you :) |
|
| Back to top |
|
 |
Giuliano
Joined: 13 Sep 2005 Posts: 78
|
Posted: Tue Oct 11, 2005 3:44 am Post subject: |
|
|
Well an easy way is to use absolute value to shorten the width and offset the x.. for example..
Pseudo Code:
| Code: |
x1=-20
offsetx=0
if (x1<0) then
offsetx=math.abs(x1)
end
-- do the same thing for Y
screen:drawline(x1+offsetx,y1+offsety,x2-offsetx,y2-offsetx,red)
|
This also works when you are blitting outside of the screen. I REALLY don't recommend ever using negative values when drawing anything in Lua because sometimes it might work but not all the time. I noticed that in my game, so offset like I showed above:) |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Tue Oct 11, 2005 4:35 am Post subject: |
|
|
hmm i see where you are coming from, but that seems like a lot of hassle, especially if i have much larger models being drawn etc.
take a look at this
http://host-a.net/getfile.php?usern=monkey%20dude&file=ship.zip (left click)
move the ship off to the side and you will see what im talking about. controls are x fire ^ change arc and l + r aim. anyone who can help me will be hailed as a god in the credits of this game :D
dont comment on the state of my code.... :P |
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Tue Oct 11, 2005 4:51 am Post subject: |
|
|
| Currently there is no real clipping implemented, just a if (x<0) x=0 and the like, so it might looks strange, if you are using coordinates which are not on-screen or on-image. I've added it to the TODO list at http://wiki.ps2dev.org/psp:lua_player:todos |
|
| Back to top |
|
 |
jimjamjahaa
Joined: 03 Oct 2005 Posts: 17
|
Posted: Tue Oct 11, 2005 5:30 am Post subject: |
|
|
aha! i see.
thx again shine, you are the most helpful person ever :D
i will have to implement my own clipping etc. |
|
| 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
|