Seite 37 von 340 ErsteErste ... 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 87 137 ... LetzteLetzte
Zeige Ergebnis 1.081 bis 1.110 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 Cheater Is there an easy way to get the icon/background of a homebrew game (What you see on ...

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

    Zitat Zitat von Cheater
    Is there an easy way to get the icon/background of a homebrew game (What you see on the xmb)? Is there a function in C that can accomplish this?

    P.S. I just realized that it is possible (irshell does it), but now I need to find out how to do it in c.
    See Slasher's thread here: http://forums.ps2dev.org/viewtopic.php?t=6124



    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

  2. #1082
    QJ Gamer Gold
    Points: 18.840, Level: 86
    Level completed: 98%, Points required for next Level: 10
    Overall activity: 99,0%

    Registriert seit
    Mar 2006
    Ort
    Germany
    Beiträge
    1.470
    Points
    18.840
    Level
    86
    Downloads
    0
    Uploads
    0

    Standard

    My CYGWIN says ERROR: Make sure you have GNU 'make' installed. Any ideas?

  3. #1083
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Talking Clearing the screen.

    How do i clear the screen to be red?

  4. #1084
    Developer
    Points: 5.359, Level: 47
    Level completed: 5%, Points required for next Level: 191
    Overall activity: 0%

    Registriert seit
    Feb 2006
    Ort
    Norway
    Beiträge
    384
    Points
    5.359
    Level
    47
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von psphacker12.
    How do i clear the screen to be red?
    with graphics.c?

    clearScreen(color);


  5. #1085
    AKA Homer
    Points: 12.596, Level: 73
    Level completed: 37%, Points required for next Level: 254
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    Sweden
    Beiträge
    1.779
    Points
    12.596
    Level
    73
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von waterbottle
    with graphics.c?

    clearScreen(color);
    No, fillScreenRect(RGB(255, 0, 0), 0, 0, 480, 272);
    The fillScreen doesn't actually clear it with the color you specified. Just have a look at the function, you'll see that the color parameter isn't used.


    Click Here if you want a Winamp Currently Playing Userbar like the one above.

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

    Zitat Zitat von homer
    No, fillScreenRect(RGB(255, 0, 0), 0, 0, 480, 272);
    The fillScreen doesn't actually clear it with the color you specified. Just have a look at the function, you'll see that the color parameter isn't used.
    That is the slowest possible way of doing it and I would avoid it at all costs.
    Yes the clearScreen() function in the graphics.c is missing a line.

    Code:
    sceGuClearColor(GU_RGBA(255, 0, 0, 255));
     sceGuClearDepth(0);
     sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
    If you're not using graphics.c, or change the clearScreen() function to this if you are:

    Code:
    void clearScreen(Color color)
    {
    	if (!initialized) return;
    	guStart();
    	sceGuClearDepth(0);
    	sceGuClearColor(color);
    	sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
    	sceGuFinish();
    	sceGuSync(0, 0);
    }

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

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

  7. #1087
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard defining INADDR_NONE

    Hi,
    I'm trying to get a little client/server-application running (whereas the PSP is the client). Therefor I'm using a codeexample I got from a german tutorial. Unfortunately the compiler tells me

    main.c: In function 'main':
    main.c:72: error: 'INADDR_NONE' undeclared (first use in this function)
    main.c:72: error: (Each undeclared identifier is reported only once
    main.c:72: error: for each function it appears in.)
    main.c:116:2: warning: no newline at end of file
    make: *** [main.o] Error 1
    Line 72 is "if ((addr = inet_addr( argv[1])) != INADDR_NONE) {" and the whole code (just ignore the german comments, I can remove them if they are annoying):

    Spoiler for client code:
    Code:
    /* client.c */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <errno.h>
    
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    #include <arpa/inet.h>
    #include <unistd.h>
    
    
    #define PORT 1234
    #define RCVBUFSIZE 8192
    
    /* Funktion gibt aufgetrenene Fehler aus und
     * beendet die Anwendung */
    static void error_exit(char *errorMessage) {
        fprintf(stderr, "%s: %s\n", errorMessage, strerror(errno));
        exit(EXIT_FAILURE);
    }
    
    int main( int argc, char **argv) {
        struct sockaddr_in server;
        struct hostent *host_info;
        unsigned long addr;
    
        int sock;
    
        char *echo_string;
        int echo_len;
    
    
     /* Sind die erforderlichen Kommandozeilenargumente vorhanden? */
        if (argc < 3)
            error_exit("usage: client server-ip echo_word\n");
    
        /* Erzeuge das Socket */
        sock = socket( AF_INET, SOCK_STREAM, 0 );
        if (sock < 0)
            error_exit( "Fehler beim Anlegen eines Sockets");
    
        /* Erzeuge die Socketadresse des Servers
         * Sie besteht aus Typ, IP-Adresse und Portnummer */
        memset( &server, 0, sizeof (server));
        if ((addr = inet_addr( argv[1])) != INADDR_NONE) {
            /* argv[1] ist eine numerische IP-Adresse */
            memcpy( (char *)&server.sin_addr, &addr, sizeof(addr));
        }
        else {
            /* Für den Fall der Fälle: Wandle den
             * Servernamen bspw. "localhost" in eine IP-Adresse um */
            host_info = gethostbyname(argv[1]);
            if (NULL == host_info)
                error_exit("Unbekannter Server");
            /* Server-IP-Adresse */
            memcpy( (char *)&server.sin_addr,
                    host_info->h_addr, host_info->h_length );
        }
        /* IPv4-Verbindung */
        server.sin_family = AF_INET;
        /* Portnummer */
        server.sin_port = htons( PORT );
    
        /* Baue die Verbindung zum Server auf */
        if(connect(sock,(struct sockaddr*)&server,sizeof(server)) <0)
            error_exit("Kann keine Verbindung zum "
                       "Server herstellen");
    
        /* Zweites Argument wird als "echo" beim Server verwendet */
        echo_string = argv[2];
        /* Länge der Eingabe */
        echo_len = strlen(echo_string);
    
        /* Denn String inskl. Nullterminator an den Server senden */
        if (send(sock, echo_string, echo_len, 0) != echo_len)
            error_exit("send() hat eine unterschiedliche Anzahl"
                       " von Bytes versendet, als erwartet !!!!");
    
        /* Schließe Verbindung und Socket */
       close(sock);
    
        return EXIT_SUCCESS;
    }

    I just don't know with what to replace INADDR_NONE...

    PS: Coloured version of the code here under "Der Client" ("The Client")

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

    Code:
    #define INADDR_NONE ((unsigned long) -1)

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

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

  9. #1089
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Lukeson
    Hi,
    I'm trying to get a little client/server-application running (whereas the PSP is the client). Therefor I'm using a codeexample I got from a german tutorial. Unfortunately the compiler tells me



    Line 72 is "if ((addr = inet_addr( argv[1])) != INADDR_NONE) {" and the whole code (just ignore the german comments, I can remove them if they are annoying):

    Spoiler for client code:
    Code:
    /* client.c */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <errno.h>
    
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>
    #include <arpa/inet.h>
    #include <unistd.h>
    
    
    #define PORT 1234
    #define RCVBUFSIZE 8192
    
    /* Funktion gibt aufgetrenene Fehler aus und
     * beendet die Anwendung */
    static void error_exit(char *errorMessage) {
        fprintf(stderr, "%s: %s\n", errorMessage, strerror(errno));
        exit(EXIT_FAILURE);
    }
    
    int main( int argc, char **argv) {
        struct sockaddr_in server;
        struct hostent *host_info;
        unsigned long addr;
    
        int sock;
    
        char *echo_string;
        int echo_len;
    
    
     /* Sind die erforderlichen Kommandozeilenargumente vorhanden? */
        if (argc < 3)
            error_exit("usage: client server-ip echo_word\n");
    
        /* Erzeuge das Socket */
        sock = socket( AF_INET, SOCK_STREAM, 0 );
        if (sock < 0)
            error_exit( "Fehler beim Anlegen eines Sockets");
    
        /* Erzeuge die Socketadresse des Servers
         * Sie besteht aus Typ, IP-Adresse und Portnummer */
        memset( &server, 0, sizeof (server));
        if ((addr = inet_addr( argv[1])) != INADDR_NONE) {
            /* argv[1] ist eine numerische IP-Adresse */
            memcpy( (char *)&server.sin_addr, &addr, sizeof(addr));
        }
        else {
            /* Für den Fall der Fälle: Wandle den
             * Servernamen bspw. "localhost" in eine IP-Adresse um */
            host_info = gethostbyname(argv[1]);
            if (NULL == host_info)
                error_exit("Unbekannter Server");
            /* Server-IP-Adresse */
            memcpy( (char *)&server.sin_addr,
                    host_info->h_addr, host_info->h_length );
        }
        /* IPv4-Verbindung */
        server.sin_family = AF_INET;
        /* Portnummer */
        server.sin_port = htons( PORT );
    
        /* Baue die Verbindung zum Server auf */
        if(connect(sock,(struct sockaddr*)&server,sizeof(server)) <0)
            error_exit("Kann keine Verbindung zum "
                       "Server herstellen");
    
        /* Zweites Argument wird als "echo" beim Server verwendet */
        echo_string = argv[2];
        /* Länge der Eingabe */
        echo_len = strlen(echo_string);
    
        /* Denn String inskl. Nullterminator an den Server senden */
        if (send(sock, echo_string, echo_len, 0) != echo_len)
            error_exit("send() hat eine unterschiedliche Anzahl"
                       " von Bytes versendet, als erwartet !!!!");
    
        /* Schließe Verbindung und Socket */
       close(sock);
    
        return EXIT_SUCCESS;
    }

    I just don't know with what to replace INADDR_NONE...

    PS: Coloured version of the code here under "Der Client" ("The Client")
    You need a blank line at the end of your code.

  10. #1090
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    #define INADDR_NONE ((unsigned long) -1)
    It works, I'll just trust you that this is the right value... however, thank you!
    You need a blank line at the end of your code.
    Really? Why?

  11. #1091
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Lukeson
    It works, I'll just trust you that this is the right value... however, thank you!

    Really? Why?
    It wont even compile without it..

  12. #1092
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Why the hell would you need a blank line... >.>

    Anyways, I have a problem getting my simple 3D "app" to display. I'm using PSPGL. Here's the code (I'm not going to include the psp-setup.c file)
    Code:
    #include <stdlib.h> // needed in order to have "exit" function @@@
    
    #include <GL/glut.h>    // Header File For The GLUT Library 
    #include <GL/gl.h>	// Header File For The OpenGL32 Library
    #include <GL/glu.h>	// Header File For The GLu32 Library
    #include <math.h>
    #include <stdio.h>	
    
    #define MAX_PARTICLES 100
    
    struct PARTICLES {
    	float life;
    	float fade;
    	float x;
    	float y;
    	float z;
    	float xi;
    	float yi;
    	float zi;
    };
    
    PARTICLES particle[MAX_PARTICLES];
    
    int loop;
    float V;
    float Angle;
    
    /* The number of our GLUT window */
    int window; 
    
    /* A general OpenGL initialization function.  Sets all of the initial parameters. */
    void InitGL(int Width, int Height)	        // We call this right after our OpenGL window is created.
    {
      //glClearColor(0.0f, 0.0f, 0.0f, 0.0f);		// This Will Clear The Background Color To Black
      	glLoadIdentity();									// Reset The Projection Matrix
        glEnable(GL_TEXTURE_2D);
        glEnable(GL_BLEND);
        glShadeModel(GL_SMOOTH);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE);
      
      for( loop = 0; loop < MAX_PARTICLES; loop++) {
    	  particle[loop].life = 1.0;
    	  particle[loop].fade = (rand()%100)/1000.0 + 0.05;
    	  V = rand()%25;
    	  Angle = rand()%360;
    	  
    	  particle[loop].x = 0;
    	  particle[loop].y = 0;
    	  particle[loop].z = 0;
    	  
    	  particle[loop].xi = sin(Angle)*V;
    	  particle[loop].yi = cos(Angle)*V;
    	  particle[loop].zi = (((rand()%10)-5)/10)*V;
      }
    }
    
    /* The function called when our window is resized (which shouldn't happen, because we're fullscreen) */
    void ReSizeGLScene(int Width, int Height)
    {
      if (Height==0)				// Prevent A Divide By Zero If The Window Is Too Small
        Height=1;
    
      glViewport(0, 0, Width, Height);		// Reset The Current Viewport And Perspective Transformation
    
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
    
      gluPerspective(45.0f,(float)Width/(float)Height,0.1f,100.0f);
      glMatrixMode(GL_MODELVIEW);
    }
    
    /* The main drawing function. */
    void DrawGLScene()
    {
    	//MUST ADD BLENDING
    	
    	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		// Clear The Screen And The Depth Buffer
    	glLoadIdentity();				// Reset The View
    	
    	glTranslatef(0,0,-15);
    
    	
    	for(loop = 0; loop < MAX_PARTICLES; loop++) {
    		
    		float x;
    		float y;
    		float z;
    		
    		x = particle[loop].x;
    		y = particle[loop].y;
    		z = particle[loop].z;
    		
    		glColor4f(.5f,.5f,1.f,particle[loop].life);
    		
    		glBegin(GL_TRIANGLE_STRIP);
    		glTexCoord2f(1,1);  glVertex3f( x + 0.2f, y + 0.2f, z );
    		glTexCoord2f(0,1);  glVertex3f( x - 0.2f, y + 0.2f, z );
    		glTexCoord2f(1,0);	glVertex3f( x - 0.2f, y - 0.2f, z );
    		glTexCoord2f(0,0);  glVertex3f(x-0.2f,y-0.2f,z);
    		glEnd();
    		
    		particle[loop].x += (particle[loop].xi/250);
    		particle[loop].y += (particle[loop].yi/250);
    		particle[loop].z += (particle[loop].zi/250);
    		
    		// Slow down the particles
    		particle[loop].xi*=.975;  
    		particle[loop].yi*=.975;
    		particle[loop].zi*=.975;
    		
    		particle[loop].life-=particle[loop].fade;	 // Reduce Particles Life By 'Fade'
    		
    		if (particle[loop].life<0.05f)	 // If Particle Is Burned Out
    		{
    			particle[loop].life=1.0f;	 // Give It New Life
    			particle[loop].fade=float(rand()%100)/7500 + 0.0075f;	// Random Fade Value
    			particle[loop].x= 0;	 // Center On X Axis
    			particle[loop].y= 0;	 // Center On Y Axis
    			particle[loop].z= 0;	 // Center On Z Axis
    			V = (float((rand()%9))+1);
    			Angle = float(rand()%360);
    			
    			particle[loop].xi = sin(Angle) * V;
    			particle[loop].yi = cos(Angle) * V;
    			particle[loop].zi = ((rand()%10)-5)/5;
    		} 
    	}
    	
    }
    
    /* The function called whenever a key is pressed. */
    void keyPressed(unsigned char key, int x, int y) 
    {
    	switch (key) {
    	case 'd':			/* delta, triangle */
    		break;
    	case 'o':			/* round */
    		break;
    	case 'q':			/* square*/
    		break;
    	case 'x':			/* cross */
    		break;
    	case 'n':			/* key with the music note */
    		break;
    	case 's':			/* select */
    		break;
    	case 'a':			/* startbutton */  /* If START is pressed, kill everything. */
     		/* exit the program...normal termination. */
    		exit(0);                   
    	default:
    		;
    	}
     }
    
    /* The function called whenever a key is released. */
    void keyReleased(unsigned char key, int x, int y) 
    {
    	switch (key) {
    	case 'd':			/* delta, triangle */
    		break;
    	case 'o':			/* round */
    		break;
    	case 'q':			/* square*/
    		break;
    	case 'x':			/* cross */
    		break;
    	case 'n':			/* key with the music note */
    		break;
    	case 's':			/* select */
    		break;
    	case 'a':			/* startbutton */
    		break;
    	default:
    		;
    	}
     }
    
    /* The function called whenever a special key is pressed. */
    void specialKeyPressed(int key, int x, int y) 
    {
        switch (key) {    
        case GLUT_KEY_UP: // pad arrow up
    	break;
    
        case GLUT_KEY_DOWN: //  pad arrow down
    	break;
    
        case GLUT_KEY_LEFT: //  pad arrow left
    	break;
        
        case GLUT_KEY_RIGHT: //  pad arrow right
    	break;
    
        case GLUT_KEY_HOME: // home
    	break;
    	
        default:
    	break;
        }	
    }
    
    /* The function called whenever a special key is released. */
    void specialKeyReleased(int key, int x, int y) 
    {
        switch (key) {    
        case GLUT_KEY_UP: // pad arrow up
    	break;
    
        case GLUT_KEY_DOWN: //  pad arrow down
    	break;
    
        case GLUT_KEY_LEFT: //  pad arrow left
    	break;
        
        case GLUT_KEY_RIGHT: //  pad arrow right
    	break;
    
        case GLUT_KEY_HOME: // home
    	break;
    	
        default:
    	break;
        }	
    }
    
    /* The function called whenever the joystick is moved. */
    void joystickMoved (unsigned int buttonMask, int x, int y, int z)
    {
    	if (abs(x) > 150) // dead zone
    	{	
    		// use x value
    	}
    
    	if (abs(y) > 150) // dead zone
    	{	
    		// use y value
    	}
    }
    
    /* The function called whenever the triggers are pressed. */
    void triggerHandle (int button, int state, int x, int y)
    {
    	if (button == GLUT_LEFT_BUTTON) {  // left trigger...
    		if (state == GLUT_DOWN) {  // ...is pressed
    		}
    		if (state == GLUT_UP) {  // ...is released
    		}
    	}
    
    	if (button == GLUT_RIGHT_BUTTON) {  // right trigger...
    		if (state == GLUT_DOWN) {  // ...is pressed
    		}
    		if (state == GLUT_DOWN) {  // ...is released
    		}
    	}
    }
    
    /* main function */
    int main(int argc, char **argv) 
    {  
      /* Initialize GLUT state - glut will take any command line arguments that pertain to it or 
         X Windows - look at its documentation at http://reality.sgi.com/mjk/spec3/spec3.html */  
      glutInit(&argc, argv);  
    
      /* Select type of Display mode:   
         Double buffer 
         RGBA color
         Alpha components supported 
         Depth buffer */  
      glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH);  
    
      /* get a 640 x 480 window */
      glutInitWindowSize(480, 272); 
    
      /* the window starts at the upper left corner of the screen */
      glutInitWindowPosition(0, 0);  
    
      /* Open a window */  
      window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99");  
    
      /* Register the function to do all our OpenGL drawing. */
      glutDisplayFunc(&DrawGLScene);  
    
      /* Even if there are no events, redraw our gl scene. */
      glutIdleFunc(&DrawGLScene);
    
      /* Register the function called when our window is resized. */
      glutReshapeFunc(&ReSizeGLScene);
    
      /* Register the function called when the keyboard is pressed. */
      glutKeyboardFunc(&keyPressed);
      /* Register the function called when the keyboard is released. */
      glutKeyboardUpFunc(&keyReleased);
      /* Register the function called when special keys (arrows, page down, etc) are pressed. */
      glutSpecialFunc(&specialKeyPressed);
      /* Register the function called when special keys (arrows, page down, etc) are released. */
      glutSpecialUpFunc(&specialKeyReleased);
      /* Register the function called when joystick is moved. */
      glutJoystickFunc(&joystickMoved, 0); // 0 = Joystick polling interval in milliseconds
      /* Register the function called when Trigger_left or Trigger_right is pressed */
      glutMouseFunc(&triggerHandle);
      
      /* Initialize our window. */
      InitGL(480, 272); 
      
      /* Start Event Processing Engine */  
      glutMainLoop();  
    
      return (0);
    }

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

    Bronx - add glutSwapBuffers(); at the end of your drawing. Oh and nice to see you are using PSPGL ;)

    And yeah, you SHOULD have an extra line at hte bottom of your source, complier complains about it :\

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


  14. #1094
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    this wont compile
    Code:
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include "graphics.h"
    #define printf pspDebugScreenPrintf
    #define dprint pspDebugScreenPrintf
    PSP_MODULE_INFO("???", 0, 1, 1);
    
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    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(void) {
              pspDebugScreenInit();
              SetupCallbacks();
              SceCtrlData pad;
              initGraphics();
              sceGuInit();
              sceCtrlSetSamplingCycle(0);
              sceCtrlPeekBufferPositive(&pad, 1);
    while (1)  {
              char buffer[200]
              bool rn0 = 0;
                int rand() {
                if (pad.Buttons != 0){
                  if(pad.Buttons & PSP_CTRL_CROSS) {
                    rn0=rand()%10000;
                  }
                }
              if (rn0 != 0) {
                pspDebugScreenPrintf("Press 'X' to start.");
              }
              pspDebugScreenSetXY(0, 2);
              pspDebugScreenClear();
              fillScreenRect(RGB(255, 0, 0), 0, 0, 480, 272);
              pspDebugScreenSetTextColor(0x00000000);
              pspDebugScreenPrintf("Generated Integer:%d",rn0);
              sceDisplayWaitVblankStart();
              sceKernelSleepThread();
              }
    return 1;
    }
    Spoiler for Errors:
    [email protected] ~
    $ cd /pspdev

    [email protected] /pspdev
    $ make
    psp-gcc -I. -I/usr/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c
    main.c : In function 'main':
    main.c(48) : error: syntax error before 'bool'
    main.c : In function 'rand':
    main.c(52) : error: 'rn0' undeclared (first use in this function)
    main.c(52) : error: (Each undeclared identifier is reported only once
    main.c(52) : error: for each function it appears in.)
    main.c : In function 'main':
    main.c(67) : error: syntax error at end of input
    make: *** [main.o] Error 1

    [email protected] /pspdev
    $

  15. #1095
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Thanks SG57 :) it worked! But it's tremedously small, do you have any idea how to enlarge it?

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

    Bronx - Dont translate so far in the distance, change the -15 to -1, should work fine

    psp - For one, you are using both debug console + gu and without properly setting the debug console framebuffer address to the gu's, itll flicker. To solve this, use the pre-made printTextScreen functions for printing, as well as remove the sceKernelSleepThread call since that make sthe current thread fall asleep stopping EVERYthing besides the homebutton from working (software wise). Oh and you need to flipScreen() at hte end of hte while(1) loop.

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


  17. #1097
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    O.o, duh... I feel stupid, lol

  18. #1098
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von SG57
    Bronx - Dont translate so far in the distance, change the -15 to -1, should work fine

    psp - For one, you are using both debug console + gu and without properly setting the debug console framebuffer address to the gu's, itll flicker. To solve this, use the pre-made printTextScreen functions for printing, as well as remove the sceKernelSleepThread call since that make sthe current thread fall asleep stopping EVERYthing besides the homebutton from working (software wise). Oh and you need to flipScreen() at hte end of hte while(1) loop.
    Um can you give me an example of the printTextScreen(); function?

  19. #1099
    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 need a semi-colon at the end of this line:

    Code:
    char buffer[200]
    Should be:

    Code:
    char buffer[200];

    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

  20. #1100
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Cool

    Zitat Zitat von Insomniac197
    You need a semi-colon at the end of this line:

    Code:
    char buffer[200]
    Should be:

    Code:
    char buffer[200];
    but when i compile it keeps telling me `rn0 (undeclared)'

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

    Learn C.

    There are no booleans in C.

    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

  22. #1102
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    Can glTranslate() and glColor4f() take variables as arguements? I tried it so if blah was pressed a variable that held the number for red decreased or increased and I placed that variable in glColor4f's first arguement, but it didn't work... I also tried the same idea for the glTranslate and it als didn't work... :/

  23. #1103
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Standard

    Zitat Zitat von Insomniac197
    Learn C.

    There are no booleans in C.
    i changed it from
    Code:
    bool rn0 = 0;
    to
    Code:
    int rn0 = 0;
    and it still doesnt work so idk =\

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

    What? Basic C knowledge would lead to you knowing you can pass a variable as an argument. You probaby dont know the values for colors...

    0.0f = no intensity
    1.0f = full intensity

    that variable must be a float and can't go above 1.0 and vice versa with 0. I still dont quite get what you mean though, sorry


    psp - Best way to 'replicate' a boolean in C is to:

    Code:
    #define true 1
    #define false !true
    #define bool int
    You also could make an enumerator, but i find it best to do it all during hte pre-processing stage (or w/e its called, sorry ).

    Or just rename main.c to main.cpp, and add -lstdc++ to the libs section in the makefile, and you can use the bool enumerator/data type.

    ...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. #1105
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    No, I know rgba, and I did have it as a float. so I had this basically:
    Code:
    float red = 0.0;
    float green = 0.0;
    float blue = 0.0;
    
    glColor4f(red, green, blue, particle[loop].life);
    Then I altered the switch statement for the controls to say if blah was pressed those vars would increase or decrease. And it didn't work. And I did the same concept with the translate func but declared the vars as int, and that didn't work either.

  26. #1106
    QJ Gamer Blue
    Points: 4.511, Level: 42
    Level completed: 81%, Points required for next Level: 39
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Germany
    Beiträge
    216
    Points
    4.511
    Level
    42
    Downloads
    0
    Uploads
    0

    Standard

    Hi
    I'm now trying to create a simple server (using windows), but if I use "Microsoft Visual C++ 2005 express" with the "Microsoft Platform SDK" (i installed the SDK just like it's written here), he always tells me

    fatal error C1083: File (Include) cannot be opened: "winsock.h": No such file or directory
    when I try to compile. Using Dev-C++ he gives me a list of errors like

    [Linker error] undefined reference to `[email protected]'
    [Linker error] undefined reference to `[email protected]'
    [Linker error] undefined reference to `[email protected]'
    [Linker error] undefined reference to `[email protected]'
    [Linker error] undefined reference to `[email protected]'
    and so on
    Can anyone help me?

    edit:
    Oh, the code (if you, for some reason, wanna see it):
    Spoiler for code:
    Code:
    /* server.c */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <time.h>
    
    /* Headerfiles für Windows */
    #include <winsock.h>
    #include <io.h>
    
    
    /* Portnummer */
    #define PORT 1234
    /* Puffer für eingehende Nachrichten */
    #define RCVBUFSIZE 1024
    
       static void echo(SOCKET);
    
    static void error_exit(char *errorMessage);
    
    /* Funktion gibt Daten vom Client auf dem stdout aus,
     * welche dieser mit der Kommandozeile übergibt  */
    static void echo(SOCKET client_socket)
    {
        char echo_buffer[RCVBUFSIZE];
        int recv_size;
        time_t zeit;
    
        if((recv_size =
                recv(client_socket, echo_buffer, RCVBUFSIZE,0)) < 0)
            error_exit("Fehler bei recv()");
        echo_buffer[recv_size] = '\0';
        time(&zeit);
        printf("Nachrichten vom Client : %s \t%s",
                echo_buffer, ctime(&zeit));
    }
    
    /* Funktion gibt aufgetrenene Fehler aus und
     * beendet die Anwendung */
    static void error_exit(char *error_message) {
    
        fprintf(stderr,"%s: %d\n", error_message, WSAGetLastError());
    
        exit(EXIT_FAILURE);
    }
    
    int main( int argc, char **argv) {
        struct sockaddr_in server, client;
    
        SOCKET sock, fd;
    
        int len;
    
    
        /* Initialisiere TCP für Windows ("winsock") */
        WORD wVersionRequested;
        WSADATA wsaData;
        wVersionRequested = MAKEWORD (1, 1);
        if (WSAStartup (wVersionRequested, &wsaData) != 0)
            error_exit( "Fehler beim Initialisieren von Winsock");
        else
            printf("Winsock initialisiert\n");
    
    
        /* Erzeuge das Socket */
        sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (sock < 0)
            error_exit("Fehler beim Anlegen eines Socket");
    
        /* Erzeuge die Socketadresse des Servers */
        memset( &server, 0, sizeof (server));
        /* IPv4-Verbindung */
        server.sin_family = AF_INET;
        /* INADDR_ANY Jede IP-Adresse annehmen */
        server.sin_addr.s_addr = htonl(INADDR_ANY);
        /* Portnummer */
        server.sin_port = htons(PORT);
    
        /* Erzeuge die Bindung an die Serveradresse
         * (genauer an einen bestimmten Port) */
        if(bind(sock,(struct sockaddr*)&server, sizeof( server)) < 0)
            error_exit("Kann das Socket nicht \"binden\"");
    
        /* Teile dem Socket mit, dass Verbindungswünsche
         * von Clients entgegengenommen werden */
        if(listen(sock, 5) == -1 )
             error_exit("Fehler bei listen");
    
        printf("Server bereit - wartet auf Anfragen ...\n");
        /* Bearbeite die Verbindungswünsche von Clients
         * in einer Endlosschleife
         * Der Aufruf von accept() blockiert solange,
         * bis ein Client Verbindung aufnimmt */
        for (;;) {
            len = sizeof(client);
            fd = accept(sock, (struct sockaddr*)&client, &len);
            if (fd < 0)
                error_exit("Fehler bei accept");
            printf("Bearbeite Client mit der Adresse: %s\n",
               inet_ntoa(client.sin_addr));
            /* Daten vom Client auf dem Bildschirm ausgeben */
            echo( fd );
    
            /* Schließe die Verbindung */
            closesocket(fd);
    
        }
        return EXIT_SUCCESS;
    }

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

    As SG57 already said, something such as:

    Code:
    typedef enum {FALSE = 0, TRUE = 1} bool;
    will suffice.

    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

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

    Bronx - I still havent a clue, but some things to try... Try moving the glColor4f into the glBegin and glEnd, else try removing the texcoordinates that are mapped for some reason (?). I dont see a texture being binded, so i dunno.

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


  29. #1109
    sceKernelExitGame();
    Points: 19.955, Level: 89
    Level completed: 21%, Points required for next Level: 395
    Overall activity: 0%

    Registriert seit
    Jan 2006
    Ort
    New York
    Beiträge
    3.126
    Points
    19.955
    Level
    89
    Downloads
    0
    Uploads
    0

    Standard

    ok, Ill try it :) Thanks

  30. #1110
    likes kittens....awww....
    Points: 6.975, Level: 55
    Level completed: 13%, Points required for next Level: 175
    Overall activity: 0%

    Registriert seit
    Sep 2006
    Ort
    Detroit
    Beiträge
    628
    Points
    6.975
    Level
    55
    Downloads
    0
    Uploads
    0

    Cool

    This is my revised code.
    Spoiler for Code:
    Code:
    #include <pspdisplay.h>
    #include <pspgu.h>
    #include <pspkernel.h>
    #include <pspctrl.h>
    #include <pspdebug.h>
    #include <stdlib.h>
    #include <stdio.h>
    #include "graphics.h"
    #define printf pspDebugScreenPrintf
    #define dprint pspDebugScreenPrintf
    #define true 1
    #define false !true
    #define bool int
    
    PSP_MODULE_INFO("???", 0, 1, 1);
    
    int exit_callback(int arg1, int arg2, void *common) {
              sceKernelExitGame();
              return 0;
    }
    
    int CallbackThread(SceSize args, void *argp) {
              int cbid;
    
              cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
              sceKernelRegisterExitCallback(cbid);
    
              sceKernelSleepThreadCB();
    
              return 0;
    }
    
    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(void) { //main functions
              pspDebugScreenInit();
              SetupCallbacks();
              initGraphics();
              SceCtrlData pad;
              sceCtrlSetSamplingCycle(0);
              sceCtrlPeekBufferPositive(&pad, 1);
    while (1) {
              //while loop
              bool rn0 = 0;
              int rand() {
                if (pad.Buttons != 0){
                  if(pad.Buttons & PSP_CTRL_CROSS) {
                    rn0=rand()%10000; //generates random number
                  }
                }
                if (rn0 != 0) {
                  pspDebugScreenPrintf("Press 'X' to start"); //prints text to the screen
                }
              pspDebugScreenSetXY(0, 2); //setting up our X and Y coordinates
              pspDebugScreenClear(); //clears screen
              fillScreenRect(RGB(255, 0, 0), 0, 0, 480, 272); //fills screen with RGB
              pspDebugScreenSetTextColor(0x00000000); //sets text color with HEX
              pspDebugScreenPrintf("Generated Integer:%d",rn0); //prints text to the screen
              sceDisplayWaitVblankStart();
              sceKernelSleepThread();
              }
    return 1;
    }

    When I compile it just keeps saying this.
    Spoiler for Errors:

    [email protected] ~
    $ cd /pspdev

    [email protected] /pspdev
    $ make
    psp-gcc -I. -I/usr/psp/sdk/include -O2 -G0 -Wall -c -o main.o main.c
    main.c : In function 'main':
    main.c(72) : error: syntax error at end of input
    make: *** [main.o] Error 1

    [email protected] /pspdev
    $


 

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 .