Seite 288 von 340 ErsteErste ... 188 238 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 338 ... LetzteLetzte
Zeige Ergebnis 8.611 bis 8.640 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; Zitat von joseph10444 wait so in C you cannot define where text goes like LUA??? you have to skip lines?? ...

  
  1. #8611
    QJ Gamer Green
    Points: 5.712, Level: 48
    Level completed: 81%, Points required for next Level: 38
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    USA SC/NC
    Beiträge
    699
    Points
    5.712
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von joseph10444 Beitrag anzeigen
    wait so in C you cannot define where text goes like LUA???

    you have to skip lines??
    pspDebugScreenSetXY(x, y);


    [CODE]Random Facts:
    irc://irc.malloc.us #wtf #**********
    [/CODE]

    [SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]

  2. #8612
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    Zitat Zitat von Moca Beitrag anzeigen
    pspDebugScreenSetXY(x, y);
    so is it like this?? (do they have to be in capitals)

    "
    pspDebugScreenSetXY (126,110);
    printf ("Hi guys.");
    "

    then its set to 126 110

  3. #8613
    QJ Gamer Green
    Points: 5.712, Level: 48
    Level completed: 81%, Points required for next Level: 38
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    USA SC/NC
    Beiträge
    699
    Points
    5.712
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von joseph10444 Beitrag anzeigen
    so is it like this?? (do they have to be in capitals)

    "
    pspDebugScreenSetXY (126,110);
    printf ("Hi guys.");
    "

    then its set to 126 110
    Yeah. If you are constantly changing the x,y values to custom ones each time you call printf, I'd make a function to do that >_>

    Code:
    int pspDebugScreenPrintfXY(int x, int y, char* string, ...);
    Of course you would need to learn about variable arguments, but would make things easier if you needed a function similar to the one above

    And to answer your second question.
    Variables, function names, types, etc... are all case sensitive so case does matter. If everything is declared in all caps, then use it as it was declared.

    Anyway, your code looks fine.
    [CODE]Random Facts:
    irc://irc.malloc.us #wtf #**********
    [/CODE]

    [SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]

  4. #8614
    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

    I believe the debug console uses a character place x and y value, not pixel x and y values (so (4,10) will move over 4 characters spots and down 10 (from the top left))

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


  5. #8615
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    oh...
    now thats kinda CHEAP!!!
    ..

    but thats another problem Moca
    in my code...
    OH LOL NVM..
    i seemed to have forgot the ";" at the end of my SetXY
    ..

  6. #8616
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    how can you set text on colour?
    im sorry im so new to this...
    i have to read more tutorials on calling functions

  7. #8617
    QJ Gamer Gold
    Points: 20.111, Level: 89
    Level completed: 53%, Points required for next Level: 239
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    Houston, Texas
    Beiträge
    3.349
    Points
    20.111
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    I am a new learning developer, but I think its like this:

    pspDebugScreenPrint (X, Y, Text, Color);

    Just try popping in some hex values for a color, try that.

    PSN: TrueDef
    AIM: TrueDef91
    Prestige 7 On COD4

  8. #8618
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    No, wrong, false.

    Code:
    pspDebugScreenSetTextColor(u32 color)
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  9. #8619
    QJ Gamer Gold
    Points: 20.111, Level: 89
    Level completed: 53%, Points required for next Level: 239
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    Houston, Texas
    Beiträge
    3.349
    Points
    20.111
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Archaemic Beitrag anzeigen
    No, wrong, false.

    Code:
    pspDebugScreenSetTextColor(u32 color)
    So it couldn't be all in one line with the coordinates at all? Sorry, I am really new.

    PSN: TrueDef
    AIM: TrueDef91
    Prestige 7 On COD4

  10. #8620
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    wow i have to put in a lot of these pspDebugScreenSetxxxxxxxx xxxx

    do i replace u32 or colour?

  11. #8621
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Both. The u32 just signifies that what you're putting in there is of type u32--that is, unsigned 32-bit integer.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  12. #8622
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    can i replace colour with any colour lke blue

  13. #8623
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    You need the hexcode for the color. You can't just put in "blue".
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  14. #8624
    QJ Gamer Gold
    Points: 20.111, Level: 89
    Level completed: 53%, Points required for next Level: 239
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    Houston, Texas
    Beiträge
    3.349
    Points
    20.111
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    So like this:

    Code:
    pspDebugScreenSetTextColor(u32 FFFFFF)

    PSN: TrueDef
    AIM: TrueDef91
    Prestige 7 On COD4

  15. #8625
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Sullivan Beitrag anzeigen
    So like this:

    Code:
    pspDebugScreenSetTextColor(0xFFFFFF)
    Fixed.

    (This is the hexcode for pure white, by the way)
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  16. #8626
    QJ Gamer Gold
    Points: 20.111, Level: 89
    Level completed: 53%, Points required for next Level: 239
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Ort
    Houston, Texas
    Beiträge
    3.349
    Points
    20.111
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Ok, cool, thanks man, even though I didn't need this, I know now for the future.

    PSN: TrueDef
    AIM: TrueDef91
    Prestige 7 On COD4

  17. #8627
    QJ Gamer Bronze
    Points: 6.517, Level: 52
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Ort
    Ireland
    Beiträge
    978
    Points
    6.517
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    in c++ i use

    #define blue 0x0000ff

    pspDebugScreenSetTextColo r(blue);
    printf("Helloworld");

    prints helloworld in blue text color! But in C it may be different.

  18. #8628
    QJ Gamer Platinum
    Points: 66.627, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    National Front Disco
    Beiträge
    13.057
    Points
    66.627
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Nope, C would be the same.

  19. #8629
    QJ Gamer Bronze
    Points: 6.517, Level: 52
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Ort
    Ireland
    Beiträge
    978
    Points
    6.517
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    also i dont know why the r is taken a space when i edit it it doesn't appear like that ( pspDebugScreenSetTextColo ur(Blue); )

    -=Double Post=-

    Ok cool

  20. #8630
    QJ Gamer Platinum
    Points: 66.627, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    National Front Disco
    Beiträge
    13.057
    Points
    66.627
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    The space appears to prevent exploits, which exploits I'm not sure.

    Also, when you post any code, place it in the [CODE] tags, please. :)

  21. #8631
    QJ Gamer Bronze
    Points: 6.517, Level: 52
    Level completed: 84%, Points required for next Level: 33
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Ort
    Ireland
    Beiträge
    978
    Points
    6.517
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Ok will do

  22. #8632
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard Scrolling in C

    Hey all,
    Can someone explain me how I make a scrolling map in C.
    I've made a map like this:
    int main() {
    Image* texture1Img;
    Image* texture2Img;
    Image* tree1Img;
    Image* wall1Img;

    pspDebugScreenInit();
    SetupCallbacks();
    initGraphics();

    texture1Img = loadImage("texture1.png") ;
    texture2Img = loadImage("texture2.png") ;
    tree1Img = loadImage("tree1.png");
    wall1Img = loadImage("wall1.png");

    int x = 0;
    int y = 0;
    sceDisplayWaitVblankStart ();
    while (x < 2000) {
    while (y < 2000) {
    blitAlphaImageToScreen(0 ,0 ,32 , 32, texture1Img, x, y);
    y += 32;
    }
    x += 32;
    y = 0;
    }
    blitAlphaImageToScreen(0 ,0 ,32 , 32, tree1Img, 50, 50);
    flipScreen();
    }


    Thats all now I've drawn an texture as a background from 2000 x and 2000 y.
    All I want now is that it must scroll when playerx and playery gets at some kind of distance from the screen 480, 272.
    I think I must make a 2 variables that got the value of the screen height and width, then when player gets at 400 or 200 the screen moves.
    But I don't really know how to do that in C, can someone explain me? I would really apreciate that!

  23. #8633
    QJ Gamer Green
    Points: 5.795, Level: 49
    Level completed: 23%, Points required for next Level: 155
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Cape Town, South Africa
    Beiträge
    714
    Points
    5.795
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Have two variables that keeps track of what point in the world the top-left corner of the screen represents. Move that around when the player is near the edge of the screen. Then subtract these co-ordinates from the co-ordinates of the object you're drawing to get the position on the screen where you have to draw it.

  24. #8634
    QJ Gamer Green
    Points: 3.008, Level: 33
    Level completed: 72%, Points required for next Level: 42
    Overall activity: 0%

    Registriert seit
    May 2008
    Beiträge
    96
    Points
    3.008
    Level
    33
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von coolguy5678 Beitrag anzeigen
    Have two variables that keeps track of what point in the world the top-left corner of the screen represents. Move that around when the player is near the edge of the screen. Then subtract these co-ordinates from the co-ordinates of the object you're drawing to get the position on the screen where you have to draw it.
    So you mean:
    top-left corner is at begin x=0 y=0
    screenx=0
    screeny=0
    when player=screenx+480-100
    screenx=screenx+playerxsp eed

    okay lets say now
    screenx=200
    screeny=0

    This is till where I understand it..
    You say subtract these coördinates from the object your drawing to get the position on the screen where you have to draw it.
    I don't understand that, the problem is not that I don't know where to draw the (player-)object.
    I don't know how to move the screen to another position, the (player-)object got already the right position.
    Or do you mean something else with object.

  25. #8635
    NetGameOrb Maker
    Points: 6.138, Level: 50
    Level completed: 94%, Points required for next Level: 12
    Overall activity: 0%

    Registriert seit
    Jan 2008
    Ort
    New York
    Beiträge
    683
    Points
    6.138
    Level
    50
    My Mood
    Cheerful
    Downloads
    2
    Uploads
    0

    Standard

    maybe you can try something like this
    -----------------------------------------------------------------code--------------
    screenx = 0 //screen x
    screeny = 0 //and y

    playerx =0 //player x
    playery =0 //player y

    mapW = 512 //map width
    mapH = 512 //map hight

    blitAlphaImageToScreen(0 ,0 ,480, 272, mapImg, screenx,screeny); //blit the map from screen x and screen y
    blitAlphaImageToScreen(0 ,0 ,32, 32, playerImg, playerx,playery);//blit player

    if (player x>480) {
    playerx = 0; //reset the player x like what Zelda does
    screenx = screenx + 480; //move screenx in map to the left
    if (screenx > mapW) {
    screenx = mapW; //make sure that screen x does not pass the map wight if so the set it to map wight
    }
    }
    ...
    ---------------------------------------------------------------------end of code-----
    so on and so on
    do you understand now?
    :)
    GameLive name changed to NetGameOrb, Project is now online in Beta stage. Everyone encourage to register so they get news about the project and ability to play the games with NetGameOrb Support online. More info on site.

    Stats Blog:http://netgameorb.blogspot.com/
    Website:http://www.netgameorb.com/

  26. #8636
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    how can i find Hex values of colours??
    all i know is RGB-ing lol

  27. #8637
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    The PSP takes colour values in 0xAABBGGRR format.

    Which you can create using the GU_RGBA macro.

    Code:
    unsigned int color = GU_RGBA(255, 255, 255, 255);
    Is white, fuly opaque (0xFFFFFFFF).

    0xFF0000FF is red.

    0xFF00FF00 is green.

    0xFFFF0000 is blue.

    255 is 0xFF in hex.

    Google is good for decimal to hex convertors.

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

  28. #8638
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    okay ty..
    not really understood it but okay ill have to search google

  29. #8639
    Local Tech
    Points: 9.044, Level: 63
    Level completed: 98%, Points required for next Level: 6
    Overall activity: 27,0%

    Registriert seit
    Oct 2007
    Ort
    home
    Beiträge
    1.821
    Points
    9.044
    Level
    63
    Downloads
    1
    Uploads
    0

    Standard

    okay so this is my code

    Code:
     pspDebugScreenSetXY(4,13);
    printf("hello");
    
    pspDebugScreenSetTextColor(green);
    pspDebugScreenSetXY(6,15);
    printf("hello hello");
    
    pspDebugScreenSetXY(4,17);
    printf("hello hello hello");
    so the "hello" would appear in white

    then the "hello hello" would appear in green because it was defined earlier

    but i want the "hello hello hello" to appear back in white...

    do i have to set the colour to white all over again??

  30. #8640
    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 joseph10444 Beitrag anzeigen
    okay ty..
    not really understood it but okay ill have to search google
    Read up on the HEX number system: http://www.danbbs.dk/~erikoest/hex.htm


 

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 .