Seite 327 von 340 ErsteErste ... 227 277 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 ... LetzteLetzte
Zeige Ergebnis 9.781 bis 9.810 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; Also, how would you put something on 0.1 pixel......

  
  1. #9781
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Also, how would you put something on 0.1 pixel...


    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  2. #9782
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von basfreak Beitrag anzeigen
    Also, how would you put something on 0.1 pixel...
    You can't. A pixel is a finite size, you can only use whole pixels.

  3. #9783
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    You can't. A pixel is a finite size, you can only use whole pixels.
    Yes, that was my point.
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  4. #9784
    Developer
    Points: 8.092, Level: 60
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    Grand Rapids! MI
    Beiträge
    125
    Points
    8.092
    Level
    60
    Downloads
    5
    Uploads
    2

    Red face

    Ok Im working on NitePR renamed DayPR for kicks and giggles,

    but i have recently tried changing the picture on the top-left corner of the screen. I know know its writing to the vram using image blitting. and it does the image blitting part using the pixel data. Thats where im having trouble at. i know the Pixel data is in the picture's hex but when i tr locating it and then put it in the telazorn.h and i compile the prx and test it out it comes up as a box with the image looking like a tv with no antenna on it. i need help cause i don't know what im doing wrong. I don't know any thing about image blitting or how to get the pixel data in the way it needs to be.

    Another thing im i need help with im adding a new tab for something that has to do with the site i am based from but i added the menu header for it but its not letting me switch to it so can someone tell me the structure of Crt0_prx.c so it will work correctly.

    i searched all around google and a lot other sites and i got nothing.


    (sorry if this is posted int the wrong section again)

  5. #9785
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    How many bits per pixel are you using to store the data in the header file? What tool are you using to convert the files from binary to source?

  6. #9786
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Hmm, can anyone help me out with audio in OSLib?
    I declare the sound: OSL_SOUND * jump;
    init the audio: oslInitAudio();
    load the sound: jump = oslLoadSoundFile("jump.mp 3", OSL_FMT_NONE);
    and play the sound: oslPlaySound(jump, 0);
    But when I press the jump button it crashes so that's at the play sound.
    Can anyone help me?
    Thanks:Punk:
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  7. #9787
    Developer
    Points: 8.092, Level: 60
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    Grand Rapids! MI
    Beiträge
    125
    Points
    8.092
    Level
    60
    Downloads
    5
    Uploads
    2

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    How many bits per pixel are you using to store the data in the header file? What tool are you using to convert the files from binary to source?
    i have it with 2 bits per pixel and i didnt really use anything to convert to source :o:o:o that is one of the things i needed help with is getting a tool to help with that cause i didnt know there was a tool for that

  8. #9788
    QJ Gamer Gold
    Points: 17.453, Level: 84
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    everywhere
    Beiträge
    3.526
    Points
    17.453
    Level
    84
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von basfreak Beitrag anzeigen
    Hmm, can anyone help me out with audio in OSLib?
    I declare the sound: OSL_SOUND * jump;
    init the audio: oslInitAudio();
    load the sound: jump = oslLoadSoundFile("jump.mp 3", OSL_FMT_NONE);
    and play the sound: oslPlaySound(jump, 0);
    But when I press the jump button it crashes so that's at the play sound.
    Can anyone help me?
    Thanks:Punk:
    try OSL_FMT_STREAM instead of OSL_FMT_NONE
    1. Failed....again...
    2. http://slicer.gibbocool.com/ stay updated on all my projects
    3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been

  9. #9789
    lol
    Points: 20.859, Level: 91
    Level completed: 2%, Points required for next Level: 491
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    Whittier, CA
    Beiträge
    5.791
    Points
    20.859
    Level
    91
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von lilmnm Beitrag anzeigen
    Ok Im working on NitePR renamed DayPR for kicks and giggles,

    but i have recently tried changing the picture on the top-left corner of the screen. I know know its writing to the vram using image blitting. and it does the image blitting part using the pixel data. Thats where im having trouble at. i know the Pixel data is in the picture's hex but when i tr locating it and then put it in the telazorn.h and i compile the prx and test it out it comes up as a box with the image looking like a tv with no antenna on it. i need help cause i don't know what im doing wrong. I don't know any thing about image blitting or how to get the pixel data in the way it needs to be.

    Another thing im i need help with im adding a new tab for something that has to do with the site i am based from but i added the menu header for it but its not letting me switch to it so can someone tell me the structure of Crt0_prx.c so it will work correctly.

    i searched all around google and a lot other sites and i got nothing.


    (sorry if this is posted int the wrong section again)
    SANiK I think used bin2c to convert his picture.
    The new tab you made, assuming you did it right actually will not be selectable until you change something. By something I mean there is a part in the source file that limits it to 5 tabs(I think nitePR has 5 tabs or so). You have to increase the number 5 assuming it is 5 to 6.

    I can tell you know little nothing of coding in C so don't try and make another knockoff of nitePR, especially since its coding is real messy.

  10. #9790
    Developer
    Points: 8.092, Level: 60
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Jul 2008
    Ort
    Grand Rapids! MI
    Beiträge
    125
    Points
    8.092
    Level
    60
    Downloads
    5
    Uploads
    2

    Wink

    Zitat Zitat von Anti-QuickJay Beitrag anzeigen
    SANiK I think used bin2c to convert his picture.
    The new tab you made, assuming you did it right actually will not be selectable until you change something. By something I mean there is a part in the source file that limits it to 5 tabs(I think nitePR has 5 tabs or so). You have to increase the number 5 assuming it is 5 to 6.

    I can tell you know little nothing of coding in C so don't try and make another knockoff of nitePR, especially since its coding is real messy.
    i seen that on goolgoe today and just downloaded it. i changed the nitprthreas value from 5 to 6 but it still didnt let me select it. i'll just trasg the new tab and remove the logger. thanx though

    and i know basicly the basic but C looks like php s i know the gist of whats going on so like i care about criticism thanx though +rep

  11. #9791
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von basfreak Beitrag anzeigen
    Hmm, can anyone help me out with audio in OSLib?
    I declare the sound: OSL_SOUND * jump;
    init the audio: oslInitAudio();
    load the sound: jump = oslLoadSoundFile("jump.mp 3", OSL_FMT_NONE);
    and play the sound: oslPlaySound(jump, 0);
    But when I press the jump button it crashes so that's at the play sound.
    Can anyone help me?
    Thanks:Punk:
    Did you check if jump is NULL before you used it? oslLoadSoundFile doesn't load MP3s.

  12. #9792
    QJ Gamer Blue
    Points: 4.111, Level: 40
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    30
    Points
    4.111
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard structure member pointing to structure of same type

    Hi everyone,

    C programming question: How do you define a structure with a member, which points to another structure of the same type?

    Maybe some sample code is easier to understand: How do I get the following to work? (myStruct is used before it's defined)
    Code:
    typedef struct {
    	int number;
    	myStruct* anotherMyStruct;
    } myStruct;
    Thanks, BenHur

    PS: I could use void*, but there has to be a more elegant solution...

  13. #9793
    QJ Gamer Blue
    Points: 4.980, Level: 45
    Level completed: 15%, Points required for next Level: 170
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    Chigasaki, Japan
    Beiträge
    226
    Points
    4.980
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Code:
    typedef struct myStruct {
    	int number;
    	struct myStruct* anotherMyStruct;
    } myStruct;
    This should do.

  14. #9794
    QJ Gamer Bronze
    Points: 6.359, Level: 52
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    france
    Beiträge
    170
    Points
    6.359
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    Did you check if jump is NULL before you used it? oslLoadSoundFile doesn't load MP3s.
    no, slicer4ever is right, when playing an mp3 with oslib with attribute OSL_FMT_NONE, it crashes. but checking if jump is null should be done anyway.
    Try my latest game (iOS):


  15. #9795
    QJ Gamer Blue
    Points: 5.672, Level: 48
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 32,0%

    Registriert seit
    Dec 2007
    Ort
    Netherlands
    Beiträge
    148
    Points
    5.672
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    I use wavs now and the stream method but if the sounds are played often I hear a cracking sound?
    Nvm, works with FMT_NONE now, thanks ;)
    Geändert von basfreak (03-18-2009 um 05:55 AM Uhr)
    [SIZE="1"][color=#D1D1FF]______________________________________________________________[/color]
    [i]Last edited by basfreak; 01-01-1990 at [color=#666686]12:00 PM[/color][/i].[/SIZE]

  16. #9796
    Points: 2.831, Level: 32
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    22
    Points
    2.831
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    How to print a variable? I tried this way, but it doesn't work.
    Code:
    printTextScreen(150, 150, mousex, white);

  17. #9797
    QJ Gamer Blue
    Points: 4.111, Level: 40
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    30
    Points
    4.111
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von kuroneko Beitrag anzeigen
    Code:
    typedef struct myStruct {
    	int number;
    	struct myStruct* anotherMyStruct;
    } myStruct;
    This should do.
    It does! Thank you!

  18. #9798
    QJ Gamer Blue
    Points: 3.795, Level: 38
    Level completed: 97%, Points required for next Level: 5
    Overall activity: 27,0%

    Registriert seit
    Jul 2007
    Beiträge
    296
    Points
    3.795
    Level
    38
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von xDeaglex Beitrag anzeigen
    How to print a variable? I tried this way, but it doesn't work.
    Code:
    printTextScreen(150, 150, mousex, white);
    Assuming printTextScreen() takes a C-style string and mousex is an integer, you could do:
    Code:
    char tempStrBuffer[12]; // mousex probably isn't that big
    snprintf(tempStrBuffer, 12, "%i", mousex);
    printTextScreen(150, 150, tempStrBuffer, white);
    However, this is a bit of C y, so you could also consider:
    Code:
    std::stringstream ss;
    ss << mousex;
    std::string mousexStr = ss.str();
    printTextScreen(150, 150, mousexStr.c_str(), white);
    if you are willing to use some C++.

  19. #9799
    Points: 2.831, Level: 32
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    22
    Points
    2.831
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von _dysfunctional Beitrag anzeigen
    Assuming printTextScreen() takes a C-style string and mousex is an integer, you could do:
    Code:
    char tempStrBuffer[12]; // mousex probably isn't that big
    snprintf(tempStrBuffer, 12, "%i", mousex);
    printTextScreen(150, 150, tempStrBuffer, white);
    However, this is a bit of C y, so you could also consider:
    Code:
    std::stringstream ss;
    ss << mousex;
    std::string mousexStr = ss.str();
    printTextScreen(150, 150, mousexStr.c_str(), white);
    if you are willing to use some C++.
    Thanks a lot.

  20. #9800
    Points: 2.908, Level: 33
    Level completed: 6%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    21
    Points
    2.908
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Hello
    Has anybody idea, to do it so the tower (wieza struct) atacks the mobs (potfur struct) only once at time ??? I mean some time ago I did it but the tower was attacking all mobs that were on map, i want 1 tower = 1 mob attacked by it. Now one tower attacks one mob but only once (so it hits it by 5hp and tower doesnt do anything next)

    Anybody help ?

    here's the attacking loop:

    Code:
    for(i = 0; i <= DefNr; i++) //main loop, 0 to towers amount
    		{
    			if(wieza[i] != NULL && !wieza[i]->isAttack) // if tower exist
    			{
    				for(b = 0; b <= MobNr; b++)//loop from 0 to mob amount
    				{	
    					
    					if(potfur[b] != NULL && potfur[b]->hp > 0 && !wieza[i]->isAttack) //if tower isnt attacking yet, the mob is not dead, and if it exist...
    					{	
    						oslDrawLine(wieza[i]->wiezaspr->x + wieza[i]->wiezaspr->sizeX/2,wieza[i]->wiezaspr->y + wieza[i]->wiezaspr->sizeY/2,
    								potfur[b]->potforek->x + potfur[b]->potforek->sizeX/2,potfur[b]->potforek->y + potfur[b]->potforek->sizeY/2,
    								RGBA(0,0,255,200)); // draws "beam"
    								potfur[b]->hp -= 5; // hits it...
    								wieza[i]->isAttack = true; // and make boolean isAttack true, so it shoudnt attack any other monster till this is death
    								
    								break;
    							
    								
    					}
    					else 
    					{
    						wieza[i]->isAttack = false; 
    						
    						
    					}
    					if(wieza[i]->isAttack) break;
    				}
    
    			}
    		
    		}

  21. #9801
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Generally looks fine to me from a glance. Are you sure it attacks everything at once? Don't forget this code will generally run up to 60 frames per second so it is making up to 60 attacks per second.

  22. #9802
    Points: 2.908, Level: 33
    Level completed: 6%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    21
    Points
    2.908
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    I want one tower to attack only one mob at time till it's dead, now it shoot only 1 beam to one mob. It stops me from developing this game

  23. #9803
    QJ Gamer Silver
    Points: 10.263, Level: 67
    Level completed: 54%, Points required for next Level: 187
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    2.326
    Points
    10.263
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von fiorello Beitrag anzeigen
    I want one tower to attack only one mob at time till it's dead, now it shoot only 1 beam to one mob. It stops me from developing this game
    I know what you want, what I am not sure is whether you are describing something that happens over one frame or something that is happening over several frames but in a very short amount of time.

    As I said above:

    "Don't forget this code will generally run up to 60 frames per second so it is making up to 60 attacks per second."

    Which is 5 hp off a monster per frame. How much health does each monster have?

  24. #9804
    Points: 2.908, Level: 33
    Level completed: 6%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Nov 2007
    Beiträge
    21
    Points
    2.908
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    I know what you want, what I am not sure is whether you are describing something that happens over one frame or something that is happening over several frames but in a very short amount of time.

    As I said above:

    "Don't forget this code will generally run up to 60 frames per second so it is making up to 60 attacks per second."

    Which is 5 hp off a monster per frame. How much health does each monster have?
    it will depends on level (1lvl = 750hp what means about 4sec to kill, and it's per frame.

  25. #9805
    Points: 2.831, Level: 32
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    22
    Points
    2.831
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    Hello, is there any function to change printing text size? Thank you.

  26. #9806
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    I think debug is a specific size, are you using debug text?

  27. #9807
    Points: 2.831, Level: 32
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    22
    Points
    2.831
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von eldiablov Beitrag anzeigen
    I think debug is a specific size, are you using debug text?
    To print a text i'm using printTextScreen();

  28. #9808
    Banned for LIFE
    Points: 18.744, Level: 86
    Level completed: 79%, Points required for next Level: 106
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    East London, England
    Beiträge
    2
    Points
    18.744
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    I would advise you to stop using graphics.c :/

  29. #9809
    xMod.
    Points: 4.576, Level: 43
    Level completed: 13%, Points required for next Level: 174
    Overall activity: 0%

    Registriert seit
    Oct 2008
    Ort
    Melbourne, Australia
    Beiträge
    675
    Points
    4.576
    Level
    43
    My Mood
    Daring
    Downloads
    0
    Uploads
    0

    Standard

    Use pspDebugScreenPrintf instead.
    It's much more reliable.

    --SLasher

  30. #9810
    Points: 2.831, Level: 32
    Level completed: 54%, Points required for next Level: 69
    Overall activity: 0%

    Registriert seit
    Mar 2008
    Beiträge
    22
    Points
    2.831
    Level
    32
    Downloads
    0
    Uploads
    0

    Standard

    I don't know how in pspDebugScreenPrintf set x, y coordinates, color, size..
    Where i can get more information about pspDebugScreenPrintf?
    Geändert von xDeaglex (03-21-2009 um 01:01 AM Uhr)


 

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:27 PM Uhr.

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