Seite 293 von 340 ErsteErste ... 193 243 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 ... LetzteLetzte
Zeige Ergebnis 8.761 bis 8.790 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; This is one big fat request, I haven't even seen an attempt at code....

  
  1. #8761
    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

    This is one big fat request, I haven't even seen an attempt at code.



  2. #8762
    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

    I don't want you guys to code it ;) i just want to know away to do it.

    EDIT:

    There is only one problem now Thanks.

  3. #8763
    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 MiKeY188 Beitrag anzeigen
    Ive been trying all day and ain't gotten anywhere please if someone can help in anyway!
    Code:
    if(some_random_number() == 42)
        block_shot();
    else
        dont_block_shot();
    -- Code Monkey : Sarien, Fishguts, Cracks and Crevices --

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

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

    Yeah i will try something like that out thanks :)

  5. #8765
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    I know it is a bit noobish to ask but i haven't ever checked this for PSP so;

    What gfx libraries does the PSP support?

    SDL OpenGL OpenGL 2.0 etc.

    P.s wasn't sure where to ask this but since there used in c and c++ stuff not lua i may as well ask here.

  6. #8766
    No longer a community member.
    Points: 46.662, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 0%

    Registriert seit
    Dec 2005
    Beiträge
    22
    Points
    46.662
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis Beitrag anzeigen
    I know it is a bit noobish to ask but i haven't ever checked this for PSP so;

    What gfx libraries does the PSP support?

    SDL OpenGL OpenGL 2.0 etc.

    P.s wasn't sure where to ask this but since there used in c and c++ stuff not lua i may as well ask here.
    I know that it supports SDL, as I have made a few apps that use it.

    I am not so sure about OpenGL though. I know it supports some kind of OpenGL, I just don't know if it's the official OpenGL.

  7. #8767
    Banned from QJ for LIFE
    Points: 10.957, Level: 69
    Level completed: 27%, Points required for next Level: 293
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    1.557
    Points
    10.957
    Level
    69
    Downloads
    0
    Uploads
    0

    Standard

    I was wondering more about the OpenGl tbh because i was hoping when i have finished learning how to make things for the Pandora (Different to the battery thing) it will be easy to port the stuff to the PSP to.

    I guessed from one of the recent posts it does some form but does it support the official OpenGL? (and 2.0)

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

    it's not opengl it's called pspgu, although their is a port of opengl it is recommended not to use the port and instead to make your program use pspgu, ask xfactor, jj_calvin, or IWN about it for more information i can only give you some even with me using it, if you want to know more hop onto irc, server: freenode room: #psp-programming=-)
    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. #8769
    Developer
    Points: 11.815, Level: 71
    Level completed: 42%, Points required for next Level: 235
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    262
    Points
    11.815
    Level
    71
    Downloads
    0
    Uploads
    0

    Standard

    These are fairly good tutorials for PSPGU, and they are based on OpenGL tutorials:
    http://www.skistovel.com/index.php?page=tutorials-psp

    Even though the method of managing the display list appears to be coded incorrectly, it is still more than enough to get started with PSPGU.

    Or you might want to check on OSLib for PSP. I've never used it but I've heard it is nice and renders images fast.

    Whatever you do, just don't use old, poorly written graphics.c and graphics.h from LuaPlayer. There are very many things wrong with the way things are rendered with that code.

  10. #8770
    QJ Gamer Silver
    Points: 14.087, Level: 77
    Level completed: 10%, Points required for next Level: 363
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Germany
    Beiträge
    926
    Points
    14.087
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von mraellis Beitrag anzeigen
    I was wondering more about the OpenGl tbh because i was hoping when i have finished learning how to make things for the Pandora (Different to the battery thing) it will be easy to port the stuff to the PSP to.

    I guessed from one of the recent posts it does some form but does it support the official OpenGL? (and 2.0)
    Unless you code your stuff with SDL, porting won't be as easily possible. The pandora uses OpenGL|ES 2.0, while the PSP only has an inofficial OpenGL-alike library that supports the basic features of OpenGL 1.6. Even if pspgl were a complete OpenGL 2.0 implementation, it would be impossible to just switch from OpenGL|ES to OpenGL. They're different in many things.

    You might as well just write your game for both platforms native graphics libraries - OpenGL|ES 2.0 and pspgu (not pspgl), which in turn is already very OpenGL alike and if you know basic OpenGL you will also know pspgu in no time.
    Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
    Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
    Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
    Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.

  11. #8771
    QJ Gamer Blue
    Points: 4.008, Level: 40
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    dfgd
    Beiträge
    66
    Points
    4.008
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard tables

    hi all, well considering this is a c/c++ programming help thread, ill take advantage of it!

    wellim new to C codin been doing lua n i have been a c coder for about 4 hours lol and im stuck already, well str8 to the point . . .

    How can u create a table in c?

    coz in lua u just put

    table = { name = "luke",age = 18 }
    or
    table = {}
    table[1] = { name = "luke", age = 18}
    table[2] = { name = "jfjfsf", age = 65 }

    but how can u create tables like that in c?

    i need a table to hold likeplayer data, AI data etc
    does anybody know?

    thankyou
    Luke

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

    Look/Google for array of structs.

  13. #8773
    QJ Gamer Blue
    Points: 4.008, Level: 40
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    dfgd
    Beiträge
    66
    Points
    4.008
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von yaustar Beitrag anzeigen
    Look/Google for array of structs.
    well i did what u said and i search and i have no idea what im looking for?!

    all i need is for someone to tell me how to create a table in c that can hold data or point me to information on how to do it etc but no offence like but look/google for array of tables, ima newby i said tht i duno what im lookin for lol bit more info if u will.

    luke

  14. #8774
    QJ Gamer Blue
    Points: 4.268, Level: 41
    Level completed: 59%, Points required for next Level: 82
    Overall activity: 0%

    Registriert seit
    Apr 2008
    Beiträge
    497
    Points
    4.268
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Dude first result in google, when I searched, this isn't a tut, but it's an example of one in C.

    http://mail.python.org/pipermail/tut...ay/005957.html

    :) lol hope it helps

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

    There are no 'tables' in C. You have to build your own. When I need a size-conscious array I do this:
    Code:
    typdef struct {
      int* values;
      int size;
    } sizedIntArray;
    Then to declare an array I say:
    Code:
    sizedIntArray my_array;
    my_array.size = 0; //Set the size of the array
    my_array.values = (int*)malloc(0); //Make malloc aware of the array location
    Then when I add something:
    Code:
    my_array.size++; //increase the size by 1
    my_array.values = (int*)realloc(my_array.values, my_array.size * sizeof(int)); //allocate more memory for the array
    Removing a value from the end is similar and removing a value from the beginning/middle can be done by manually shifting later values down and then removing the last value. You can refer to an item at a specific index by 'my_array.values[?]' where ? is the index you want.

    As for tables used as dictionaries, you'll need to create an array of structs. Make a typedef struct and then create an array of them:
    Code:
    typedef struct {
      char name[50];
      unsigned int age;
      int gender;
    } Person;
    Person my_array[10];
    my_array[0].age = 30;
    my_array[0].gender = 1; //male
    sprintf(my_array[0].name, "Mr. Bob");
    That's an array of 10 people. Each one is a 'Person'. Each person has a 'name', an 'age', and a 'gender'. The first person is set up there so you can see how to refer to it.
    Geändert von Khatharr (07-31-2008 um 04:18 PM Uhr)

  16. #8776
    QJ Gamer Blue
    Points: 4.008, Level: 40
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    dfgd
    Beiträge
    66
    Points
    4.008
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von PSProgramer Beitrag anzeigen
    Dude first result in google, when I searched, this isn't a tut, but it's an example of one in C.

    http://mail.python.org/pipermail/tut...ay/005957.html

    :) lol hope it helps
    ye i saw that to had a look at it i was just confused lol
    i did try n make a table in my code but i just got loads of errors, i did . . .

    struct player
    {
    char name;
    int X;
    int Y;
    }


    then in my main code i put
    player.name = "luke";
    player.X = 45;
    player.Y = 65;

    but i think ive got that allwrong lol but worth a try i just dont know what to do i dont want to make loads of variables holding all the data coz id have tones, but i dont have any idea how to make a struct! :Argh:
    luke

  17. #8777
    QJ Gamer Blue
    Points: 4.008, Level: 40
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    dfgd
    Beiträge
    66
    Points
    4.008
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Khatharr Beitrag anzeigen
    As for tables used as dictionaries, you'll need to create an array of structs. Make a typedef struct and then create an array of them:
    Code:
    typedef struct {
      char name[50];
      unsigned int age;
      int gender;
    } Person;
    Person my_array[10];
    my_array[0].age = 30;
    my_array[0].gender = 1; //male
    sprintf(my_array[0].name, "Mr. Bob");
    That's an array of 10 people. Each one is a 'Person'. Each person has a 'name', an 'age', and a 'gender'. The first person is set up there so you can see how to refer to it.
    it worked omg it reli worked thanks man im soo pleased omg thankyou sooo much
    luke:Punk::Jump:

  18. #8778
    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 lukespalding Beitrag anzeigen
    well i did what u said and i search and i have no idea what im looking for?!

    all i need is for someone to tell me how to create a table in c that can hold data or point me to information on how to do it etc but no offence like but look/google for array of tables, ima newby i said tht i duno what im lookin for lol bit more info if u will.

    luke
    If are at the stage where you can't tell what results to look for because you don't understand the terminology, you are jumping too far ahead and you need to 'fall back' a bit.

    Look for tutorials on Arrays. Once you have understood how arrays work then look for tutorials on structs in C (C++ structs are slightly different). Once you have understood how to use structs, then you can put the two together to make an array of structs.

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

    well if your just looking for an array, not a structure as Khatharr said it's fairly simple:

    Code:
    int array[] = { 1, 2, 3}; <-- similar to how lua does it
    another way:
    Code:
    int array[3];
    array[0] = 1;
    array[1] = 2;
    array[2] = 3;
    than theirs the pointer method
    Code:
    #include <malloc.h>
    int *array = (int*)malloc(sizeof(int)*3); <--creates room for the array(in this case 3 spots are created)
    array[0] = 1;
    array[1] = 2;
    array[2] = 3;
    free(array) <--free the memory up
    arrays are farly simple, and at this point i suggest learning more about arrays before you jump into structures as Khatharr pointed you to

    also Khatharr why did you make the gender an unsigned int, seems a tad un-needed(and something that can confuse him since he's still fairly new)
    Geändert von slicer4ever (08-01-2008 um 03:18 AM Uhr)
    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

  20. #8780
    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 slicer4ever Beitrag anzeigen
    well if your just looking for an array, not a structure as Khatharr said it's fairly simple:

    Code:
    int array[] = { 1, 2, 3}; <-- similar to how lua does it
    another way:
    Code:
    int array[3];
    array[0] = 1;
    array[1] = 2;
    array[2] = 3;
    than theirs the pointer method
    Code:
    #include <malloc.h>
    int *array = (int*)malloc(sizeof(int)*3); <--creates room for the array(in this case 3 spots are created)
    array[0] = 1;
    array[1] = 2;
    array[2] = 3;
    arrays are farly simple, and at this point i suggest learning more about arrays before you jump into structures as Khatharr pointed you to

    also Khatharr why did you make the gender an unsigned int, seems a tad un-needed(and something that can confuse him since he's still fairly new)
    Age is an unsigned int. He probably did that since a person cannot have a negative age. The age probably won't reach anywhere near 0x7FFF, but it still makes sense to have it unsigned.
    [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]

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

    true, but i don't think it was necessary imo, anywho must have over looked it as gender my bad
    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

  22. #8782
    QJ Gamer Green
    Points: 9.134, Level: 64
    Level completed: 28%, Points required for next Level: 216
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    3.03OE-C
    Beiträge
    1.098
    Points
    9.134
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard

    i used a PNG file to make a background and i am wanting that to go away when i push a button, and then go to another background with a sprite on it. my main problem is getting rid of the first one, i tried using oslClr() since im using OSlib but that only seems to work with text. how do i get rid of it?
    CuRrEnT fIrMwArE [SIZE="3"][FONT="Times New Roman"][COLOR="Red"][B][I][U]3.90 M33-2 SLIM TA-085V2 with TimeMachine 0.1[/U][/I][/B][/COLOR][/FONT][/SIZE]
    [WIP] Trogdor! (ON HOLD converting to LUA, but almost caught up)

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

    Zitat Zitat von slicer4ever Beitrag anzeigen
    true, but i don't think it was necessary imo, anywho must have over looked it as gender my bad
    I figured why not throw it in since he's a noob maybe he'll look it up and learn something. 'unsigned' is a fairly straightforward concept. I wouldn't have done it with something more complex. Just trying to edge him forward a little.

  24. #8784
    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

    true, good call i guess

    zero check your thread
    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

  25. #8785
    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 slicer4ever Beitrag anzeigen
    also Khatharr why did you make the gender an unsigned int, seems a tad un-needed(and something that can confuse him since he's still fairly new)
    So showing him how to allocate memory without teaching memory management (ie freeing what you allocate) isn't going to confuse someone new?

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

    ahh my bad, forgot to free the memory
    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. #8787
    QJ Gamer Green
    Points: 9.134, Level: 64
    Level completed: 28%, Points required for next Level: 216
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    3.03OE-C
    Beiträge
    1.098
    Points
    9.134
    Level
    64
    Downloads
    0
    Uploads
    0

    Standard image loading

    i am still pretty confused on my question, i think its because of the way my code is set up. but here is most of my code

    Code:
    //OSlib header file
    #include <oslib/oslib.h>
    
    //Necessary to create eboot
    PSP_MODULE_INFO("Sample", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THRE AD_ATTR_USER | THREAD_ATTR_VFPU);
    
    //declaration of the pointers of our images
    OSL_IMAGE *background, *videlectrix, *sprite;
    
    //definitions
    #define DOWN 0
    #define UP 35
    #define RIGHT 70
    #define LEFT 105
    
    //variables
    int sprite_position;
    int sprite_march;
    
    //function declarations
    void Buttons();
    void SpriteAnimate();
    
    int main()
    {
    //Initialization of the Oslib library
    oslInit(0);
    
    //Initialization of the graphics mode
    oslInitGfx(OSL_PF_8888, 1);
    
    //Sets the transparency color (pink)
    oslSetTransparentColor(RG B(255,0,255));
    
    //loads our images into memory
    background = oslLoadImageFile("backgro und.png", OSL_IN_RAM, OSL_PF_5551);
    sprite = oslLoadImageFile("sprite. png", OSL_IN_RAM, OSL_PF_5551);
    videlectrix = oslLoadImageFile("videlec trix.png", OSL_IN_RAM, OSL_PF_5551);
    
    //Disables the transpaent color (pink)
    oslDisableTransparentColo r();
    
    //verification that all files are present
    if (!background || !sprite || !videlectrix)
    oslDebug("It is impossible to load one or more of the images that are required in this program. Please make sure you have all the files required in the eboot folder");
    
    //Sets the sprite's original position on the screen
    sprite->x = 155;
    sprite->y = 95;
    sprite_position = DOWN;
    
    //main while loop
    while (!osl_quit)
    {
    //To be able to draw on the screen
    oslStartDrawing();
    
    //calls the Buttons() function
    Buttons();
    
    //Draw the images to the screen
    oslDrawImage(videlectrix) ;
    
    //Ends drawing mode
    oslEndDrawing();
    
    //Synchronizes the screen
    oslSyncFrame();
    }
    
    //Terminate the program
    oslEndGfx();
    oslQuit();
    return 0;
    }
    
    
    void Buttons()
    {
    //initiate the PSP's buttons
    oslReadKeys();
    
    if (osl_keys->held.down)
    {
    //Sprite movement
    sprite->y += 2;
    
    //Sets the sprite's position on the spritesheet
    sprite_position = DOWN;
    
    //Calls the SpriteAnimate() function
    SpriteAnimate();
    }
    if (osl_keys->held.up)
    {
    sprite->y -= 2;
    sprite_position = UP;
    SpriteAnimate();
    }
    
    if (osl_keys->held.right)
    {
    sprite->x += 2;
    sprite_position = RIGHT;
    SpriteAnimate();
    }
    if (osl_keys->held.left)
    {
    sprite->x -= 2;
    sprite_position = LEFT;
    SpriteAnimate();
    }
    
    //If a button is not pressed
    if (!osl_keys->held.value)
    {
    //Start the variable over for when a button is pressed again
    sprite_march = 0;
    
    //Sets the sprite's direction
    oslSetImageTileSize(sprit e,0,sprite_position,22,35 );
    }
    }
    
    
    void SpriteAnimate()
    {
    //Moves the sprite in the row that it is in
    sprite_march++;
    
    //Moves the sprite constantly
    oslSetImageTileSize(sprit e,(sprite_march * 22),sprite_position,22,35 );
    
    //resets the sprite movement in that row
    if (sprite_march == 6) sprite_march = 0;
    
    }
    the places in bold are the areas i am dealing with. the first bold is the place that i am loading my first image which works, but i want to overlap that with a second pic and a sprite with a button command. so i go to the second bold part and try to put this in.

    Code:
    if (osl_keys->held.cross)
    {
    //Draw the images to the screen
    oslDrawImage(background);
    oslDrawImage(sprite);
    }
    but it just doesnt work. what am i doing wrong?
    CuRrEnT fIrMwArE [SIZE="3"][FONT="Times New Roman"][COLOR="Red"][B][I][U]3.90 M33-2 SLIM TA-085V2 with TimeMachine 0.1[/U][/I][/B][/COLOR][/FONT][/SIZE]
    [WIP] Trogdor! (ON HOLD converting to LUA, but almost caught up)

  28. #8788
    QJ Gamer Blue
    Points: 4.008, Level: 40
    Level completed: 29%, Points required for next Level: 142
    Overall activity: 0%

    Registriert seit
    Dec 2007
    Ort
    dfgd
    Beiträge
    66
    Points
    4.008
    Level
    40
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Khatharr Beitrag anzeigen
    I figured why not throw it in since he's a noob maybe he'll look it up and learn something. 'unsigned' is a fairly straightforward concept. I wouldn't have done it with something more complex. Just trying to edge him forward a little.

    well thats gd coz i read it n wa like unsigned :S
    lookd it up n it means --a value that can only be positive therefore it cannot be a negative number-- :humped:

    also say i created an array n then i wanted to free that array so i have more memory would i do this . . .

    int array[3];
    array[0] = 1;
    array[1] = 2;
    array[2] = 3;

    free(array) or would it be free(array[3]) also to free a variable would i just set it to NULL or free(variable).
    just wondering
    luke

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

    no free only works on things that you malloc
    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

  30. #8790
    QJ Gamer Silver
    Points: 14.087, Level: 77
    Level completed: 10%, Points required for next Level: 363
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Germany
    Beiträge
    926
    Points
    14.087
    Level
    77
    Downloads
    0
    Uploads
    0

    Standard

    Just don't deal with dynamic memory allocation alltogether for the time being... you're still missing on basic C syntax and programming techniques which is much more important to learn. As long as you declare variables like you did, you don't have to care about freeing the memory.

    And never ever call free upon an object that you didn't explicitly allocate with malloc() before.

    PS: And please try to write at least halfway proper english. It's a nuisance to read your writing.
    Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
    Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
    Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
    Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.


 

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

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