![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; If you mean cut a sprite sheet up then yes, you can... You use the offsets to do it... Image ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#271 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
If you mean cut a sprite sheet up then yes, you can...
You use the offsets to do it... Image dimensions of 100x100. Cut it in 2... use the offsets for the first image ( 0, 50 ) Im jsut guessing on the use of the offsets, but i do know you use them to cut a sprite sheet up...
__________________
|
|
|
|
|
|
#272 |
![]() |
Hi, I learn lua quit a wild ago but im more interested in C/C++ where can i start i mean which are the best tut to start whit.
__________________
Free Prizes at [url=http://www.prizerebel.com/index.php?r=189687]Prizerebel[/url] Join us! I already got [b]11[/b] Gifts. Ask me for details or proof. |
|
|
|
|
|
#273 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
ok... go to www.psp-programming.com thats where all the actual developers chill now a days
youll find tutorials to get you started, then examples and general help on how to code in C/C++... even LUA, this forum hasnt really any real hardcore LUA dev's that dont know about psp-programming.com ...This forum is now more of a release thread... |
|
|
|
|
|
#274 | |
![]() ![]() Developer
|
Quote:
Last edited by SodR; 05-31-2006 at 10:54 AM.. |
|
|
|
|
|
|
#276 |
![]() ![]() Developer
|
When I try to animate a screen the second picture in the animation is displayed below the first one instead of on it.
This is the animation code: Code:
char intro_buffer[200]; Image* intro; sprintf(intro_buffer, "./Intro.png"); intro = loadImage(intro_buffer); char white_buffer[200]; Image* white; sprintf(white_buffer, "./white.png"); white = loadImage(white_buffer); screenblit(0, 0, 480, 272, white, 0, 0); screenblit(0, 0, 248, 59, intro, 120, 120); flipScreen(); sceKernelDelayThread(1000000); screenblit(0, 0, 480, 272, white, 0, 0); screenblit(0, 59, 248, 118, intro, 120, 120); flipScreen(); sceKernelDelayThread(1000000); screenblit(0, 0, 480, 272, white, 0, 0); screenblit(0, 118, 248, 177, intro, 120, 120); flipScreen(); sceKernelDelayThread(1000000); screenblit(0, 0, 480, 272, white, 0, 0); screenblit(0, 177, 248, 224, intro, 120, 120); flipScreen(); sceKernelDelayThread(1000000); Code:
void screenblit(int posx, int posy, int sizex, int sizey, Image* imagevar, int dx, int dy) {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x < sizex) {
while (y < sizey) {
blitAlphaImageToScreen(posx ,posy ,sizex , sizey, imagevar, dx, dy);
y += sizey;
}
x += sizex;
y = 0;
}
}
btw. the sceKernelDelayThread() is just temporary used. I'm just using it with my testings. |
|
|
|
|
|
#277 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
1. Put your images into an array for animation.
2. Dont flip the screen/draw buffer more then once (when animating) 3. Try this for a crappyly timed timer, and i havent tested it, its raw code i havent tested: Code:
Image* animation[2];
animation[0] = loadImage("./Intro.png");
animation[1] = loadImage("./white.png");
actualImage = animation[0];
int x = 0, fakeTimer = 0;
while(1) {
screenblit(all that jazz here, animation[x], all that jazz here);
if (fakeTimer > 500 && fakeTimer<1000) x=1;
else {
x=0;
}
if (fakeTimer > 1000) { fakeTimer = 0;
}
|
|
|
|
|
|
#278 |
![]() ![]() Developer
|
Thanks for the good example. But is there a way to do that with one "master" image ( that contains several sprites ) and ripping seperate sprites out of it??
Last edited by SodR; 06-01-2006 at 11:32 AM.. |
|
|
|
|
|
#279 |
![]() ![]() Developer
|
Ok this sounds dumb but, is it:
Code:
pspWaitVblankStart(); I cant remember what it was lol. |
|
|
|
|
|
#284 | |
![]() ![]() Developer
|
Quote:
Last edited by SodR; 06-02-2006 at 06:41 AM.. |
|
|
|
|
|
|
#287 |
![]() ![]() Developer
|
Does anyone have any tips of speeding up your program except changeing the cpus clock frequency?? (It mainly goes slow because of that it have many big images blited to the screen).
Last edited by SodR; 06-03-2006 at 02:22 AM.. |
|
|
|
|
|
#288 |
![]() ![]() Developer
|
Ok guys im in need of help. Im trying to compile my program and it says:
main.c:391: error: syntax error at end of input Line 391 is the very last line. Here is the last 4 lines (as I dont want people to see my code) Code:
// Exit Program
while (1) {
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons & PSP_CTRL_CROSS) {
MP3_Stop();
MP3_FreeTune();
sceKernelExitGame();
break;
}
}
return 0;
}
|
|
|
|
|
|
#289 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
kozine - Its not necessarly your last lines that is making the error... the Complier here is complaining you have left a '{' bracket open, or added an extra '}' somewhere, my advice is to get a good code editing software (UltaEdit or Dev-C++) and it will highlight the backets start and finish ones, that way you can find the problem... Hope this helps.
|
|
|
|
|
|
#291 | |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
Thats what this thread is for. Quote:
1. Use external globals to help not make a brand new C source file just to have the same variable in 2 files 2. Use static variables instead of configuration files, that way theres no need to read/write from the mem stick for an always changing/same starting position variable... Last edited by SG57; 06-04-2006 at 02:55 AM.. |
|
|
|
|
|
|
#292 |
![]() ![]() Developer
|
How do you use ascii with flib??
eg. Code:
text_to_screen(" %s\n", dirEntry->d_name, 350, 50);
|
|
|
|
|
|
#293 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
..SodR, flib is for displaying True Type Fonts (TTF), no?
The prototype for the text_to_screen doesnt support optional parameters, there for you must feed the diretory names and the '\n' character into na buffer before printing: Code:
char buffer[255]; struct dirent *dirEntry; sprintf(buffer, " %s\n", dirEntry->d_name); text_to_screen(buffer, 350, 50);] Oh and if your going to be changing directories, make sure you 'sprintf' again, orelse the 'd_name' / file list, wont be updated to display the n ewe files in the new folder... |
|
|
|
|
|
#294 | |
![]() ![]() Developer
|
Quote:
Code:
text_to_screen(dirEntry->d_name, 350, 50); |
|
|
|
|
|
|
#295 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
Samstag - no, not neccesarly, that will print out the filenames, but no enter character, thus making it all one line...
(Unless the structure itself has a built in \n but i have tried it wihtout and it doesnt...) |
|
|
|
|
|
#296 | |
![]() ![]() Developer
|
Quote:
If you send \n to flib, you'll get a backslash and an "n". |
|
|
|
|
|
|
#297 |
![]() ![]() words are stones in my <3
My Mood:
Join Date: Jul 2005
Real First Name: Jordan
Location: Spokane
Just Played: LotRO
Posts: 4,971
Trader Feedback: 0
|
Well i was assuming he was displaying the entire list of the filenames in the directory via a 'for' loop... meaning each time the loop repeated, it print the next filename, one line below...
|
|
|
|
|
|
#298 | ||
![]() ![]() Developer
|
Quote:
![]() Quote:
|
||
|
|
|
|
|
#299 | |
![]() ![]() Developer
|
Quote:
Code:
int y = 50;
for(i = 0; i < NUMBER_OF_LINES; i++)
{
text_to_screen(line[i], 350, y);
y += 16;
}
|
|
|
|
|
|
|
#300 | |
![]() ![]() Developer
|
Quote:
btw. I assume that "i" is an integer with a value of 0 ( int i = 0; ) |
|
|
|
|
![]() |
| Tags |
| c or c , c++ , c/c++ , code , coding , c_language , programming , psp , psp programming , thread |
| Thread Tools | |
|
|