Seite 159 von 340 ErsteErste ... 59 109 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 209 259 ... LetzteLetzte
Zeige Ergebnis 4.741 bis 4.770 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; thats an explenation (y) thnx yaust a r I ported it: Code: if(fileList[loop].size() > 10) { fileBuffer[loop].clear(); fileBuffer[loop].append( fileList[loop], 0 ...

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

    thats an explenation (y)

    thnx yaustar
    I ported it:
    Code:
                      if(fileList[loop].size() > 10)
                      {
                                         fileBuffer[loop].clear(); 
                                         fileBuffer[loop].append( fileList[loop], 0 , 10);
                                         fileBuffer[loop].append( 2, '.' );
                                         }



  2. #4742
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    Something tells me that's not going to work very well. Maybe it's the clearing and then appending itself with itself (even though it's empty). I dunno.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

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

    dude
    fileBuffer[loop].append( fileList[loop], 0 , 10);

    they are two differnt variabels

  4. #4744
    It's good to be free...
    Points: 10.420, Level: 67
    Level completed: 93%, Points required for next Level: 30
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    2.440
    Points
    10.420
    Level
    67
    Downloads
    0
    Uploads
    0

    Standard

    ...oh.
    I feel stupid now.
    pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ

  5. #4745
    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

    ok i'm trying to add a multi array to my function yest i'm unsure how i've been trying:

    object update(float** object_vertex_array,int max_vertexs,int frame_to){
    object update(float **object_vertex_array,int max_vertexs,int frame_to){
    object update(float *object_vertex_array[],int max_vertexs,int frame_to){
    object update(float *object_vertex_array,int max_vertexs,int frame_to){

    yet for the first 3 i always get the following error:

    ./main.cpp: In function 'int main(int, char**)':
    ./main.cpp:61: error: cannot convert 'float (*)[3]' to 'float**' for argument '1
    ' to 'object update(float**, int, int)'
    make: *** [main.o] Error 1

    and i call it like:

    test_object_float[0][1]=0.0f;
    test_object_float[0][2]=1.0f;
    test_object_float[0][3]=0.0f;

    test_object_float[1][1]=1.0f;
    test_object_float[1][2]=-1.0f;
    test_object_float[1][3]=0.0f;

    test_object_float[2][1]=-1.0f;
    test_object_float[2][2]=-1.0f;
    test_object_float[2][3]=0.0f;

    test_object = update(test_object_float, numOfTriangles,1);
    test_object = update(test_object_float[3],numOfTriangles,1);

    the second way gives me the following error:
    ./main.cpp: In function 'int main(int, char**)':
    ./main.cpp:61: error: cannot convert 'float*' to 'float**' for argument '1' to '
    object update(float**, int, int)'
    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

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

    *ick* Now we start running into problems
    Code:
    #include <stdio.h>
    
    void aFunction( float * anArray )
    {
    	printf( "%f\n", anArray[0] ); // same as [0][0]
    	printf( "%f\n", anArray[3] ); // same as [1][0]
    }
    
    int main(int argc, char* argv[])
    {
    	float blah[3][3] = {	{ 0.0f, 1.0f, 2.0f},
    	{ 3.0f, 4.0f, 5.0f	},
    	{ 6.0f, 7.0f, 8.0f }}	;
    
    	float * apBLah = (float *)(blah);
    
    	aFunction( apBLah );
    
    	return 0;
    }
    Note: This is dangerous and possibly undefined behaviour.
    Geändert von yaustar (05-30-2007 um 01:45 AM Uhr)

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

    thxs yaustar but i still get this error:

    /main.o
    ./main.cpp: In function 'int main(int, char**)':
    ./main.cpp:62: error: cannot convert 'float*' to 'float**' for argument '1' to '
    object update(float**, int, int)'
    ./functions/update_object.txt: In function 'object update(float*, int, int)':
    ./functions/update_object.txt:8: error: invalid types 'float[int]' for array sub
    script
    ./functions/update_object.txt:9: error: invalid types 'float[int]' for array sub
    script
    ./functions/update_object.txt:10: error: invalid types 'float[int]' for array su
    bscript
    make: *** [main.o] Error 1

    i've been looking around for an answer and none have worked so i'm beginning to think that you can't pass a multi array into a function(which is odd)

    edit: i figured it out i changed:
    (float *)(blah)
    to
    (float **)(blah)
    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

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

    My posted code compiles straight off. If you are using this, then you have applied the concept incorrectly. You can't pass a multi-dimension static sized array due to the way that the memory is laid out. That is why I converted it to a one dimensional array before passing it to a function.

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

    nvm i found out what i was doing and no longer need that as i like to declare my functions after my main function so i called the function earlier in the program and forgot to go back and change that now it's working=-)
    Geändert von slicer4ever (05-30-2007 um 02:05 PM 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

  10. #4750
    QJ Gamer Silver
    Points: 7.073, Level: 55
    Level completed: 62%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    280
    Points
    7.073
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Hi! :)

    I'm a noob and I have a noob question for you. :)
    I searched the forum but didn't find any answer.

    I have a problema with the function sceDisplaySetBrightness.
    The first time I try to execute it my program hangs and returns to the dashboard.

    Can someone help me, please?

    Here's my code:
    Code:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <psppower.h>
    
    PSP_MODULE_INFO("Brightness Test ", 0x1000, 1, 1);
    
    void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
    #define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
    void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
    #define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8
    
    // TWILIGHT ZONE! <do doo do doo>
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
              int thid = 0;
    
              thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
              if(thid >= 0) {
                        sceKernelStartThread(thid, 0, 0);
              }
    
              return thid;
    }
    // END OF TWILIGHT ZONE! <do doo do do>
    
    int main() {
    		  scePowerSetClockFrequency(222, 222, 111);
    
              pspDebugScreenInit();
              SetupCallbacks();
    
    		  int curBrightness = 0;
    		  SceCtrlData pad;
    
    		  curBrightness = 100;
    		  pspDebugScreenSetTextColor(0xffffff);
    		  pspDebugScreenSetBackColor(0x000000);
    		  pspDebugScreenInit();
    
    		  pspDebugScreenSetXY(0, 23);
    		  pspDebugScreenPrintf("Press L or R to change brightness");
    		  pspDebugScreenSetXY(0, 24);
    		  pspDebugScreenPrintf("Press TRIANGLE to exit");
    
    		  while(1) {
    			pspDebugScreenSetXY(0, 15);
    			pspDebugScreenPrintf("Current brightness: %i", curBrightness);				
    
    			sceCtrlReadBufferPositive(&pad, 1);
    			if(pad.Buttons & PSP_CTRL_LTRIGGER) {
    				if (curBrightness > 0){
    					curBrightness--;
    					sceDisplaySetBrightness(curBrightness, 0);
    				}
    			}else if(pad.Buttons & PSP_CTRL_RTRIGGER) {
    				if (curBrightness < 100){
    					curBrightness++;
    					sceDisplaySetBrightness(curBrightness, 0);
    				}
    			}else if(pad.Buttons & PSP_CTRL_TRIANGLE) {
    				break;
    			}
    			sceKernelDelayThread(100000);
    		  }
    		  sceKernelExitGame();
    		  return(0);
    }
    Many thanks. :)
    Ciaooo
    Sakya

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

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

    Standard

    Zitat Zitat von yaustar
    My posted code compiles straight off. If you are using this, then you have applied the concept incorrectly. You can't pass a multi-dimension static sized array due to the way that the memory is laid out. That is why I converted it to a one dimensional array before passing it to a function.
    since when ?

    Surely,

    Code:
    void functionName(int array [][10])
    {
       //Code goes here
    }
    that works no ? cos my programs let me ?

  12. #4752
    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 MiG
    since when ?

    Surely,

    Code:
    void functionName(int array [][10])
    {
       //Code goes here
    }
    that works no ? cos my programs let me ?
    Sorry, I meant to add "via pointer to a pointer".

    Code:
    void function( int ** anArray )
    {
    	// This won't work if you pass a statically sized array
    }
    
    void function( int anArray[10][10] )
    {
    	// This will work as expected as long as the size of the arrays are correct
    }

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

    Zitat Zitat von sakya
    Hi! :)

    I'm a noob and I have a noob question for you. :)
    I searched the forum but didn't find any answer.

    I have a problema with the function sceDisplaySetBrightness.
    The first time I try to execute it my program hangs and returns to the dashboard.

    Can someone help me, please?

    Here's my code:
    Code:
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <psppower.h>
    
    PSP_MODULE_INFO("Brightness Test ", 0x1000, 1, 1);
    
    void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
    #define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
    void sceDisplay_driver_31C4BAA8(int *a0,int *a1);
    #define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8
    
    // TWILIGHT ZONE! <do doo do doo>
    /* Exit callback */
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    /* Callback thread */
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    /* Sets up the callback thread and returns its thread id */
    int SetupCallbacks(void) {
              int thid = 0;
    
              thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
              if(thid >= 0) {
                        sceKernelStartThread(thid, 0, 0);
              }
    
              return thid;
    }
    // END OF TWILIGHT ZONE! <do doo do do>
    
    int main() {
    		  scePowerSetClockFrequency(222, 222, 111);
    
              pspDebugScreenInit();
              SetupCallbacks();
    
    		  int curBrightness = 0;
    		  SceCtrlData pad;
    
    		  curBrightness = 100;
    		  pspDebugScreenSetTextColor(0xffffff);
    		  pspDebugScreenSetBackColor(0x000000);
    		  pspDebugScreenInit();
    
    		  pspDebugScreenSetXY(0, 23);
    		  pspDebugScreenPrintf("Press L or R to change brightness");
    		  pspDebugScreenSetXY(0, 24);
    		  pspDebugScreenPrintf("Press TRIANGLE to exit");
    
    		  while(1) {
    			pspDebugScreenSetXY(0, 15);
    			pspDebugScreenPrintf("Current brightness: %i", curBrightness);				
    
    			sceCtrlReadBufferPositive(&pad, 1);
    			if(pad.Buttons & PSP_CTRL_LTRIGGER) {
    				if (curBrightness > 0){
    					curBrightness--;
    					sceDisplaySetBrightness(curBrightness, 0);
    				}
    			}else if(pad.Buttons & PSP_CTRL_RTRIGGER) {
    				if (curBrightness < 100){
    					curBrightness++;
    					sceDisplaySetBrightness(curBrightness, 0);
    				}
    			}else if(pad.Buttons & PSP_CTRL_TRIANGLE) {
    				break;
    			}
    			sceKernelDelayThread(100000);
    		  }
    		  sceKernelExitGame();
    		  return(0);
    }
    Many thanks. :)
    Ciaooo
    Sakya
    can you set it to 100? isnt 4 the maximum?

  14. #4754
    QJ Gamer Silver
    Points: 7.073, Level: 55
    Level completed: 62%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    280
    Points
    7.073
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Hi! :)
    Zitat Zitat von hallo007
    can you set it to 100? isnt 4 the maximum?
    The first parameter is 0-100:
    Code:
    void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
    :)

    Ciaooo
    Sakya

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

    sceKernelDelayThread(1000 00);
    is in your while loop , you will be able to push a button for 0,00000000000000000000000 0000000000000001 seconds :P
    use it like this ;-)
    Code:
    if (curBrightness < 100)
    {
         curBrightness++;
         sceDisplaySetBrightness(curBrightness, 0);
         sceKernelDelayThread(100000);
    }
    understand? feel free to ask questions;-)

  16. #4756
    QJ Gamer Silver
    Points: 7.073, Level: 55
    Level completed: 62%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    280
    Points
    7.073
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Hi! :)

    Many thanks for your reply. :)

    Zitat Zitat von hallo007
    sceKernelDelayThread(1000 00);
    is in your while loop , you will be able to push a button for 0,00000000000000000000000 0000000000000001 seconds :P
    use it like this ;-)
    Oooops, many thanks. ;)
    I fixed this by moving the sceKernelDelayThread() after sceDisplaySetBrightness() , but the program keeps hanging when I press L to change brightness.

    Ciaooo
    Sakya

  17. #4757
    QJ Gamer Green
    Points: 4.824, Level: 44
    Level completed: 37%, Points required for next Level: 126
    Overall activity: 0%

    Registriert seit
    Feb 2007
    Beiträge
    317
    Points
    4.824
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    I need some help. How do you play a pmf file? Is there a library with a tutorial to download?
    Current releases:
    Icon Action Replacer v1.5- latest release
    Current projects:
    PSP C++ IDE - Currently v1.6
    RPG Paradise - Latest version at my website

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

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

    Standard

    Zitat Zitat von sakya
    Hi! :)

    Many thanks for your reply. :)


    Oooops, many thanks. ;)
    I fixed this by moving the sceKernelDelayThread() after sceDisplaySetBrightness() , but the program keeps hanging when I press L to change brightness.

    Ciaooo
    Sakya
    Seen as sceKernelDelayThread(1000 0); will delay your program for a lonnng time, i think its 10s ? i don't know how the delays work on the PSP, but if its milliseconds, it will delay your app for 10s. Change it to something like 100, its just to stop the user from frantically changing the settings.

    MiG

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

    no
    1000000 is 1 second ;-)

  20. #4760
    QJ Gamer Silver
    Points: 7.385, Level: 57
    Level completed: 18%, Points required for next Level: 165
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Finland
    Beiträge
    752
    Points
    7.385
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von hallo007
    no
    1000000 is 1 second ;-)
    Yeah, sceKernelDelayThread takes the time to wait as microseconds.

    BTW, I'm having trouble with building PSPlink & psplinkusb with the new toolchain. If anyone has the PC side binaries for Ubuntu and would like to share them, please PM me :)
    wheeee =:D

  21. #4761
    QJ Gamer Silver
    Points: 7.073, Level: 55
    Level completed: 62%, Points required for next Level: 77
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Beiträge
    280
    Points
    7.073
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Hi! :)
    Zitat Zitat von hallo007
    no
    1000000 is 1 second ;-)
    Yes, the program doesen't sleep for 10 seconds or 1 second. :)
    Nobody knows why sceDisplaySetBrightness() makes my program hang?
    Or have someone an example usage of this function?

    Many thanks.
    Ciaooo
    Sakya

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

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

    I gotz a question! (obviously :P) Im porting my game to the Old School Library and as such i found it ridiculesly easy to rotate images, so, I would like to rotate smoothly instead of the simple up,down,left,right directions, problem is, how would i make a bullet System to match that??? My result is much like what CS 2d is, but he uses a C++ class for his bullet system, How would i do this in C?
    Thank you!
    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.

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

    BlackShark - A C++ class can be ported to C via removing the function names class:: pre-fix. As for how he rotated to match the direction vector, one method would be to make a particle engine, and have the bullet be a particle but with a constant, fixed rate of fading and color change for each particle, giving it that solid color look. As for the other method (rotating an actual bullet image to the direction vector) you could grab a point somewhere along your player's direction vector and use atan2f to get what degree it is rotated to your player. Hope that helps (if you need any more help, im free tonight)

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


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

    Well, I am not that experienced so I would not even know were to begin in making a particle engine :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.

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

    Well, then go with the second option. It may be even faster as it doesnt require as many trig calculations per cycle.

    For the second option, here's what i would when the bullet is fired (AKA when the X or R trigger button is pressed)

    Note: The bullet image would need to have 0 degrees as straight up.
    Code:
    if(osl_key->pressed.cross && numBulletsOnScreen < MAX_BULLETS) {
        bullet[currentBullet].image->angle = atan2f((crosshair.y+crosshair.image->height*0.5) - (player.y+player.image->height*0.5), (crosshair.x+crosshair.image->width*0.5) - (player.x+player.image->width*0.5)); // the *0.5 is faster then /2, which is centering where to shoot the bullet from, you could even mod these to shoot from the end of hte barrel for better accuracy
        bullet[currentBullet].xspeed = oslCos(bullet[currentBullet].angle,1);
        bullet[currentBullet].yspeed = oslSin(bullet[currentBullet].angle,1);
        bullet[currentBullet].onScreen = true;		
        if(currentBullet >= MAX_BULLETS)
            currentBullet = 0;
        else
            currentBullet += 1;
    }
    Then you'd say if currentBullet onScreen is true, draw it and move the X values via adding xspeed and Y values via adding yspeed. I might make an example just for fun, but my PSP is currently non useable (it works, its just the LCD is not plugged in)
    Geändert von SG57 (06-01-2007 um 11:30 PM Uhr)

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


  27. #4767
    QJ Gamer Silver
    Points: 7.385, Level: 57
    Level completed: 18%, Points required for next Level: 165
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Finland
    Beiträge
    752
    Points
    7.385
    Level
    57
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von sakya
    Hi! :)

    Yes, the program doesen't sleep for 10 seconds or 1 second. :)
    Nobody knows why sceDisplaySetBrightness() makes my program hang?
    Or have someone an example usage of this function?

    Many thanks.
    Ciaooo
    Sakya
    It may be either that you are not in kernel mode (but it shouldn't totally freeze if you're in user mode) or the 1.5 kernel doesn't support that function.
    wheeee =:D

  28. #4768
    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

    edit: i found my prob i plan to release the source to this later
    Geändert von slicer4ever (06-02-2007 um 01:48 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

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

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

    Standard

    Blackshark, think about it like this. Say you have a cursor on the screen and when you shoot you want to the bullet to shoot in the direction of the cursor. The concept for what you want to do is just to make the cursor invisible. So, as your character rotates, the bullet is always shooting in the direction the character is facing (In which the cursor would usually be).

  30. #4770
    QJ Gamer Green
    Points: 8.459, Level: 62
    Level completed: 3%, Points required for next Level: 291
    Overall activity: 32,0%

    Registriert seit
    Apr 2007
    Beiträge
    886
    Points
    8.459
    Level
    62
    Downloads
    0
    Uploads
    0

    Standard

    i want to load ELF using this code
    Code:
     if (pad.Buttons & PSP_CTRL_RTRIGGER){
    	    struct SceKernelLoadExecParam param;
    		
    		memset(&param, 0, sizeof(param));
    
    		param.size = sizeof(param);
    		param.args = strlen(DEFINED_ELF)+1;
    		param.argp = DEFINED_ELF;
    		param.key = "game";
    
    		sceKernelLoadExec(DEFINED_ELF, &param);
        }
    psp resets when loading the elf


 

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 .