Seite 98 von 340 ErsteErste ... 48 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 148 198 ... LetzteLetzte
Zeige Ergebnis 2.911 bis 2.940 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 youresam The power switch is in the psppower.h file. Look at the PSPSDK sample on how to use ...

  
  1. #2911
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    The power switch is in the psppower.h file. Look at the PSPSDK sample on how to use it.

    (lol @ access_denied suggesting pspctrl)
    I assumed that he was talking about the hold switch, which is in pspctrl.h.



  2. #2912
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    How can I make a code that says some thin like if the power switch is pressed up then do whatever i want. how would i do that?
    Pressing it UP is power access.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  3. #2913
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von youresam
    Pressing it UP is power access.
    Wouldn't that just turn off the PSP though? Or can you override that?

  4. #2914
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Exactly, he wants to know when that happens. You get about a 1/2 second to detect the power switch before it powers down. This is useful because if youre reading a file...constantly....then you know you NEED_TO stop when power is pressed.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  5. #2915
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Ok but how would I make an if statement when the power switch is pulled up?
    Would it be like this:
    Code:
     if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING) {

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

    to generate a random number u can just use

    number = rand() % 100 + 1;
    [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]

  7. #2917
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    Ok but how would I make an if statement when the power switch is pulled up?
    Would it be like this:
    Code:
     if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING) {
    Correct,
    But note that it must be running in a power thread.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  8. #2918
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    the size is 13900225 bytes

    then
    int buffer = malloc(size);

    but buffer returns NULL , is the file to big to store to an int?(i guess but need to be sure)
    -= Double Post =-
    no need any more
    ported all functions to pspIo and fixed it;)
    -= Double Post =-
    another problem

    i am 99% sure the fault is here
    fread(&header, sizeof(HEADER), 1, infile);

    to

    sceIoRead(infile,&header, sizeof(HEADER));


    what did I wrong

    more info:
    Code:
    typedef struct
    {
    	char signature[4];
    
    	int version;
    
    	int offset[8];
    
    } HEADER;
    
    HEADER header; 
    
    infile=sceIoOpen(path, PSP_O_RDONLY, 0777);
    I hope someone can help me
    Geändert von hallo007 (02-24-2007 um 06:21 AM Uhr) Grund: Automerged Doublepost

  9. #2919
    Your Fate is Grim...
    Points: 11.640, Level: 70
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 0%

    Registriert seit
    Oct 2005
    Beiträge
    2.269
    Points
    11.640
    Level
    70
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Moca
    to generate a random number u can just use

    number = rand() % 100 + 1;

    yes, but keep in mind that you will also have to the the random seed. also, read up on the mersenne twister. its much more random.
    --------------------------------------------------------------------------------------

  10. #2920
    Points: 3.496, Level: 36
    Level completed: 98%, Points required for next Level: 4
    Overall activity: 0%

    Registriert seit
    Jan 2007
    Beiträge
    14
    Points
    3.496
    Level
    36
    Downloads
    0
    Uploads
    0

    Standard

    umm i was wondering if anyone knows some great basic c tutorials (i did the 6 on psp-prog and already have one homwbrew release but its very basic) so yea i want to get better but i need help with a lot of thing and motly makefiles i just dont get how to set them up

  11. #2921
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Flame4e
    umm i was wondering if anyone knows some great basic c tutorials (i did the 6 on psp-prog and already have one homwbrew release but its very basic) so yea i want to get better but i need help with a lot of thing and motly makefiles i just dont get how to set them up
    Go to my site. (Link in my sig) I think the C tutorials are all around easier than Yeldarb's. As for Makefile's, you just simply have to understand what the compiler does, and what the linker does. You can look in a general C tutorial for that.

    @Hallo0007-

    This will not do anything:

    int buffer = malloc(size);

    malloc is used to set the size of a buffer. You'd have to do something like this

    char* buffer = malloc(size);

  12. #2922
    Heroes never die
    Points: 8.645, Level: 62
    Level completed: 65%, Points required for next Level: 105
    Overall activity: 0%

    Registriert seit
    Aug 2006
    Ort
    ...........
    Beiträge
    1.323
    Points
    8.645
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    but smaller files were working , i stiil think the fault is here
    Code:
    fread(&header, sizeof(HEADER), 1, infile);
    
    to
    
    sceIoRead(infile,&header, sizeof(HEADER));
    
    
    what did I wrong
    
    more info:
    
    
    Code:
    typedef struct
    {
    	char signature[4];
    
    	int version;
    
    	int offset[8];
    
    } HEADER;
    
    HEADER header; 
    
    infile=sceIoOpen(path, PSP_O_RDONLY, 0777);
    I hope someone can help me

  13. #2923
    I'm Baaaack!
    Points: 17.067, Level: 83
    Level completed: 44%, Points required for next Level: 283
    Overall activity: 52,0%

    Registriert seit
    May 2006
    Ort
    Nowhere
    Beiträge
    2.186
    Points
    17.067
    Level
    83
    Downloads
    0
    Uploads
    0

    Standard

    I didn't even look at your code. I was just skimming the page and saw that, so I pointed it out.

  14. #2924
    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 Flame4e
    umm i was wondering if anyone knows some great basic c tutorials (i did the 6 on psp-prog and already have one homwbrew release but its very basic) so yea i want to get better but i need help with a lot of thing and motly makefiles i just dont get how to set them up
    In that case, just learn the language on the easiest development platform you have access which is the PC. Don't start developing on the PSP yet. Plenty of links can be find in the document here:

    http://parabellumgames.no-ip.org/art...c-programming/

    Access_Denied: Some quick comments on your tutorials. You don't explain the difference between various datatypes or what a variable actually does in the program. (ie variable represents a chunk of memory on the stack) or what it abstractly represents. It gets worst as you actually use pointers without explaining what they are.

    You also don't cover all areas of functions. Return types, parameter passing, what void means, the difference between a function definiton and declaration.

    There are also lot of other things but those two are most important as they are basics.

  15. #2925
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard PSP Power?!?

    Ok I modded the sdk sample of power to this:
    Spoiler for Mod:
    /************************* *******
    ************************* ******* PSP Software Development Kit - http://www.pspdev.org
    ************************* ******* -----------------------------------------------------------------------
    ************************* ******* Licensed under the BSD license, see LICENSE in PSPSDK root for details.
    ************************* *******
    ************************* ******* main.c - Sample to demonstrate proper use of the power library
    ************************* *******
    ************************* ******* Copyright (c) 2005 John Kelley <[email protected]>
    ************************* *******
    ************************* ******* $Id: main.c 1869 2006-04-09 14:21:59Z tyranid $
    ************************* *******/
    #include <stdlib.h>
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspctrl.h>
    #include <pspdisplay.h>
    #include <stdio.h>
    #include <pspmoduleinfo.h>
    #include <psppower.h>

    /************************* ******* Define the module info section ************************* *******/
    PSP_MODULE_INFO("PowerTes t", 0, 0, 71);

    char powerCBMessage[256];

    /************************* ******* Define printf, just to make typing easier ************************* *******/
    #define printf pspDebugScreenPrintf

    /************************* ******* Exit callback ************************* *******/
    int exit_callback(int arg1, int arg2, void ************************* *******common)
    {
    sceKernelExitGame();

    return 0;
    }
    FILE ************************* ******* pFile;
    int x = 24;
    /************************* ******* Power Callback ************************* *******/
    int power_callback(int unknown, int pwrflags, void ************************* *******common)
    {
    /************************* ******* check for power switch and suspending as one is manual and the other automatic ************************* *******/
    if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING) {
    x = x + 1;
    }
    sceDisplayWaitVblankStart ();
    return 0;
    }

    /************************* ******* Callback thread ************************* *******/
    int CallbackThread(SceSize args, void ************************* *******argp)
    {
    int cbid;
    cbid = sceKernelCreateCallback(" Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCall back(cbid);
    cbid = sceKernelCreateCallback(" Power Callback", power_callback, NULL);
    scePowerRegisterCallback( 0, cbid);
    sceKernelSleepThreadCB();

    return 0;
    }

    /************************* ******* Sets up the callback thread and returns its thread id ************************* *******/
    int SetupCallbacks(void)
    {
    int thid = 0;
    thid = sceKernelCreateThread("up date_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if (thid >= 0)
    sceKernelStartThread(thid , 0, 0);
    return thid;
    }

    /************************* ******* main routine ************************* *******/
    int main(int argc, char ************************* *******argv[])
    {
    SceCtrlData pad;
    int i = 0;
    int powerLocked = 0;
    int powerTicks = 0;
    u32 oldButtons = 0;
    int batteryLifeTime = 0;

    //init screen and callbacks
    pspDebugScreenInit();
    pspDebugScreenClear();
    SetupCallbacks();

    // Setup Pad
    sceCtrlSetSamplingCycle(0 );
    sceCtrlSetSamplingMode(0) ;

    //fetch and print out power and battery information
    for (;;) {
    /************************* ******* fix so the screen lines up right if the battery disappears ************************* *******/
    if (!scePowerIsBatteryExist( )) {
    pspDebugScreenClear();
    }

    pspDebugScreenSetXY(0, 0);
    printf("PSP Power Sample v1.0 by John_K\n\n");
    sceCtrlReadBufferPositive (&pad, 1);

    printf("External Power: %s\n", scePowerIsPowerOnline()? "yes" : "no ");
    printf("%-14s: %s\n", "Battery", scePowerIsBatteryExist()? "present" : "absent ");

    if (scePowerIsBatteryExist() ) {
    printf("%-14s: %s\n", "Low Charge", scePowerIsLowBattery()? "yes" : "no ");
    printf("%-14s: %s\n", "Charging", scePowerIsBatteryCharging ()? "yes" : "no ");
    batteryLifeTime = scePowerGetBatteryLifeTim e();
    printf("%-14s: %d%% (%02dh%02dm) \n", "Charge",
    scePowerGetBatteryLifePer cent(), batteryLifeTime/60, batteryLifeTime-(batteryLifeTime/60*********************** *********60));
    printf("%-14s: %0.3fV\n", "Volts", (float) scePowerGetBatteryVolt() / 1000.0);
    printf("%-14s: %d deg C\n", "Battery Temp", scePowerGetBatteryTemp()) ;
    } else
    printf("Battery stats unavailable\n");

    printf("%-14s: %d mHz\n", "CPU Speed", scePowerGetCpuClockFreque ncy());
    printf("%-14s: %d mHz\n", "Bus Speed", scePowerGetBusClockFreque ncy());
    printf("%-14s: %s \n", "Power Switch", powerLocked == 0 ? "unlocked" : "locked");
    printf("%-14s: %s \n", "Send Ticks", powerTicks == 1 ? "yes" : "no");
    printf("\nPress X to switch CPU between 333 and 222 mHz\n");
    printf("Press O to toggle power switch lock\n");
    printf("Press [] to toggle sending power ticks\n");
    //send powerTicks if enabled
    if (powerTicks == 1)
    if (scePowerTick(0) != 0)
    printf("Error calling scePowerTick(0)\n");

    //only check buttons if they've changed since last frame
    if (oldButtons != pad.Buttons) {
    //check to see if the user pressed X to toggle CPU speed
    if (pad.Buttons & PSP_CTRL_CROSS) {
    if (i == 0) {
    i = scePowerSetClockFrequency (333, 333, 166);
    if (i == 0) {
    i = 1;
    } else {
    printf("\nCould not set CPU to 333mHz (0x%08X)\n", i);
    i = 0;
    }
    } else {
    i = scePowerSetClockFrequency (222, 222, 111);
    if (i != 0) {
    printf("\nCould not set CPU to 222mHz (0x%08X)\n", i);
    i = 1;
    }
    }
    }
    //check to see if the user pressed O to toggle power locking
    if (pad.Buttons & PSP_CTRL_CIRCLE) {
    if (powerLocked == 0) {
    if (scePowerLock(0) == 0)
    powerLocked = 1;
    else
    printf("Error locking power switch\n");
    } else {
    if (scePowerUnlock(0) == 0)
    powerLocked = 0;
    else
    printf("Error unlocking power switch\n");
    }
    }
    //check to see if the user pressed [] to toggle PowerTicks
    if (pad.Buttons & PSP_CTRL_SQUARE)
    powerTicks = powerTicks == 1 ? 0 : 1;
    }

    pspDebugScreenSetXY(0, 30);
    printf("Power callback messages appear below:");
    pFile = fopen ("myfile.txt" , "w");
    fwrite (x , 1 , 29 , pFile);
    fclose (pFile);
    oldButtons = pad.Buttons;

    sceDisplayWaitVblankStart ();
    }

    sceKernelSleepThread();
    sceKernelExitGame();

    return 0;
    }

    When I run it it works fine so i went to test it out by just flicking up my poweswitch and then the memory stick light blinked (it was getting ready to write to the txt file) and the it just froze. Why would that happen? Is it beacuse I gave it too much to do before powering down?

  16. #2926
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Ok Im having a problem with my bullet system, when I press X, no matter what direction im facing it changes my player's position to face north west and fire the bullet south west for some reason,

    heres the bulletFire function

    Spoiler for function:
    //BULLET SYSTEM

    void bulletFire() {
    if (firing == true) {
    if(Pdir == 1) {
    by = by - 10;
    }

    if (Pdir == 2) {
    bx = bx + 10;
    by = by - 10;
    }
    if (Pdir == 3) {
    bx = bx + 10;
    }
    if (Pdir = 4) {
    bx = bx + 10;
    by = by + 10;
    }
    if(Pdir = 5) {
    by = by + 10;
    }
    if(Pdir = 6) {
    bx = bx - 10;
    by = by + 10;
    }
    if(Pdir = 7) {
    bx = bx - 10;
    }
    if(Pdir = 8) {
    bx = bx - 10;
    by = by - 10;
    }
    blitAlphaImageToScreen(0, 0, 12, 12, Bulletpic, bx, by);
    //bullet goes of screen...
    if(bx > 480) {
    firing = false;
    }else if(bx < 0) {
    firing = false;
    }else if(by > 272) {
    firing = false;
    }else if(by < 0) {
    firing = false;
    }
    }

    }


    Then I call it like this,

    Code:
    //Weapon firering 
             if(pad.Buttons & PSP_CTRL_CROSS && (autof == 100) && (firing == false)) {           
                            autof = 0;
                               bx = playerX - 15;
                               by = playerY - 16; 
                               firing = true; 
                   }
    Any ideas?




    EDIT: Can't believe this, while reviewing my post i finally found what was wrong, Sorry for wasting post space
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  17. #2927
    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 have a question, sorta. What is a reasonable value for fog density so the fog has a large range of area to go from no fog, to light light fog, to light fog, to medium fog, to dense fog, to complete fog... Its hard to explain, so if you dont understand, just say so :o

    BS - Just to take a crack at it, even though you fixed it - looks to me like somewhere in your other code your setting Pdir to 4, with out knowing it... Thats all i could really gather from your little snippet.

    also, a little otimization trick:
    Code:
    if(bx > 480) {
    firing = false;
    }else if(bx < 0) {
    firing = false;
    }else if(by > 272) {
    firing = false;
    }else if(by < 0) {
    firing = false;
    }
    Can be converted to:
    Code:
    if(bx > 480 || bx < 0 || by > 272 || by < 0) firing = false;
    You need to make more usage of the logical operators.

    Also, another optimization, use a switch case statement instead of:
    Code:
    if(Pdir == 1) {
    by = by - 10;
    }
    
    if (Pdir == 2) {
    bx = bx + 10;
    by = by - 10;
    }
    if (Pdir == 3) {
    bx = bx + 10;
    }
    if (Pdir = 4) {
    bx = bx + 10;
    by = by + 10;
    }
    if(Pdir = 5) {
    by = by + 10;
    }
    if(Pdir = 6) {
    bx = bx - 10;
    by = by + 10;
    }
    if(Pdir = 7) {
    bx = bx - 10;
    }
    if(Pdir = 8) {
    bx = bx - 10;
    by = by - 10;
    }
    Via:
    Code:
    switch(Pdir) {
       case 1: { by -= 1; break; }
       case 2: { bx += 1; by -= 1; break; }
       case 3: { bx += 1; break; }
       case 4: { bx += 1; by += 1; break; }
       case 5: { by += 1; break; }
       case 6: { bx -= 1; by += 1;break; }
       case 7: { bx -= 1; break; } 
       case 8: { bx -= 1; by -= 1; break; }
       default: { Pdir = some_default_value; break; }
    }

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


  18. #2928
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    ok thank you, turns out i also set Pdir to 5, 6, and 7 as well, (thats y i was getting such a weird step,

    also thanks for the optimization tips, was trying to figure out what the C equivelent of "or" was to lua, now i know its ||, much helpful :), I knew about switch case but wasn't sure I knew enough to implement them, I can study that to use more if needed, thanks again SG
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

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

    Switch case statements confused me at first as well. I simply skipped them. But later, I learned to love them ;) Hell, i made that TIFF Pixel Repair app just as an excuse to use switch statements ;) If you dive into emulator developing, youll find switch case statements everywhere.

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


  20. #2930
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Now i just need to figure out how to make the image "rotate" when L or R is pressed (like CsPSP)
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

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

    You have 2, efficient, options for that.

    1. Use hardware rotation, but this will require knowledge of the PSPs GU function calls and how to use them effectively.

    2. Pre-defined image rotation by using an image editor and applying the rotation to it, but this can eat up alot of memory if you have 360** of rotation and/or a large image. Your best bet for this would be to place all angles of rotation of the sprite you want, onto a sprite sheet, and also get rid of any unimportant angles of rotation (example, to cut your amount of sprites in 1/2, increment your angles of rotation by 2. This will significantly reduce hte amount of memory taken up (depending on sprite size) and not be 100% noticeable.

    I believe CSPSP uses the GU.

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


  22. #2932
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    yes, he used the GU (got some help from him earlier and thats what he used) My main concern is that if I managed to do the image rotation, how would i do the bullet system? he used a bullet class in C++ so that option is out for me :S
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

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

    Use TP's little bullet sustem guide thing. Have L and R rotate a point around in a circle, and use those X and Y coordinates with TP's guide (instead of the cursor thing).

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


  24. #2934
    QJ Gamer Silver
    Points: 7.278, Level: 56
    Level completed: 64%, Points required for next Level: 72
    Overall activity: 0%

    Registriert seit
    Oct 2006
    Ort
    Pimp'en in the US F#
    Beiträge
    1.254
    Points
    7.278
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    Where can i find this guide? I remember seeing somewhere not sure were though, (if all else fails ill google it)
    The Wentire Worls in two Sectors....
    When did I get dev statz?
    Spoiler for my PSP homebrewReleases:
    Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
    (PvP Pong DL'ed well over 2403 times combined! get yours now!)
    Spoiler for Great Quotes:

    "No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.

  25. #2935
    Mushroom Man
    Points: 7.283, Level: 56
    Level completed: 67%, Points required for next Level: 67
    Overall activity: 0%

    Registriert seit
    Sep 2005
    Ort
    UK
    Beiträge
    318
    Points
    7.283
    Level
    56
    Downloads
    0
    Uploads
    0

    Standard

    For image rotation a software solution really won't cut it unless you can optimise on the usual rotation method. (see attachment)

    Your other option is to use OpenGL to render your textures onto a flat surface, after which you can use the basic matrix transformations to rotate the image. Using this method rendering around 180 entities I have got FPS up to 40 or so I believe; certainly alot faster than the software rotation method which trundled along at approx .5 FPS ;)

    As SG57 said you have the option of using a tileset of rotations of the original image at intervals of say 15 degrees, however I find this method gives a somewhat static feel to it.

    For the OpenGL method read up on the ported "Nehes" OpenGL tutorials for the PSP, in particular Lesson 6(for loading/rendering a texture to a face), Lesson 12(for display lists and rotation) and Lesson 20(for masking/blending).

    Links:
    Nehe Tutorials 1-10 http://www.qj.net/portage-of-nehe-tu...g/49/aid/47390
    Nehe Tutorials 11-20 http://pspupdates.qj.net/Portage-of-...g/49/aid/59254
    Angehängte Dateien Angehängte Dateien

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

    vLib does image rotation with the GU for you, but if you're already quite far into your project you're gonna need a lot of changes...

  27. #2937
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Can some please answer my PSP Power problem on the last page. Thx :)

  28. #2938
    Points: 24.247, Level: 94
    Level completed: 90%, Points required for next Level: 103
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    texas
    Beiträge
    2.803
    Points
    24.247
    Level
    94
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von pspfreak9
    Can some please answer my PSP Power problem on the last page. Thx :)
    Tell me why you need to know if the PSP is turning off.
    牧来栠摩琠敨映汩獥
    PSN: youresam
    From Earth the Frozen Ipaqs shall rise and be silenced and all will live free.
    --Mike Hollingsworth

  29. #2939
    Points: 8.718, Level: 62
    Level completed: 90%, Points required for next Level: 32
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Beiträge
    484
    Points
    8.718
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    Well because using the code in netlib, if your player 1 and waiting for player 2 and if you turn off the power switch the game wont work any more. I need it to netsend "empty" to the room before powering down, and maybe netunreg.
    -= Double Post =-
    i was just testing it by writing to a txt file
    Geändert von pspfreak9 (02-25-2007 um 09:27 AM Uhr) Grund: Automerged Doublepost

  30. #2940
    is not posting very often
    Points: 33.152, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Overall activity: 99,6%

    Registriert seit
    Feb 2006
    Ort
    omnipresent
    Beiträge
    5.162
    Points
    33.152
    Level
    100
    Downloads
    0
    Uploads
    0

    Standard

    wait, netlib = lua, isnt this the C/C++ help thread?
    What did we think the world would look like in 2015?

    Zitat Zitat von Abe
    Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
    http://forums.qj.net/501501-post26.html


 

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

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