Seite 182 von 340 ErsteErste ... 82 132 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 232 282 ... LetzteLetzte
Zeige Ergebnis 5.431 bis 5.460 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 i want to load two images, do i have to do this: ? Code: char buffer1[200]; Image* ourImage; sprintf(buffer, ...

  
  1. #5431
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    if i want to load two images, do i have to do this: ?

    Code:
    char buffer1[200];
    Image* ourImage;
            
    sprintf(buffer, "ourImage.png");
    ourImage = loadImage(buffer);
    
    char buffer2[200];
    Image* ourImage2;
            
    sprintf(buffer2, "ourImage2.png");
    ourImage2 = loadImage(buffer2);
    or is there a better way?



  2. #5432
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    That buffer is pointless.

    Code:
    Image* ourImage1 = loadImage("Image1.png");
    Image* ourImage2 = loadImage("Image2.png");

  3. #5433
    QJ Gamer Green
    Points: 11.800, Level: 71
    Level completed: 38%, Points required for next Level: 250
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Ort
    Middle Europe
    Beiträge
    1.281
    Points
    11.800
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    thx this is shorter :)
    -= Double Post =-
    ok new one

    how do you print variable with printTextScreen ?

    i tried %d - doesnt work
    i tried printing variable name - doesnt work
    Geändert von myschoo (07-10-2007 um 01:40 PM Uhr) Grund: Automerged Doublepost

  4. #5434
    QJ Gamer Blue
    Points: 4.031, Level: 40
    Level completed: 41%, Points required for next Level: 119
    Overall activity: 91,0%

    Registriert seit
    Feb 2007
    Ort
    Florida
    Beiträge
    214
    Points
    4.031
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    I started looking at LTE 2.2. Any tutorals out there?

  5. #5435
    QJ Gamer Green
    Points: 3.606, Level: 37
    Level completed: 71%, Points required for next Level: 44
    Overall activity: 99,0%

    Registriert seit
    Jul 2007
    Beiträge
    88
    Points
    3.606
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Nevermind I got it.
    Geändert von Beat_Bob (07-10-2007 um 11:30 PM Uhr)

  6. #5436
    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

    @Beat_Bob: Put a semicolon after the struct definition to get it to compile. Although that code won't work because it'll just get stuck at the while(1) loop.

    @myschoo: sprintf the variable into a different buffer and printTextScreen that buffer (unless there's an easier way).

  7. #5437
    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 MrChaos
    I started looking at LTE 2.2. Any tutorals out there?
    Any decent SDK should have some samples included.

  8. #5438
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Hi

    Can someone tell me how i can get the ".png" out of "image.png" ?

    In lua it would be this:

    Code:
    if string.sub("image.png", -4) == ".png" then
    	fimage = Image.load("image.png")
    end
    Thanks in advance

  9. #5439
    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

    strrchr("image.png",'.')
    Will give you the a char* starting from last instance of a period in a character string. The strings are linked, that is, so if you free "image.png" (assuming you're doing it allocated from the stack), it'll free the ".png", and if you modify the ".png", it'll modify the "image.png". Also, you can't directly free the ".png".
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  10. #5440
    QJ Gamer Bronze
    Points: 5.092, Level: 45
    Level completed: 72%, Points required for next Level: 58
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Beiträge
    169
    Points
    5.092
    Level
    45
    Downloads
    0
    Uploads
    0

    Standard

    Thanks, i will try this

    But are you sure that there is no code in C for string.sub() in LUA?

  11. #5441
    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

    strncpy(to, from + strlen(from) - 5, 4);
    Geändert von Archaemic (07-11-2007 um 04:13 AM Uhr) Grund: rm stray spacing
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  12. #5442
    QJ Gamer Green
    Points: 8.244, Level: 61
    Level completed: 32%, Points required for next Level: 206
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Cd. Juarez Mexico -
    Beiträge
    341
    Points
    8.244
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    How can i convert an integer to ascii (string), i heard of itoa() but i can get the compiler to include the string library.

    Im using #include <string.h>
    Firmware History2.0 > 2.01 > 2.6 > 2.7 (Upgraded since i lost my GTA) > 2.71 > 2.8 (Downgrader for 2.71 came next day :( ) > 2.8 (xLoader very happy) > Stolen > New 2.6 PSP > 2.71 > 1.5 > 2.71 SE > 3.03 OE-A > 3.03 OE-B > 3.03 OE-C > 3.40 OE (For my theme cycler)
    Donators
    310,000 points from xpack
    1,000,000 points from Steven9
    1,000,000 points from nanajyuuta
    PREMIUM - Dev Status
    Thanks!!!


    XMB Theme Manager Creator - now at version V0.3

  13. #5443
    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

    Umm, there is no string.h. If it's C++, it's just string.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  14. #5444
    QJ Gamer Green
    Points: 11.300, Level: 70
    Level completed: 13%, Points required for next Level: 350
    Overall activity: 0%

    Registriert seit
    Dec 2006
    Ort
    main();
    Beiträge
    1.071
    Points
    11.300
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    There IS a string.h. You use it for strcmp, strcpy, etc...

    The header he needs it stdlib.h.

  15. #5445
    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

    Ah, oh, you're right. I was in a C++ mindset after that topic about C++ strings.

    Anyway, you don't want atoi anyway. That converts C strings to integers, not the other way around.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  16. #5446
    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

    Archaemic = He said itoa (Integer TO Ascii), not atoi (Ascii TO Integer)

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


  17. #5447
    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

    Last time I checked, there is no itoa.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  18. #5448
    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 Archaemic
    Last time I checked, there is no itoa.
    http://www.cplusplus.com/reference/c...dlib/itoa.html
    It isn't standard though across all compilers.

  19. #5449
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Right then, i have no idea why i'm getting this error, but it's giving it me anyways.

    I Get the following errors on compile:

    Code:
    main.o: In function `main':
    main.cpp:(.text+0xdc): undefined reference to `initGraphics()'
    main.cpp:(.text+0x12c): undefined reference to `flipScreen()'
    Here are my includes:

    Code:
    #include <malloc.h>						
    #include <pspkernel.h>
    #include <pspdisplay.h>
    #include <pspdebug.h>
    #include <stdio.h>
    #include <pspcallbacks.h>
    #include <pspgu.h>
    #include <pspgum.h>
    #include <psprtc.h>						
    #include "Files/graphics.h"
    And my Makefile:

    Code:
    #------------------- Makefile for 'Breakout' -------------------#
    
    TARGET			= Breakout
    OBJS			= main.o Files/font.o Files/graphics.o Files/framebuffer.o
    
    INCDIR			=
    LIBDIR			=
    LDFLAGS			=
    LIBS			= -lpspgum -lpspgu -lpsprtc -lm -lpng -lz -lm		
    CFLAGS			= -O2 -G0 -Wall
    CXXFLAGS		= $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS			= $(CFLAGS)
    
    EXTRA_TARGETS	= EBOOT.PBP
    PSP_EBOOT_TITLE	= Breakout 
    
    PSPSDK			= $(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    Any ideas ?

  20. #5450
    QJ Gamer Green
    Points: 8.746, Level: 62
    Level completed: 99%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    www.ultimatetalkforums.com Games, RPG, quickchat and more!
    Beiträge
    532
    Points
    8.746
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    whats the easiest way to make a sidescroller with text liike
    V
    .
    .
    .
    .
    A
    [CENTER][COLOR=black][COLOR=black][URL="http://forums.qj.net/f-psp-firmware-discussion-253/t-psp-firmware-30-get-it-58053.html"][COLOR=cyan]would you upgrade?[/COLOR][/URL] [/COLOR][FONT=Times New Roman][COLOR=navy][URL="http://www.mindistortion.net/iwantyoursoul/?i_am=altunozara"]OMG ITS REAL![/URL][/COLOR][/FONT][COLOR=black] [URL="http://forums.qj.net/showthread.php?t=61756&page=1&pp=10"][COLOR=lime]Sony vs Nintendo[/COLOR][/URL][/COLOR][/COLOR][/CENTER]
    [CENTER] [/CENTER]
    [CENTER][URL="http://www.ultimatetalkforums.com"][IMG]http://i94.photobucket.com/albums/l82/Altunozara/userbar2.jpg[/IMG][/URL][/CENTER]
    [CENTER][SIZE=3]i [/SIZE][URL="http://forums.qj.net/www.gamingwell.com"][SIZE=3]wonder what could be under this hyperlink..hmm[/SIZE][/URL][/CENTER]
    [CENTER][SIZE=3][COLOR=green][B][I]Maniakc is awsome!!![/I][/B][/COLOR][/SIZE][/CENTER]
    [CENTER][FONT=Arial Black][SIZE=3][COLOR=#660099][I][U][URL="http://forums.qj.net/member.php?u=58299"]The Brain Pwns!!![/URL][/U][/I][/COLOR][/SIZE][/FONT][/CENTER]

    [COLOR=sienna]Creator of:[/COLOR][URL="http://forums.qj.net/f-psp-development-forum-11/t-release-go-go-go-beta-66652.html"][COLOR=sienna]GO GO GO![/COLOR][/URL]

  21. #5451
    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

    Code:
    OBJS			= main.o Files/font.o Files/graphics.o Files/framebuffer.o
    Shouldn't it be:
    Code:
    OBJS			= main.o font.o graphics.o framebuffer.o
    IIRC, the .o files are created in the same directory as the Makefile regardless of where the source file is.

  22. #5452
    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

    The objs line from PSPComic is such:
    Code:
    OBJS = zip/ioapi.o zip/unzip.o pspcomic.o xmlfuncs.o rar.o
    It works just fine, even though it compiles objects from subdirectories (and the o files do go in the zip folder after they're compiled).
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  23. #5453
    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

    Archaemic is correct.

    MiG: Wrap your #include of graphics.h in an extern C statement.

    Code:
    extern "C" {
    #include "Files/graphics.h"
    }

    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

  24. #5454
    QJ Gamer Green
    Points: 3.606, Level: 37
    Level completed: 71%, Points required for next Level: 44
    Overall activity: 99,0%

    Registriert seit
    Jul 2007
    Beiträge
    88
    Points
    3.606
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Anyone know why this isnt working?
    Code:
         while(1)
        {
        sceCtrlPeekBufferPositive(&pad, 1); // Find out what the state of the control pad is
        // Change the position of the box
        if(pad.Buttons & PSP_CTRL_LEFT)
        {
        if(box.x>0)
        {box.x=box.x-3;}
    }
        else if(pad.Buttons & PSP_CTRL_RIGHT)
        {
        if(box.x<480-32)
        {box.x=box.x+3;}
    }
    
      if((pad.Buttons & PSP_CTRL_CROSS) && (box.state==0))
     {box.state=1; box.jumpspeed=0;}
     
     if(box.state==1 && box.jumpspeed==0)
     { box.y=box.y-0.8; 
     box.jumpspeed+=0.3;}
     
     if (box.state==1 && box.jumpspeed>3.5)
     {box.y=box.y-0.3;}
     
     if (box.state==1 && box.jumpspeed>=5);
     { 
      box.state=2;  
     }
     
     if (box.state==2)
     {
      box.jumpspeed=5;
       box.y+=0.8;}
     
     if (box.state==2 & box.y==230)
     {box.y=230; box.state=0; 
     box.jumpspeed=0;}
    No errors or anything, its just that when I try to jump (when I press X) he doesnt do anything. I want him to go in the air and have gravity come down on him (when jumpspeed=5) thats when I want him to start coming down.
    Then when hes back on the ground (when hes at y: 230) it resets.
    box.state (0 = ground, 1 = jumping, 2 = falling) just so you know.
    Anyone?

  25. #5455
    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

    Zitat Zitat von altunozara
    whats the easiest way to make a sidescroller with text liike
    V
    .
    .
    .
    .
    A
    If you told us what graphics library your using, itd be much easier to make a specific example for it (graphics lib, oslib, sdl, gu, pspgl, lte, etc.)

    ...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. #5456
    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 Beat_Bob
    Anyone know why this isnt working?
    Indeed I do.
    Code:
     if((pad.Buttons & PSP_CTRL_CROSS) && (box.state==0))
     {box.state=1; box.jumpspeed=0;}
     
     if(box.state==1 && box.jumpspeed==0)
     { box.y=box.y-0.8; 
     box.jumpspeed+=0.3;}
    Notice the part I bolded.

    In your code, if the box isn't moving and you press Cross, you set box.state to 1 and box.jumpspeed to 0. Then, immediately after, if box.state is 1 (it is) and box.jumpspeed is 0 (it is), you change box.jumpspeed to 0.3 . And, since none of your if statements catch anything but *exact* numbers, and more explicitly, since none of them handle the case where box.jumpspeed is 0.3, once you hit this point, your box state and box speed aren't going to change any more.

    Instead of
    Code:
    if(box.state==1 && box.jumpspeed==0)
    try
    Code:
    if(box.state==1 && box.jumpspeed<3.5)
    and instead of

    Code:
    if (box.state==1 && box.jumpspeed>3.5)
    try
    Code:
     if (box.state==1 && box.jumpspeed>=3.5 && box.jumpspeed < 5)
    Gotta be sure that every possible code route is covered, so don't just check for explicit numbers for the box speed. Check for ranges instead, so that all possible box speeds will fall into one of your if statements.
    [I fail @ life]

  27. #5457
    QJ Gamer Green
    Points: 3.606, Level: 37
    Level completed: 71%, Points required for next Level: 44
    Overall activity: 99,0%

    Registriert seit
    Jul 2007
    Beiträge
    88
    Points
    3.606
    Level
    37
    Downloads
    0
    Uploads
    0

    Standard

    Didnt work. But I tried another way by converting a lua tutorial (just jumping, same method)
    to this way:
    Spoiler for while(1) loop:

    sceCtrlPeekBufferPositive (&pad, 1); // Find out what the state of the control pad is
    // Change the position of the box
    if(pad.Buttons & PSP_CTRL_LEFT)
    {
    if(box.x>0)
    {box.x=box.x-3;}
    }
    else if(pad.Buttons & PSP_CTRL_RIGHT)
    {
    if(box.x<480-32)
    {box.x=box.x+3;}
    }

    if((pad.Buttons & PSP_CTRL_CROSS) && (box.state==0))
    {box.state=1;}
    if(box.state==1)
    {box.jumpspeed = box.jumpspeed-0.5;
    box.gravity=box.gravity-box.jumpspeed;}

    if (box.gravity<0)
    {box.state=2;}
    if ((box.gravity < 230) && (box.state==2))
    {box.gravity=box.gravity + (box.jumpspeed+3);}

    if (box.gravity==230)
    {box.jumpspeed=10;
    box.state=0;}
    if(box.gravity>230)
    {box.gravity=230;}

    box.y=box.gravity;

    Its weird. When I press X he jumps (incredibly fast....) and hes just stuck in the air then.
    He wont fall back down. Why not? Ive made it so I can move left and right, and when im stuck in the air im able to move
    left and right by the way, just so you know.
    Geändert von Beat_Bob (07-12-2007 um 08:38 PM Uhr)

  28. #5458
    QJ Gamer Green
    Points: 8.244, Level: 61
    Level completed: 32%, Points required for next Level: 206
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Cd. Juarez Mexico -
    Beiträge
    341
    Points
    8.244
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    So itoa() is in stdlib or is there a different function?
    Firmware History2.0 > 2.01 > 2.6 > 2.7 (Upgraded since i lost my GTA) > 2.71 > 2.8 (Downgrader for 2.71 came next day :( ) > 2.8 (xLoader very happy) > Stolen > New 2.6 PSP > 2.71 > 1.5 > 2.71 SE > 3.03 OE-A > 3.03 OE-B > 3.03 OE-C > 3.40 OE (For my theme cycler)
    Donators
    310,000 points from xpack
    1,000,000 points from Steven9
    1,000,000 points from nanajyuuta
    PREMIUM - Dev Status
    Thanks!!!


    XMB Theme Manager Creator - now at version V0.3

  29. #5459
    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

    Nope.

    But if you don't feel like using a non-standard function for some reason, you could always make your own or use a pre-existing example (look at the external links)



    altunozara - The basic concept for vertical scrolling sentences, regardless of graphics library, is
    Code:
    const int SCR_HEIGHT = 272; // avoid magic numbers (yaustar's teachings through me i know... :-\)
    const int SCR_WIDTH = 480;
    const int CHAR_HEIGHT = 10; // in pixels
    const int CHAR_WIDTH = 8;
    
    int main() {
      int mainy = SCR_HEIGHT; // starting point
      char string[/* im too lazy to count the number of chars in the string */] = "SG57 was here..."; // string to scroll
    
      for(;;) {
        for(int i = 0; i < strlen(string); i++)
          screen_print(SCR_WIDTH/2-CHAR_WIDTH/2, mainy+i*CHAR_HEIGHT, string, #FFFFFF)
    
        mainy--;
        if(mainy < -(strlen(string)*CHAR_HEIGHT))
          mainy = SCR_HEIGHT; // reset text to bottom of screen and continue scrolling, this could easily be a call to go back to main menu should you be making a credits screen or something
    
        vertical_sync();
        flip_buffer();
      }
    
      return 0;
    }
    You could easily make a structure for each character, to change each specific characters color, rotation, size, etc. on the fly for a neat effect.

    The above snippet needs optimization, but its a rough example and should push you into the right direction.

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


  30. #5460
    MiG
    MiG ist offline
    QJ Gamer Blue
    Points: 5.848, Level: 49
    Level completed: 49%, Points required for next Level: 102
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Ort
    UK
    Beiträge
    499
    Points
    5.848
    Level
    49
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Insert_Witty_Name
    Archaemic is correct.

    MiG: Wrap your #include of graphics.h in an extern C statement.

    Code:
    extern "C" {
    #include "Files/graphics.h"
    }
    That just broke "graphics.h", came up with all sorts of errors... i'll have a play.. see what's going off :)

    EDIT - Seems like having the files in a seperate directory was causing the errors. :S
    But now I have a new set of errors that don't even make sense
    Geändert von MiG (07-13-2007 um 12:31 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 .