![]() |
| 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 |
![]() ![]() ...in a dream...
|
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...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#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 |
![]() ![]() ...in a dream...
|
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...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#274 | |
![]() ![]() Developer
|
Quote:
Last edited by SodR; 05-31-2006 at 11:54 AM.. |
|
|
|
|
|
|
#275 |
![]() ![]() ...in a dream...
|
Mental blocks are pretty common in programming i guess...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#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 |
![]() ![]() ...in a dream...
|
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;
}
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#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 12:32 PM.. |
|
|
|
|
|
#279 |
![]() ![]() Developer
|
Ok this sounds dumb but, is it:
Code:
pspWaitVblankStart(); I cant remember what it was lol. |
|
|
|
|
|
#281 |
![]() ![]() Developer
|
ok thankyou
|
|
|
|
|
|
#283 |
![]() ![]() Developer
|
Code:
sceDisplayWaitVblankStart(); (Yes I know im dumb )
|
|
|
|
|
|
#284 | |
![]() ![]() Developer
|
Quote:
Last edited by SodR; 06-02-2006 at 07: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 03: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 |
![]() ![]() ...in a dream...
|
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.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#290 |
![]() ![]() Developer
|
Thanks
I got that sorted out and some other errors and it compiles now Thankyou SG57!
|
|
|
|
|
|
#291 | |
![]() ![]() ...in a dream...
|
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...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) Last edited by SG57; 06-04-2006 at 03:55 AM.. |
|
|
|
|
|
|
#292 |
![]() ![]() Developer
|
How do you use ascii with flib??
eg. Code:
text_to_screen(" %s\n", dirEntry->d_name, 350, 50);
|
|
|
|
|
|
#293 |
![]() ![]() ...in a dream...
|
..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...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#294 | |
![]() ![]() Developer
|
Quote:
Code:
text_to_screen(dirEntry->d_name, 350, 50); |
|
|
|
|
|
|
#295 |
![]() ![]() ...in a dream...
|
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...)
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#296 | |
![]() ![]() Developer
|
Quote:
If you send \n to flib, you'll get a backslash and an "n". |
|
|
|
|
|
|
#297 |
![]() ![]() ...in a dream...
|
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...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#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 | |
|
|