 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
MiKA-
Joined: 04 Mar 2006 Posts: 6
|
Posted: Sat Mar 04, 2006 12:14 am Post subject: Graphic tutorials? |
|
|
Hi,
I started coding to PSP near the christmas by first borrowing some C-programming books from my library, and then I read all Yealdarb's programming tutorials, so I know a little bit of coding now.
But for now, I'd like to see some graphical samples, like making a bouncing ball or box to the screen (Just like the one in the msgdialog-sample of PSP-SDK, but without those dialogs)
Also, I'd like to know how could I make those text lines which I printed with "pspDebugScreenPrintf" command to bounce/scroll over the scree?
Thanks already for all your answers, hopefully somebody knows where to find graphical samples and how to make that text bounce/scroll :)
Cheers,
Mika- |
|
| Back to top |
|
 |
Koba
Joined: 29 Sep 2005 Posts: 59
|
Posted: Sat Mar 04, 2006 4:49 am Post subject: |
|
|
basically for things like moving text, you cannot use printf, you woulld need to use the function that Brad gives you in one of his tutorials, its | Code: | | printTextScreen(x, y, char, color); |
to make that text move around, just put it in a for loop,
make an x and y integer
| Code: | int x = 10;
int y = 50; |
then make a char
now put text into the char
| Code: | | sprintf(thistext, "Bouncing text test"); |
then print your text
| Code: | | printTextScreen(x, y, thistext, black); |
(make sure you have a rgb color for that command, hence i used black) then simply add one to x and y everytime it loops
then of course close your for loop and what not, i'm not going to walk you through bounding it off the walls as you can probably figure it out from there, if not there are plenty of animation tutorials on the web. hope this kinda helps. |
|
| Back to top |
|
 |
MiKA-
Joined: 04 Mar 2006 Posts: 6
|
Posted: Sat Mar 04, 2006 12:54 pm Post subject: |
|
|
| Koba wrote: | | basically for things like moving text, you cannot use printf, you woulld need to use the function that Brad gives you in one of his tutorials |
Actually, that helped a lot, thanks! :)
EDIT:
| Koba wrote: | | if not there are plenty of animation tutorials on the web |
Could you give me a link to those animation tutorials, I was trying to google them but I got nothing :( Thanks already if you can! |
|
| Back to top |
|
 |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Sun Mar 05, 2006 8:08 pm Post subject: |
|
|
Simply make an array of Image pointers and blit the first one, then just increase the array element number by 1 and the next image will blit, making an animation if timed right to not go too fast or slow.
animation with 3 images
| Code: |
Image* array[3];
array[0] = loadImage("image.png");
array[1] = loadImage("image2.png");
array[2] = loadImage("image3.png");
// ALL THE OTHER IMAGE BLITTING OPERATIONS GO HERE //
int x = 0;
int i;
while(1) {
blitAlphaImageToScreen(0, 0, 480, 272, array[x], 0, 0);
for(i=0; i<10; i++) x++;
} |
That should work, but I did leave out some basic Image Loading functions, so just place them in there as I am tired right now and dont have the energy to. |
|
| 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
|