Another Simple C/C++ Q

Discussion in 'NDS - ROM Hacking and Translations' started by .::5pYd3r::., Aug 16, 2007.

Aug 16, 2007

Another Simple C/C++ Q by .::5pYd3r::. at 8:31 AM (1,282 Views / 0 Likes) 15 replies

  1. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    Ok well this time it doesn't do anything when i press and release start
    CODE// PALib Template Application

    // Includes
    #include    // Include for PA_Lib

    #include "gfx/all_gfx.c"
    #include "gfx/all_gfx.h"

    int main()
    {
    ÂÂÂÂPA_Init(); Â Â// Initializes PA_Lib
    ÂÂÂÂPA_InitVBL(); // Initializes a standard VBL
    ÂÂÂÂPA_InitText(0, 3); //Initializes text
    ÂÂÂÂ
    ÂÂÂÂPA_EasyBgLoad(1, 3, Pong_Menu); //Screen, Priority 0-3, Name
    ÂÂÂÂPA_OutputSimpleText(0,11,11,"Press Start"); // Screen, tile x, y, "text"

    ÂÂÂÂif(Pad.Released.Start)
    ÂÂÂÂ{
    ÂPA_EasyBgLoad(1, 2, Court)
    ÂÂÂÂ}

    ÂÂÂÂreturn 0;
    }
    all help appreciated [​IMG]
     
  2. ediblebird

    Member ediblebird GBAtemp Fan

    Joined:
    Aug 22, 2006
    Messages:
    313
    Country:
    Australia
    if you give me the files, i can have a look at what you are doing, and try to help
     
  3. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    as in the source?
    if so i'll have to give it to you in an hour or so coz i have to go somewhere
     
  4. ediblebird

    Member ediblebird GBAtemp Fan

    Joined:
    Aug 22, 2006
    Messages:
    313
    Country:
    Australia
    yeah source and everything, the whole project folder would be good.
     
  5. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    ok well here it is the whole source http://www.zshare.net/download/31626215ef3efe
     
  6. Issac

    Member Issac Mini-mod

    Joined:
    Apr 10, 2004
    Messages:
    4,454
    Location:
    Sweden
    Country:
    Sweden
    I hope it'll get sorted out.. I have no exp with palib.. so I couldn't help with that
     
  7. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    I fixed it i just had to put while (1) b4 if(Pad.Released.Start)
    {
    PA_EasyBgLoad(1, 2, Court)
    }
     
  8. ediblebird

    Member ediblebird GBAtemp Fan

    Joined:
    Aug 22, 2006
    Messages:
    313
    Country:
    Australia
    thats hell funny [​IMG] i was just about to post the same thing, and then you figured it out. If you ever need any more help i will be happy to help you
     
  9. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    now i have another problem [​IMG]
    once i push start and it loads everything up i push start again and it loads again so what i did was put break after it and then it doesn't work at all wtf is wrong wit dis world waaah [​IMG][​IMG][​IMG][​IMG]
     
  10. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    i'm such a noob
    p.s. i am only a 7th grader/year 7/ form 1/ what else can you call it ???
     
  11. ediblebird

    Member ediblebird GBAtemp Fan

    Joined:
    Aug 22, 2006
    Messages:
    313
    Country:
    Australia
    CODE// PALib Template Application

    // Includes
    #include    // Include for PA_Lib

    #include "gfx/all_gfx.c"
    #include "gfx/all_gfx.h"

    int gameStart = 0;

    int main()
    {
    PA_Init(); Â Â// Initializes PA_Lib
    PA_InitVBL(); // Initializes a standard VBL
    PA_InitText(0, 3); //Initializes text

    PA_EasyBgLoad(1, 3, Pong_Menu); //Screen, Priority 0-3, Name
    PA_OutputSimpleText(0,11,11,"Press Start"); // Screen, tile x, y, "text"

    while(1){

    if(Pad.Released.Start && gameStart == 0)
    {
    PA_EasyBgLoad(1, 2, Court);
    gameStart = 1;
    }

    }

    return 0;
    }

    i think that fixes the prob you are talking about
    make a variable called gameStart and when you press start it checks if it = 0, then if it does, it goes into the game and changes the variable so it doesn't restart the game every time you press start.
     
  12. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    THANK YOU SO MUCH!! [​IMG] [​IMG] [​IMG] [​IMG] [​IMG]
     
  13. outphase

    Member outphase Custom title

    Joined:
    Nov 21, 2005
    Messages:
    1,218
    Country:
    United States
    It would probably be cleaner code if you used a bool for gameStart, but that's just a matter of preference.
     
  14. .::5pYd3r::.
    OP

    Member .::5pYd3r::. Viva La Pizza

    Joined:
    Jun 2, 2007
    Messages:
    766
    Location:
    The GREAT Southern Land :D
    Country:
    Australia
    i don't even know what a bool is because i have just started learning c/c++ with the help of online guides and the c for dummies book
     
  15. outphase

    Member outphase Custom title

    Joined:
    Nov 21, 2005
    Messages:
    1,218
    Country:
    United States
    bool is the name of a boolean variable. this means the value is either false or true. if you set any nonzero value to the variable, it is considered true. you'll learn this variable type soon enough. it's very useful for stuff like this.
     
  16. IBNobody

    Member IBNobody I try to keep myself amused.

    Joined:
    Nov 16, 2006
    Messages:
    1,127
    Location:
    Texas, Hang 'Em High
    Country:
    United States
    Bool is boolean. A bool variable can either be true or false (1 or 0). Some languages have a predefined bool variable type. Others like C don't. With C, you use an integer as a boolean variable.
     

Share This Page