Seite 10 von 340 ErsteErste 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 60 110 ... LetzteLetzte
Zeige Ergebnis 271 bis 300 von 10174

C/C++ Programming Help Thread

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 ...

  
  1. #271
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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...



    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  2. #272
    QJ Gamer Silver
    Points: 11.326, Level: 70
    Level completed: 19%, Points required for next Level: 324
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    871
    Points
    11.326
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    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 Prizerebel Join us!
    I already got 11 Gifts. Ask me for details or proof.

  3. #273
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  4. #274
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    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...
    Yes, of course you can do that. How stupid of me. Thanks anyway.
    Geändert von SodR (05-31-2006 um 10:54 AM Uhr)

  5. #275
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    Mental blocks are pretty common in programming i guess...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  6. #276
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    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);
    This is the screenblit function. I borrowed it from FlashMod and added a function to it so you can choose where to display the image (this might be the problem?):
    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;
    	}
    }
    Thanks in advance.

    btw. the sceKernelDelayThread() is just temporary used. I'm just using it with my testings.

  7. #277
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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;
    }
    Try that or soimething allong the lines... oh and there blitting lower because you put eah image's Y co-ordinate higher then the other one, thus meanig it slower on the screen since the Y value it upside down.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  8. #278
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    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??
    Geändert von SodR (06-01-2006 um 11:32 AM Uhr)

  9. #279
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Ok this sounds dumb but, is it:

    Code:
    pspWaitVblankStart();
    ??
    I cant remember what it was lol.


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  10. #280
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von kozine
    Ok this sounds dumb but, is it:

    Code:
    pspWaitVblankStart();
    ??
    I cant remember what it was lol.
    It's
    Code:
     sceDisplayWaitVblankStart();

  11. #281
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    ok thankyou


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  12. #282
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von kozine
    ok thankyou
    No problem. This thread is about helping, right? :)

  13. #283
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    sceDisplayWaitVblankStart();
    is it in mili seconds? If so, how many mili seconds to a second?

    (Yes I know im dumb ;))


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  14. #284
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von kozine
    Code:
    sceDisplayWaitVblankStart();
    is it in mili seconds? If so, how many mili seconds to a second?

    (Yes I know im dumb ;))
    1000mili secs = 1sec.
    Geändert von SodR (06-02-2006 um 06:41 AM Uhr)

  15. #285
    QJ Gamer Platinum
    Points: 57.528, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Ort
    h0000000rj
    Beiträge
    12.867
    Points
    57.528
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SodR
    1000000mili secs = 1sec.
    Um, no. 1000ms = 1s. mili = thousandth.
    [I fail @ life]

  16. #286
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von FreePlay
    Um, no. 1000ms = 1s. mili = thousandth.
    Yes, my mistake. What I said was in micro secs.

    Now it's edited =)

  17. #287
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    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).
    Geändert von SodR (06-03-2006 um 02:22 AM Uhr)

  18. #288
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    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;
    
    }


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  19. #289
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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.

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  20. #290
    Developer
    Points: 12.360, Level: 72
    Level completed: 78%, Points required for next Level: 90
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Ort
    Isle of Wight
    Beiträge
    491
    Points
    12.360
    Level
    72
    Downloads
    0
    Uploads
    0

    Standard

    Thanks :) I got that sorted out and some other errors and it compiles now :) Thankyou SG57!


    PM me for a sig like this!

    http://dspspforums.com/forums/index.php SIGN UP NOW!

  21. #291
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    :twisted:

    Thats what this thread is for.

    Zitat Zitat von SodR
    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).
    yes, i have some...

    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...
    Geändert von SG57 (06-04-2006 um 02:55 AM Uhr)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  22. #292
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    How do you use ascii with flib??

    eg.
    Code:
     text_to_screen("  %s\n", dirEntry->d_name, 350, 50);
    doesn't work =S. Samstag told me that ascii was supported in flib. I get the "to many arguments to function" error...

  23. #293
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    ..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);]
    hope that helps...

    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...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  24. #294
    Developer
    Points: 7.058, Level: 55
    Level completed: 54%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    408
    Points
    7.058
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SodR
    How do you use ascii with flib??

    eg.
    Code:
     text_to_screen("  %s\n", dirEntry->d_name, 350, 50);
    doesn't work =S. Samstag told me that ascii was supported in flib. I get the "to many arguments to function" error...
    You still seem to be confused about ascii. Your example shows printf escape codes, not ascii.

    Code:
    text_to_screen(dirEntry->d_name, 350, 50);
    This is all you need to do in this case.

  25. #295
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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...)

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  26. #296
    Developer
    Points: 7.058, Level: 55
    Level completed: 54%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    408
    Points
    7.058
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    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...)
    The variable dirEntry->d_name is a single filename, not a list of names.

    If you send \n to flib, you'll get a backslash and an "n".

  27. #297
    words are stones in my <3
    Points: 35.274, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Spokane
    Beiträge
    5.008
    Points
    35.274
    Level
    100
    My Mood
    Lonely
    Downloads
    1
    Uploads
    0

    Standard

    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...

    ...at what speed must I live.. to be able to see you again?...

    Projects

    You can support my Open World 3D RPG for PSP by voting for it here


  28. #298
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Samstag
    You still seem to be confused about ascii. Your example shows printf escape codes, not ascii.

    Code:
    text_to_screen(dirEntry->d_name, 350, 50);
    This is all you need to do in this case.
    I have never acctually used those kind of stuff very much but in my program I needed to use those functions. Thanks for informing me what it's called anyway. :)

    Zitat Zitat von Samstag
    If you send \n to flib, you'll get a backslash and an "n".
    Then what do you use for newline??

  29. #299
    Developer
    Points: 7.058, Level: 55
    Level completed: 54%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    408
    Points
    7.058
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SodR
    Then what do you use for newline??
    Change the Y value when you send the next line. You start with a Y value of 50 in your example. If you're using a 14 point font you could probably add 16 for each new line like this:
    Code:
    int y = 50;
    
    for(i = 0; i < NUMBER_OF_LINES; i++)
    {
            text_to_screen(line[i], 350, y);
            y += 16;
    }
    I'll probably add simple support for newlines in a later version.

  30. #300
    Developer
    Points: 10.075, Level: 67
    Level completed: 7%, Points required for next Level: 375
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Sweden
    Beiträge
    941
    Points
    10.075
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Samstag
    Change the Y value when you send the next line. You start with a Y value of 50 in your example. If you're using a 14 point font you could probably add 16 for each new line like this:
    Code:
    int y = 50;
    
    for(i = 0; i < NUMBER_OF_LINES; i++)
    {
            text_to_screen(line[i], 350, y);
            y += 16;
    }
    I'll probably add simple support for newlines in a later version.
    When I do like this I get a "makes pointer from integer without a cast" error. I can't figure out why. Do you know what to do to fix this?

    btw. I assume that "i" is an integer with a value of 0 ( int i = 0; )


 
Seite 10 von 340 ErsteErste 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 60 110 ... LetzteLetzte

Tags for this Thread

Forumregeln

  • Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
  • Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
  • Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
  • Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
  •  





Alle Zeitangaben in WEZ -8. Es ist jetzt 09:15 PM Uhr.

Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © , Caputo Media, LLC. All Rights Reserved. Cluster .