Seite 281 von 340 ErsteErste ... 181 231 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 331 ... LetzteLetzte
Zeige Ergebnis 8.401 bis 8.430 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; Nope, no such luck unfortunatly. -Aura...

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

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

    Standard

    Nope, no such luck unfortunatly.

    -Aura


    Last.fm | Deviant Art | First working OS picture

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

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

    Judas - Are you aware of hte relationship between pointers and arrays...

    TMNT - In my Kitten Cannon game, you'll notice there's more then one blood splatter on screen (i think i specified 22 max on screen in the constants..) but anyways in your case, i recommend making a bullet structure or class. But to put it simply, something like this (i won't give you exact working code, learn from this then apply it to your situation ;))
    Code:
    const int NUM_BULLETS_ON_SCREEN = ?;
    const int BULLET_SPEED = ?;
    
    typedef struct
    {
      int iX, iY, iDamage, iSpeed;
      bool bVisible;
    } Bullet;
    
    OSL_IMAGE *imgBullet = NULL;
    Bullet sBullet[NUM_BULLETS_ON_SCREEN];
    int iCurrentBullet = 0;
    int iNumActiveBullets = 0;
    
    void LoadBullet()
    {
      if (imgBullet)
        oslDeleteImage(imgBullet);
    
      imgBullet = oslLoadImageFilePNG("bullet.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
      oslAssert(imgBullet);
    
      // 0 - initial delay until repeat
      // 30 - were running at 60 FPS, so 30 waits 1/2 a second per shot
      oslSetKeyAutorepeat(OSL_KEYMASK_CROSS, 0, 30);
    }
    
    void UnloadBullet()
    {
      if (imgBullet)
        oslDeleteImage(imgBullet);
        
      imgBullet = NULL;
    }
    
    void InitBullets()
    {
      for (int i = 0; i < NUM_BULLETS_ON_SCREEN; i++)
      {
        sBullet[i].iX = 0;
        sBullet[i].iY = 0;
        sBullet[i].iDamage = 0;
        sBullet[i].iSpeed = 0;
        sBullet[i].bVisible = false;
      }
      
      iCurrentBullet = 0;
      iNumActiveBullets = 0;
    }
    
    void CreateBullet(int posx, int posy)
    {
      sBullet[iCurrentBullet].iX = posx;
      sBullet[iCurrentBullet].iY = posy;
      sBullet[iCurrentBullet].iDamage = ?;
      sBullet[iCurrentBullet].iSpeed = BULLET_SPEED;
      sBullet[iCurrentBullet].bVisible = true;
    
      iCurrentBullet++;
    }
    
    void Input()
    {
      oslReadKeys();
    
      if (osl_keys->pressed.cross)
      {
        CreateBullet(player.x,player.y);
      }
    	
      move player blah...
    }
    
    void UpdateBullets()
    {
      iNumActiveBullets = 0;
    
      for (int i = 0; i < NUM_BULLETS_ON_SCREEN; i++)
      {
        if (sBullet[i].bVisible)
        {
          sBullet[i].iX += sBullet[i].iSpeed;
    
          if (sBullet[i].iX > SCREEN_WIDTH)
          {
            sBullet[i].bVisible = false;
          }
          else if(BulletPlayerCollision(sBullet[i])
          {
            bullet player collision is occuring...
            player.health -= (sBullet[i].iDamage);
          }
          else
          {
            iNumActiveBullets++;
          }
        }
      }
    }
    
    void DrawBullets()
    {
      for (int i = 0; i < NUM_BULLETS_ON_SCREEN; i++)
      {
        if (sBullet[i].bVisible)
        {
          imgBullet->x = sBullet[i].iX;
          imgBullet->y = sBullet[i].iY;
          
          oslDrawImageSimple(imgBullet);
        }
      }
    }
    This is untested and I wrote it up real quick, however it should work. You should notice some drastic changes that greatly improve readability and gameplay, one of which completely removes your whole fire delay thing for rapid fire - OSlib has a built in autokey repeat delay. Please look at the documentation else you'll keep hurting yourself ;)

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


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

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

    Standard

    Awesome dude! The thing is, everytime i ask someone about rapidfire, they just give me code. Could you explain the logic behind that? And what is "bool"?
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

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

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

    The logic behind the rapid fire code there is all in the built in autorepeat feature in OSlib. you'll notice that when loading the bullet image (LoadBullet) im setting a key repeat for the CROSS button so that it is automatically 'pressed' again every 1/2 seconds if you are holding it down.

    As for the bool thing, it's a data type - google is your friend ;)

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


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

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

    Standard

    Oh, thanks. But how do you let your image (weapon) blit, and then blit again (on the screen at the same time), each with independent x and y coordinates?
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

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

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

    Have you looked at my draw function? It does exactly what you just asked...

    It loops through all the bullets, if a bullet is visible, it draws the bullet image at the bullet's position. Efficient and works great, what's the problem?

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


  7. #8407
    QJ Gamer Gold
    Points: 13.727, Level: 76
    Level completed: 20%, Points required for next Level: 323
    Overall activity: 0%

    Registriert seit
    Apr 2007
    Beiträge
    1.493
    Points
    13.727
    Level
    76
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Auraomega
    Nope, no such luck unfortunatly.

    -Aura
    Check your PM box ;)

  8. #8408
    QJ Gamer Blue
    Points: 4.296, Level: 41
    Level completed: 73%, Points required for next Level: 54
    Overall activity: 0%

    Registriert seit
    Jul 2006
    Beiträge
    132
    Points
    4.296
    Level
    41
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von cruisx
    im trying to do collision but i have a prob. I cant seem to move my main sprite so i can check if the 2 other objects have collision. Can someone please help?


    Code:
    //Oslib header file
    #include <oslib/oslib.h>
    
    //This is needed for eboot
    PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
    PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
    
    //this creates pointers for our images.
    OSL_IMAGE *sprite, *sprite2, *sprite3;
    
    //definations
    #define DOWN 0
    #define UP 35
    #define RIGHT 70
    #define LEFT 105
    
    //variables
    int sprite_position;
    int sprite_march;
    
    //declare the function like buttons and spriteAnimation
    void Buttons();
    void SpriteAnimate();
    int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY,OSL_IMAGE *img3, float img3posX, float img3posY );
    
    int main()
    {
    
    //start the Oslib library
        oslInit(0);
    //start the graphixs mode
        oslInitGfx(OSL_PF_8888, 1);
    
    //sets the transparency color
        oslSetTransparentColor(RGB(255,0,255));
    
    //loads the images into memory
        sprite = oslLoadImageFile("sprite.png", OSL_IN_RAM, OSL_PF_5551);
        sprite2 = oslLoadImageFile("sprite2.png", OSL_IN_RAM, OSL_PF_5551);
        sprite3 = oslLoadImageFile("sprite3.png", OSL_IN_RAM, OSL_PF_5551);
    
    //Disables the transparent color so it cannot be used again
        oslDisableTransparentColor();
    
    //sees if all files are avaiable
        if (!sprite || !sprite2||!sprite3)
            oslDebug("! one or more of the files were missing, the program cannot run");
            
            
    //Sets the sprites original position, lets see if i can get 2 sprites on da bloody screen
        sprite->x = 155;
        sprite->y = 95;
        sprite_position = DOWN;
    
    //sets second sprite position
        sprite2->x = 230;
        sprite2->y = 130;
        
    //sets thrid sprite pos
        sprite3->x = 270;
        sprite3->y = 130;
    
    
    //main while loop
        while (!osl_quit)
        {
            //to be able ot draw on the screen
                oslStartDrawing();
                
            //Buttons 
                Buttons();
                
            //draws a green background
                oslDrawGradientRect(0,0,480,272,RGB(0,128,0),RGB(0,128,0), RGB(128,255,128), RGB(128,255,128)); 
                
            //this draws the images to the screen
                oslDrawImage(sprite);
                oslDrawImage(sprite2);
                oslDrawImage(sprite3);
                
            //stops the drawing mode
                oslEndDrawing();
                
            //sync the screen 
                oslSyncFrame();
            }
            
            //terminate the program
            oslEndGfx();
            oslQuit();
            return 0;
        }
        
            void Buttons()
            {
            //starts up the psp buttons
                oslReadKeys();
                
            if (osl_keys->held.down)
            {
                if(!collision(sprite, sprite->x, sprite->y + 2, sprite2, sprite2->x, sprite2->y, sprite3, sprite3->x, sprite3->y  ))
                {
                //sprite movement
                sprite->y +=2;
                
                //sets sprite position on sprite sheet
                    sprite_position = DOWN;
                
                //calls sprie animate
                    SpriteAnimate();
            }
            }
                    
                if (osl_keys->held.up)
            {
                if(!collision(sprite, sprite->x, sprite->y - 2, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y ))
                {
                    sprite->y-= 2;
                    sprite_position = UP;
                    SpriteAnimate();
                
            }
            }
            
           if (osl_keys->held.right)
        {
                if(!collision(sprite, sprite->x + 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y  ))
                {
            sprite->x += 2;
            sprite_position = RIGHT;
            SpriteAnimate();
        }
        }
                
                    if (osl_keys->held.left)
        {
            if(!collision(sprite, sprite->x - 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y  ))
            {
            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(sprite,0,sprite_position,22,35);
        }
    }
    
    
    void SpriteAnimate()
       {    
            //Moves the sprite in the row that it is in
            sprite_march++;
    
            //Moves the sprite constantly
            oslSetImageTileSize(sprite,(sprite_march * 22),sprite_position,22,35);
    
            //resets the sprite movement in that row
            if (sprite_march == 6) sprite_march = 0;
        
    }
                
            
            int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY, OSL_IMAGE *img3, float img3posX, float img3posY ) 
    {
       int collision;
       collision = 0;
       float img1width  = img1->stretchX;
       float img1height = img1->stretchY;
       float img2width  = img2->stretchX;
       float img2height = img2->stretchY;
       float img3width = img3->stretchX;
       float img3height = img3->stretchY;
      
       
       if ((img1posX + img1width > img2posX) &&
           (img1posX < img2posX + img2width) &&
           (img1posX + img1width > img3posX)&&
           (img1posX <img3posX + img3width)&&
           (img1posY + img1height > img3posY)&&
           (img1posY < img3posY + img3height)&&
           (img1posY + img1height > img2posY) &&
           (img1posY < img2posY + img2height) ) 
    {
    {
             collision = 1;               
       }     
       return collision;
    }
    }

    anyone? please help, i have been busy all week and i wont be able to sit down and look at the code again untill later tonight so i havent had time to figure this problem out =\.

  9. #8409
    Points: 5.711, Level: 48
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Aug 2007
    Beiträge
    39
    Points
    5.711
    Level
    48
    Downloads
    0
    Uploads
    0

    Standard Fading

    Im working on a little project and I was wondering how would one fade in and fade out an image using OSlib(2.10)?

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

    bnc - Check your documentation ;)

    Use:
    oslSetAlpha(OSL_FX_ALPHA, transparency value of anything drawn)


    Example: use this as an intro screen if you want - it'll fade the image you pass to it in and out depending on the speed you pass it, i prefer 0.8f as the speed ;)
    Code:
    void FadeInOut(OSL_IMAGE *image, float speed)
    {
      float i = 0.0f;
      int fadingIn = 1;
    
      while (!osl_quit)
      {
        // start drawing
        oslStartDrawing();
    
        // clear screen black
        oslClearScreen(RGB(0,0,0));
    
        // set the alpha of anything drawn now
        oslSetAlpha(OSL_FX_ALPHA, i);
    
        // draw our image
        oslDrawImage(image);
    
        // end drawing
        oslEndDrawing();
    
        // end frame (flip draw/display buffers) sync's audio too
    		oslEndFrame();
    		// sync frames
    		oslSyncFrame();
    		
        // if were fading out AKA transparency 255 -> 0
    		if (fadingIn)
    		{
          // add speed to transprency since the alpha is being set
          i += speed;
          
          // if i has reached 255 AKA the image is completely transparent now
          if (i > 255.0f)
          {
            // were not fading out anymore
            fadingIn = 0;
          }
        }
        else // if were fading in
        {
          // subtract from the transparency
          i -= speed;
          
          // if the transprency is 0 again AKA completely visible
          if (i < 0)
          {
            // break the loop and continue the program
            break;
          }
        }
      }
    }
    EDIT

    Gah sorry for the formatting - it got messed up when copy&pasting.since my tabs are 2 spaces, on here they're 4 :S

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


  11. #8411
    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

    k guys been a way a little while learning more about opengl and stuff anyways i'm here because i have a couple of questions that i can't make sense of

    anyways here's the question:

    i'm building something to load in .x txt files and i have no idea how to make sense of the frametransformationmatrix

    Code:
    FrameTransformMatrix {
    		0.500000, -0.853553, -0.146447, 0.000000,
    		0.707107, 0.500000, -0.500000, 0.000000,
    		0.500000, 0.146447, 0.853553, 0.000000,
    		0.000000, 0.000000, 0.000000, 1.000000;;
    	}
    now than i've determined, which wasn't hard:

    0.500000, -0.853553, -0.146447, 0.000000,
    0.707107, 0.500000, -0.500000, 0.000000,
    0.500000, 0.146447, 0.853553, 0.000000,

    is part of the rotation however this is where i get beyond confused:

    in my model making program, i set all 3 axis's to 45 degrees and it gives me back what i posted above, can any help me get it so i can understand how to translate those numbers back into their respective 45 degree's which they were set to before being exported

    also note:
    Code:
    	FrameTransformMatrix {
    		0.707107, -0.000000, -0.707107, 0.000000,
    		0.000000, 1.000000, -0.000000, 0.000000,
    		0.707107, -0.000000, 0.707107, 0.000000,
    		0.000000, 0.000000, 0.000000, 1.000000;;
    	}
    when rotated by 45 degrees on only the z axis these are the numbers i get back
    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

  12. #8412
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    Read up on matrices: http://en.wikipedia.org/wiki/Transformation_matrix

    Also give careful attention to what transformations effect which parts of the matrix.

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die

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

    yes iwn i've already read up on that however i can't seem to follow it trust me i'm not stopping here without having already done some research however it all seems to be over my head i mostly need to see an example of how it is used in a tad bit simpler principle

    woot i got it=-)

    after a few more hours of research i finally understand matrix rotations better all be it not the best but enough to get me by for now=-)....well at least if i can use it for animation=-).....i hope=-(

    arg god dam quaternions=-(
    Geändert von slicer4ever (04-13-2008 um 08:44 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

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

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

    Standard

    I'm having some issues with stubs, I've been talking to another developer but we are both at a loss as to the cause.

    My errors when I try compiling:
    moduleMgrForKernel.s: Assembler messages:
    moduleMgrForKernel.s:5: Error: unrecognized opcode `stub_start "ModuleMgrForKernel",0x40 090000,0x00030005'
    moduleMgrForKernel.s:6: Error: unrecognized opcode `stub_func 0x6723BBFF,sceKernelLoadM oduleForLoadExecVSHMs1'
    moduleMgrForKernel.s:7: Error: unrecognized opcode `stub_func 0x49C5B9E1,sceKernelLoadM oduleForLoadExecVSHMs2'
    moduleMgrForKernel.s:8: Error: unrecognized opcode `stub_func 0xF07E1A2F,sceKernelLoadM oduleForLoadExecVSHMs4'
    moduleMgrForKernel.s:9: Error: unrecognized opcode `stub_end '
    My stub is:
    Code:
    	.set noreorder
    
    #include "pspstub.s"
    
    	STUB_START "ModuleMgrForKernel",0x40090000,0x00030005
    	STUB_FUNC  0x6723BBFF,sceKernelLoadModuleForLoadExecVSHMs1
    	STUB_FUNC  0x49C5B9E1,sceKernelLoadModuleForLoadExecVSHMs2
    	STUB_FUNC  0xF07E1A2F,sceKernelLoadModuleForLoadExecVSHMs4
    	STUB_END
    All other stubs I use work fine, but they were created from export files, this was manually made. Any help would be greatly aprechiated.

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

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

  15. #8415
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    Try renaming "moduleMgrForKernel.s " to "moduleMgrForKernel.S"

    :)

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

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

    Standard

    Grr it worked, that was all the problem was... Does having a capital extention affect any other file types, for future reference?

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

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

  17. #8417
    QJ Gamer Blue
    Points: 4.688, Level: 43
    Level completed: 69%, Points required for next Level: 62
    Overall activity: 0%

    Registriert seit
    Jun 2007
    Ort
    Texas
    Beiträge
    455
    Points
    4.688
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    I'm trying to make just a small thing (just for learning purposes, and maybe a laugh or two from friends) I finally got it to compile but when it did it wouldn't display the image.
    I am new to C, and I'm also trying to do this in the 3.XX kernel.

    Main.c
    Code:
    #include <pspdisplay.h>
    #include <pspctrl.h>
    #include <pspkernel.h>
    #include <pspdebug.h>
    #include <pspgu.h>
    #include <png.h>
    #include <stdio.h>
    #include "graphics.h" 
    
    #define printf pspDebugScreenPrintf
    #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) 
    
    PSP_MODULE_INFO("Image Display Program", 0, 1, 0);
    PSP_HEAP_SIZE_KB(20480); 
    /* 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;
    } 
    
    int main(){
        char buffer[200];
        Image* bsod;
        pspDebugScreenInit();
        SetupCallbacks();
        initGraphics();
        sprintf(buffer, "bsod.png");
        bsod = loadImage(buffer);
        if (!bsod) {
            //Load Failed
            printf("Messed up the code, go fix it\n");
        } else {
        int x = 0;
        int y = 0;
        sceDisplayWaitVblankStart();
        while (x < 480) {
            while (y < 272) {
                blitAlphaImageToScreen(0 ,0 ,480 ,272, bsod, x, y);
                y += 32;
                x += 32;
                y = 0;
            }
                flipScreen();
            }
              sceKernelSleepThread();
              return 0;
    } 
    }
    Makefile
    Code:
    TARGET = hello
    OBJS = main.o graphics.o framebuffer.o
    
    CFLAGS = -O2 -G0 -Wall
    CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
    ASFLAGS = $(CFLAGS)
    
    LIBDIR =
    LIBS = -lpspgu -lpng -lz -lm
    LDFLAGS =
    
    EXTRA_TARGETS = EBOOT.PBP
    PSP_EBOOT_TITLE = Windows Vista
    
    
    BUILD_PRX = 1
    PSP_FW_VERSION = 390
    
    PSPSDK=$(shell psp-config --pspsdk-path)
    include $(PSPSDK)/lib/build.mak
    Thanks in advanced for your help

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

    Gah I really do hate yeldarb's tutorial on that lol - too much logic for them at that level ;)

    But anyways - you just want to forever display that image right?

    So what you want to do is load hte image, draw the image, flip draw/display buffers then sleep thread so make main() look something like:
    Code:
    int main()
    {
      // init the debug screen
      pspDebugScreenInit();
      // setup callbacks
      SetupCallbacks();
      // init the graphics
      initGraphics();
      
      // declare our image variable, assign to null initially
      Image* bsod = NULL;
    
      // load the imshr
      bsod = loadImage("bsod.png");
    
      // if it failed to load
      if (!bsod)
      {
          printf("Failed to load 'bsod.png'");
      }
      else
      {
        // blit image
        blitAlphaImageToScreen(0, 0, 480, 272, bsod, 0, 0);
    
        // wait for vsync
        sceDisplayWaitVblankStart();
        // flip the display/draw buffers
        flipScreen();
      }
    
      // make this thread sleep forever, still home->quit is available
      sceKernelSleepThread();
    
      return 0;
    }

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


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

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

    Standard

    Code:
    // if it failed to load
      if (bsod == NULL)
      {
          printf("Failed to load 'bsod.png'");
      }
    Wouldn't that be better (according to Yaustar)?
    Calypso - Enjoy the excellent 2D space shooter:
    http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195

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

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

    Define 'better'. !bsod means it isn't pointing to an address meaning it's null (watch me be corrected by some awkward exception :P). For readability probably too but hey preferences.

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


  21. #8421
    QJ Gamer Blue
    Points: 4.688, Level: 43
    Level completed: 69%, Points required for next Level: 62
    Overall activity: 0%

    Registriert seit
    Jun 2007
    Ort
    Texas
    Beiträge
    455
    Points
    4.688
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Gah I really do hate yeldarb's tutorial on that lol - too much logic for them at that level ;)

    But anyways - you just want to forever display that image right?

    So what you want to do is load hte image, draw the image, flip draw/display buffers then sleep thread so make main() look something like:
    Code:
    int main()
    {
      // init the debug screen
      pspDebugScreenInit();
      // setup callbacks
      SetupCallbacks();
      // init the graphics
      initGraphics();
      
      // declare our image variable, assign to null initially
      Image* bsod = NULL;
    
      // load the imshr
      bsod = loadImage("bsod.png");
    
      // if it failed to load
      if (!bsod)
      {
          printf("Failed to load 'bsod.png'");
      }
      else
      {
        // blit image
        blitAlphaImageToScreen(0, 0, 480, 272, bsod, 0, 0);
    
        // wait for vsync
        sceDisplayWaitVblankStart();
        // flip the display/draw buffers
        flipScreen();
      }
    
      // make this thread sleep forever, still home->quit is available
      sceKernelSleepThread();
    
      return 0;
    }
    Thank you very much, worked perfectly.

  22. #8422
    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 SG57
    Define 'better'. !bsod means it isn't pointing to an address meaning it's null (watch me be corrected by some awkward exception :P). For readability probably too but hey preferences.
    There is one obscure case in C where NULL isn't always 0. In C++ IIRC, the standard is NULL is ALWAYS 0. So in C if NULL is not zero:
    Code:
    int * pInt = NULL;
    if( !pInt )
    {
    	// This code will execute because pInt is non-zero
    }

  23. #8423
    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 for me I'm in the clear if you recall correctly ;)

    ...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. #8424
    Developer
    Points: 4.872, Level: 44
    Level completed: 61%, Points required for next Level: 78
    Overall activity: 0%

    Registriert seit
    Jun 2006
    Beiträge
    82
    Points
    4.872
    Level
    44
    Downloads
    0
    Uploads
    0

    Standard

    I'm an math idiot. If I have an object needs to travel from point A to point B. The path look something like this(along a spline). How to calculate and code?
    Thx.

  25. #8425
    OMFG
    Points: 19.453, Level: 88
    Level completed: 21%, Points required for next Level: 397
    Overall activity: 0%

    Registriert seit
    Jul 2005
    Ort
    Toronto
    Beiträge
    2.814
    Points
    19.453
    Level
    88
    Downloads
    0
    Uploads
    0

    Standard

    How come no matter what I do, I can't seem to get the psp slim tv-out working?

    I've included the stub "pspDveManager.S" and have created a 'dummy' function within my main.cpp "int pspDveMgrSetVideoOut(int, int, int, int, int, int, int);", just like the sample did.

    It compiles the code fine, but once it hits the finalization of the compiling I get, 'Undefined Reference to pspDveMgrSetVideoOut(int, int, int, int, int, int, int)' @ line 330 which is the line where I declared that function.

    What else do I do? I don't understand how the sample works but my code doesn't?


    (The sample is at http://dl.qj.net/Fullscreen-TV-out-f...4864/catid/151)

  26. #8426
    QJ Gamer Blue
    Points: 4.688, Level: 43
    Level completed: 69%, Points required for next Level: 62
    Overall activity: 0%

    Registriert seit
    Jun 2007
    Ort
    Texas
    Beiträge
    455
    Points
    4.688
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    So After getting the Image to work and buttons and a few other things I decided to try out the Message dialogs (like the official ones). I finally got it to compile but whenever i go to run it it just flashes the text and then the screen stays blank.

    Here's my code (sorry if it's horribly formatted)
    Spoiler for Code:

    Code:
    int main(int argc, char *argv[])
    {
            pspDebugScreenInit();    
            SetupCallbacks();
            SetupGu();
            SceCtrlData pad;
            
        printf("Press any button \n");
        printf("Created by Colin \n");
        printf("on April 18, 2008 \n");
        
        sceCtrlReadBufferPositive(&pad, 1);
        
        if (pad.Buttons != 0){
            if (pad.Buttons & PSP_CTRL_LEFT){
                ShowMessageDialog("You pressed the left button.", 1);
            }
            if (pad.Buttons & PSP_CTRL_RIGHT){
                ShowMessageDialog("You pressed the right button.", 1);
            }
            if (pad.Buttons & PSP_CTRL_UP){
                ShowMessageDialog("You pressed the up button.", 1);
            }
            if (pad.Buttons & PSP_CTRL_DOWN){
                ShowMessageDialog("You pressed the down button.", 1);
            }
            if (pad.Buttons & PSP_CTRL_CROSS){
                ShowMessageDialog("You pressed Cross", 1);
            }
            if (pad.Buttons & PSP_CTRL_CIRCLE){
                ShowMessageDialog("You pressed Circle", 1);
            }
            if (pad.Buttons & PSP_CTRL_SQUARE){
                ShowMessageDialog("You pressed Square", 1);
            }
            if (pad.Buttons & PSP_CTRL_TRIANGLE){
                ShowMessageDialog("You pressed Triangle", 1);
            }
            if (pad.Buttons & PSP_CTRL_RTRIGGER){
                ShowMessageDialog("You pressed the R Trigger", 1);
            }
            if (pad.Buttons & PSP_CTRL_LTRIGGER){
                ShowMessageDialog("You pressed the L Trigger", 1);
            }
        }
        sceKernelSleepThread();
        return 0;
    }

    I'm positive i have all of the libraries and callbacks.
    Also if it matter's I'm trying to do this on my slim so 3.xx kernel.
    The problem is probably some stupid mistake, or just something real small that i missed but I've been looking all day and i couldn't find anything.

    Thank you to anyone who can i help.

  27. #8427
    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

    Put it in a loop, else it'll only check all of that once - the sleep thread call in there is what's stopping it from exiting right now, so leave the return and i guess the sleep thread call outside the loop (although it's not really necessary :S)

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


  28. #8428
    QJ Gamer Blue
    Points: 4.688, Level: 43
    Level completed: 69%, Points required for next Level: 62
    Overall activity: 0%

    Registriert seit
    Jun 2007
    Ort
    Texas
    Beiträge
    455
    Points
    4.688
    Level
    43
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Put it in a loop, else it'll only check all of that once - the sleep thread call in there is what's stopping it from exiting right now, so leave the return and i guess the sleep thread call outside the loop
    ok thank you very much.

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

    k hey everone back with another question about .x files

    now than i've moved from my transformation problems and have been able to load a model, animate it(note this method is without bones), texture, give it normals, basically i have the model good and loaded

    now than here's the problem: skinweights

    i understand the following:

    Code:
    SkinWeights {
           //name of bone and bone's animation in relation
    	"Bone-3";
           //number of vertices affected by this bone
    	112;
           //the vertex's that are affected
    	69,
    	16,
    	72,
            etc
            //how much the vertex is affected by the bone
    	0.466086,
    	0.466086,
    	0.435675,
            etc
    that's all fine and dandy no problem understanding that after some research into it(yea power to google!!) now than i also understand that this requires manipulating the vertex themselfs....this is where the problem lies:

    Code:
    Animation Animation3 {
            //object's name which is located(this occurence it's a bone)
    	{Bone-3}
    	AnimationKey {
                    //2 = movement
    		2;
                    //7 keyframes
    		7;
                    //movement...no problem here i can move an vertex all day long
    		0; 3; -0.000000, 0.999994, 0.002683;;,
    		5; 3; -0.000000, 0.827936, -0.409556;;,
    		10; 3; 0.000000, 0.412317, -0.573280;;,
    		15; 3; -0.000000, 0.833326, -0.404204;;,
    		20; 3; -0.000000, 0.999721, 0.017872;;,
    		25; 3; -0.000000, 0.840180, 0.397187;;,
    		30; 3; -0.000000, 0.467647, 0.571981;;;
    	}
    	AnimationKey {
                    //0 = rotation
    		0;
                    //7 keyframes
    		7;
                    //rotation...here's the problem(more explanation below)..note that the animations are quaterions(misspelled i know)
    		0; 4; 0.999997, -0.002339, -0.000000, 0.000000;;,
    		5; 4; 0.921942, 0.387329, 0.000000, 0.000000;;,
    		10; 4; 0.698280, 0.715824, 0.000000, 0.000000;;,
    		15; 4; 0.924487, 0.381214, 0.000000, -0.000000;;,
    		20; 4; 0.999879, -0.015585, -0.000000, 0.000000;;,
    		25; 4; 0.927713, -0.373294, -0.000000, 0.000000;;,
    		30; 4; 0.732010, -0.681294, -0.000000, 0.000000;;;
    	}
    	AnimationOptions {
    		0;
    		0;
    	}
    }
    so as u can see rotating a vertex is my problem...i understand rotating an whole object, which i use glRotatef(angle, amountx, amounty, amountz), however writing the function myself is the problem am i to translate to the center of the object than calculate the rotation than reposition the vertex?!?!

    anyhelp or pointers on how to to achieve this would be AWSOME!!

    and thx's every1=-)
    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. #8430
    Developer
    Points: 7.577, Level: 58
    Level completed: 14%, Points required for next Level: 173
    Overall activity: 0%

    Registriert seit
    Mar 2006
    Beiträge
    1.026
    Points
    7.577
    Level
    58
    Downloads
    0
    Uploads
    0

    Standard

    You don't need to do it in software.

    Look at the morphskin sample that comes with the SDK.

    Particularly the sceGuMorphWeight() function and others.

    Check out my homebrew & C tutorials at http://insomniac.0x89.org/
    Coder formerly known as Insomniac197

    tshirtz: what is irshell ??
    Atarian_: it's where people who work for the IRS go when they die


 

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

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