Seite 306 von 340 ErsteErste ... 206 256 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 ... LetzteLetzte
Zeige Ergebnis 9.151 bis 9.180 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; Thanks, guys....

  
  1. #9151
    Points: 2.658, Level: 31
    Level completed: 39%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    47
    Points
    2.658
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    Thanks, guys.



  2. #9152
    QJ Gamer Green
    Points: 6.366, Level: 52
    Level completed: 8%, Points required for next Level: 184
    Overall activity: 71,0%

    Registriert seit
    Apr 2008
    Ort
    in a hobbit hole
    Beiträge
    67
    Points
    6.366
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard SDK dialog, net sample problems

    I'm trying to integrate the NetDialog code into mine, but when I compile it, I just get a blank screen. None of the dialog samples work either.

    I've tried compiling the original sample code, same thing. All I get is the spinning cube.

    Also when I compiled the simple server (?) net sample, it goes to connection state 2 and stops there, waiting.

    With the dialog samples, I get an undefined reference error at SceUtilityMsgDialogParams , even if psputility.h is #included, and -lpsputility is in LIBS.

    static void ShowMessageDialog(const char *message)
    {
    SceUtilityMsgDialogParams dialog;


    But if I try to typedef _SceUtilityMsgDialogParam s, I find that it is already declared!

    I'm on 4.01 M33-2 with 1.50 addon - just to get PSPLink to run. I was hoping to code for 3xx/4xx, but I couldn't find a version of PSPLink for 3xx.

    I recently re-ran (Dan peori's) toolchain installer to get the latest pspsdk.

    Am I doing something wrong? Am I getting the correct SDK?

    I have the pspsdk setup on Ubuntu.

  3. #9153
    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

    Ensure you're compiling for the 3xx+ kernel. The netdialog sample is already setup to build this way.

    All you do to do is 'make' the project, then transfer the single resulting EBOOT.PBP to a folder within PSP/GAME4xx and then run it.

    It's pspUtilityMsgDialogParams , not sceUtilityMsgDialogParams .

    The 3xx+ version of psplink is in the release_oe folder when you compile psplinkusb.

    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

  4. #9154
    QJ Gamer Green
    Points: 6.366, Level: 52
    Level completed: 8%, Points required for next Level: 184
    Overall activity: 71,0%

    Registriert seit
    Apr 2008
    Ort
    in a hobbit hole
    Beiträge
    67
    Points
    6.366
    Level
    52
    Downloads
    0
    Uploads
    0

    Standard

    Thanks,

    Problem solved itself when I reinstalled the toolchain itself, instead of just PSPSDK.

    I ran into a little problem compiling GCC, as it was looking for GMP and MFPR. There were some things I had to do to get it to compile.

    One thing was I ignored the difference in version between gmp and libgmp, and another was I had to copy over the libgmp*.* and libmfpr.* from /usr/local/lib to /usr/lib, as somehow the compiler couldn't find the right libs (undefined reference errors popping up), even if I specified --with-gmp=/usr/local/lib --with-mfpr=/usr/local/lib

    Also, my SDK utility samples now have pspUtilityMsgDialogParams instead of sceUtilityMsgDialogParams .

    I was able to compile it and have the net dialog show up on my PSP.

    Now I'm trying to get libcurl to work properly. I think I might have to recompile openssl and libcurl all over again with the new toolchain and sdk, and hopefully I can finally get back to coding again.

  5. #9155
    QJ Gamer Bronze
    Points: 5.583, Level: 48
    Level completed: 17%, Points required for next Level: 167
    Overall activity: 0%

    Registriert seit
    May 2007
    Beiträge
    127
    Points
    5.583
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von RupertAvery Beitrag anzeigen
    I ran into a little problem compiling GCC, as it was looking for GMP and MFPR. There were some things I had to do to get it to compile.

    One thing was I ignored the difference in version between gmp and libgmp, and another was I had to copy over the libgmp*.* and libmfpr.* from /usr/local/lib to /usr/lib, as somehow the compiler couldn't find the right libs (undefined reference errors popping up), even if I specified --with-gmp=/usr/local/lib --with-mfpr=/usr/local/lib
    or you could download the latest versions of mpfr + gmp and untar them and symlink into the base gcc directory like so;

    Code:
    ln -s ../gmp-4.2.2 gmp
    ln -s ../mpfr-2.3.1 mpfr
    ln -s ../newlib-1.16.0 newlib
    and the compile phase will automatically use those, then your build is self contained and you dont need to worry about externa libs and version mismatches etc.
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

    "Did IQ's just drop sharply while I was away?" (Ripley)

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

    Probably the best way would be to compile gmp and mpfr specifying the correct directory.

    Code:
    ./configure --prefix=/usr

    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

  7. #9157
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I think I remember seeing on here a looong time ago a way of splitting code up, one set of functions for PSP and one for PC by using some precompiler code, I was just wondering if I'm remembering right and how its done?

    Thanks.
    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  8. #9158
    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

    You could wrap separate code blocks by using #ifdef #else #endif and friends.

    Code:
    #ifdef __PSP__
    // PSP specific code
    #else
    // PC specific code
    #endif
    Then when you compile, just add -D__PSP__ to your CFLAGS for the PSP build.

    It would be easier for us to aid you if you stated your goal as well - there may be a better alternative.

    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

  9. #9159
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I'm re-writing Roadblocks on the PSP, and porting it to the PC in 3D, so it will use the same physics, map reader, etc, but different graphics, and I ideally want to keep all my code in the same place with the same function names, so 2 different makefiles, one for the PSP using the __PSP__ flag, and the one for the PC having no flag seems perfect to me.

    Thanks.
    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  10. #9160
    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

    have fun creating it=-)(doing the same with my pspbillards)
    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

  11. #9161
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Hey, haven't posted here in months.
    How do i blit multiple images on the screen with independent properties at the same time? In other words, how do i blit a square (taken from the same png image) several times on the screen and make it move at different speeds and directions?

    I've been wondering this ever since i started programming. If i know this, most of my problems will be solved...:)
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  12. #9162
    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

    simple call the blit function again, but at a diffrent position, the buffer well update itself with multiple instances, it's up to you to keep track of these instances
    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

  13. #9163
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Well, obviously you can call the blit function again at a different position. But what if you want to make the second one move to the right and the first one move left? See what i'm saying. I mean towards different directions or speed.
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

  14. #9164
    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

    like i said, that's stuff u need to keep track yourself
    example:
    Code:
    int ObjAx = 0;//ObjA x
    int ObjAy = 0;//ObjA y
    int ObjBx = 0;//ObjB x
    int ObjBy = 0;//ObjB y
    
    int main(int argc, char **argv){
       DrawImage(ObjAx, ObjAy, Img);
       DrawImage(ObjBx, ObjBy, Img);
       ObjAx--;
       ObjBx++;
       return 0;
    }
    ^^obviously not ganna compile, but an example to show what i mean
    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

  15. #9165
    QJ Gamer Silver
    Points: 10.921, Level: 69
    Level completed: 18%, Points required for next Level: 329
    Overall activity: 0%

    Registriert seit
    May 2006
    Ort
    Behind you.
    Beiträge
    1.814
    Points
    10.921
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    Lol, i know how to do that, but that introduces a lot of new variables that you have to keep up with, especially when you have like ten or more objects. Is there another way?
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

    "Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)

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

    Write a class.

    Code:
    class ScreenObject
    {
    private:
        Texture* m_texture;
        Vector2 m_position;
    
    public:
        ScreenObject();
        ~ScreenObject();
    
        void setInitialPosition(const Vector2& pos);
        bool setTexture(Texture* tex);
    
        bool updatePosition(int xDelta, int yDelta);
        void render();
    };
    
    ScreenObject::ScreenObject()
    {
    
    }
    
    ScreenObject::~ScreenObject()
    {
    
    }
    
    void ScreenObject::setInitialPosition(const Vector2& pos)
    {
        m_position = pos;
    }
    
    bool ScreenObject::setTexture(Texture* tex)
    {
        if(tex)
        {
            m_texture = tex;
            return true;
        }
    
        return false;
    }
    
    bool ScreenObject::updatePosition(int xDelta, int yDelta)
    {
        m_position.x += xDelta;
        m_position.y += yDelta;
    }
    
    bool ScreenObject::render()
    {
        m_texture.render(m_position);
    }
    
    int main(int argc, char** argv)
    {
        Texture tex("SomeTexture.png");
        
        // Initialize Ten ScreenObjects
        ScreenObject* objects = new ScreenObject[10];
        for(int i = 0; i < 10; ++i)
        {
            objects[i].setInitialPosition(Vector2(RandomInt(), RandomInt()));
            objects[i].setTexture(&tex);
        }
    
        while(running)
        {
            for(int i = 0; i < 10; ++i)
            {
                objects[i].updatePosition(RandomInt(), 0);
                objects[i].render();
            }
        }
    
        // All done, clean up
        tex.unload();
        return 0;
    }
    *Warning, Above is Pseudo-Code*

  17. #9167
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I understand the basics of classes, but if I'm honest I can't see any major upside over standard struct style programming in C, maybe I'm overlooking something obvious or maybe I don't know enough about classes yet?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  18. #9168
    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

    Yeah, you don't understand them.

  19. #9169
    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

    Nice, couldnt you tell him why classes would be better?

  20. #9170
    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

    No, because they aren't "better". There is no "better".

    If he wants to find out more about classes, he can go buy a book or google it.

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

    You said he didnt know enough which implied there was an upside of using classes which in turn implies that they are "better" to use in this situation.

  22. #9172
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I've been using the Cambridge website to help, but I still don't understand why they are better, I think I understand what I've read, but everything with classes appears possible with functions and structs in C, or is that the point? Are classes just an easier way to manage data that in C would require multiple functions?

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

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

    Read chapters 4 and 5 in Thinking in C++ Vol 1.

  24. #9174
    QJ Gamer Bronze
    Points: 8.045, Level: 60
    Level completed: 48%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Ort
    Australia
    Beiträge
    659
    Points
    8.045
    Level
    60
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von _dysfunctional Beitrag anzeigen
    No, because they aren't "better". There is no "better".

    If he wants to find out more about classes, he can go buy a book or google it.
    So he shouldn't be able to get help asking in a C/C++ help thread?

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

    1337ists should be eliminated from this thread.

  26. #9176
    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

    o god, not the "help" stuff again...*sighs*
    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

  27. #9177
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    Thanks yaustar, I'm part way though chapter 4 and it seems very informative, I'll read through both chapters together later when I have more time.

    I've just finished setting up the toolchain on my Ubuntu system, and code that used to compile fine no longer works. When compiling graphics.c it gives me errors, namely to do with these 2 lines of code
    Code:
    #include <ft2build.h>
    #include FT_FREETYPE_H
    the errors are that ft2build.h does not exist, and that FT_FREETYPE_H expects a "" or <> because its not a file type. When I try and compile anything using rtc I also get errors on line 244 and 245 stating that a ; , or ) is required after time. I'm also getting problems trying to compile any applications with callbacks...

    I never had these problems on my old Cygwin setup, so I'm just wondering if there are any libraries that I'll need to install?

    Thanks.
    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p

  28. #9178
    QJ Gamer Bronze
    Points: 5.381, Level: 47
    Level completed: 16%, Points required for next Level: 169
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    550
    Points
    5.381
    Level
    47
    Downloads
    1
    Uploads
    0

    Standard

    Quick question, can someone compile me the latest PSPLink from svn? I've tried a few revisions and the OE builds always crash. It's probably because my toolchain is old, but I'm too lazy to upgrade :-\

  29. #9179
    Points: 2.658, Level: 31
    Level completed: 39%, Points required for next Level: 92
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    47
    Points
    2.658
    Level
    31
    Downloads
    0
    Uploads
    0

    Standard

    Anybody know off the top of their head what color mode the OSK runs in?

  30. #9180
    I'm back!
    Points: 8.236, Level: 61
    Level completed: 29%, Points required for next Level: 214
    Overall activity: 99,0%

    Registriert seit
    Feb 2007
    Ort
    England
    Beiträge
    902
    Points
    8.236
    Level
    61
    Downloads
    0
    Uploads
    0

    Standard

    I'm killing 2 birds with one stone right now, I'm writing my first OO and SDL program, all was going well but when I try and compile I get this error:

    source/objlist.o(.text+0xa4):obj list.cpp: undefined reference to `blitImage(int, int, SDL_Surface*, SDL_Surface*)'
    My code is this:
    Code:
    void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* sprite = NULL)
    {
    	SDL_Rect coord;
    	
    	coord.x = x;
    	coord.y = y;
    	
    	SDL_BlitSurface(source, sprite, destination, &coord);
    	
    	return;
    }
    header
    Code:
    void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination);
    
    void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* sprite);
    and yes, I have included the header in objlist.cpp, I'm stumped as to why its not working.

    -Aura
    Last.fm | Deviant Art | First working OS picture

    Zitat Zitat von nickxab Beitrag anzeigen
    I will beat myself. :p


 

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

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