Esempio n. 1
0
//Draws arrow at new angle
void DrawArrow(float radAngle) {
	//Erase old copy
	DrawPoly(4, arrow, BLACK);
	//Recalculate new rotated angle
	ResetArrow();
	RotatePoly(4, arrow, arrowX, arrowY, radAngle);
	//Draw new arrow
	DrawPoly(4, arrow, YELLOW);
}
Esempio n. 2
0
int main()
{
    // Initialization
    //--------------------------------------------------------------------------------------
    int screenWidth = 800;
    int screenHeight = 450;

    InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
    //--------------------------------------------------------------------------------------

    // Main game loop
    while (!WindowShouldClose())    // Detect window close button or ESC key
    {
        // Update
        //----------------------------------------------------------------------------------
        // TODO: Update your variables here
        //----------------------------------------------------------------------------------

        // Draw
        //----------------------------------------------------------------------------------
        BeginDrawing();

            ClearBackground(RAYWHITE);

            DrawText("some basic shapes available on raylib", 20, 20, 20, DARKGRAY);

            DrawLine(18, 42, screenWidth - 18, 42, BLACK);

            DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
            DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
            DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);

            DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
            DrawRectangleGradient(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
            DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE);

            DrawTriangle((Vector2){screenWidth/4*3, 80},
                         (Vector2){screenWidth/4*3 - 60, 150},
                         (Vector2){screenWidth/4*3 + 60, 150}, VIOLET);

            DrawTriangleLines((Vector2){screenWidth/4*3, 160},
                              (Vector2){screenWidth/4*3 - 20, 230},
                              (Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);

            DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);

        EndDrawing();
        //----------------------------------------------------------------------------------
    }

    // De-Initialization
    //--------------------------------------------------------------------------------------
    CloseWindow();        // Close window and OpenGL context
    //--------------------------------------------------------------------------------------

    return 0;
}
Esempio n. 3
0
/*
=======================================================================================================================================
BotDrawDebugPolygons
=======================================================================================================================================
*/
void BotDrawDebugPolygons(void (*DrawPoly)(int color, int numPoints, float *points), int value) {
	static cvar_t *bot_debug, *bot_groundonly, *bot_reachability, *bot_highlightarea;
	bot_debugpoly_t *poly;
	int i, parm0;

	if (!debugpolygons) {
		return;
	}
	// bot debugging
	if (!bot_debug) {
		bot_debug = Cvar_Get("bot_debug", "0", 0);
	}

	if (bot_enable && bot_debug->integer) {
		// show reachabilities
		if (!bot_reachability) {
			bot_reachability = Cvar_Get("bot_reachability", "0", 0);
		}
		// show ground faces only
		if (!bot_groundonly) {
			bot_groundonly = Cvar_Get("bot_groundonly", "1", 0);
		}
		// get the hightlight area
		if (!bot_highlightarea) {
			bot_highlightarea = Cvar_Get("bot_highlightarea", "0", 0);
		}

		parm0 = 0;

		if (svs.clients[0].lastUsercmd.buttons & BUTTON_ATTACK) {
			parm0 |= 1;
		}

		if (bot_reachability->integer) {
			parm0 |= 2;
		}

		if (bot_groundonly->integer) {
			parm0 |= 4;
		}

		botlib_export->BotLibVarSet("bot_highlightarea", bot_highlightarea->string);
		botlib_export->Test(parm0, NULL, svs.clients[0].gentity->r.currentOrigin, svs.clients[0].gentity->r.currentAngles);
	}
	// draw all debug polys
	for (i = 0; i < bot_maxdebugpolys; i++) {
		poly = &debugpolygons[i];

		if (!poly->inuse) {
			continue;
		}

		DrawPoly(poly->color, poly->numPoints, (float *)poly->points);
		//Com_Printf("poly %i, numpoints = %d\n", i, poly->numPoints);
	}
}
Esempio n. 4
0
void RMouseDownDraw() {
	if (shape == Poly){
		if (polygon.n != 0){
			DrawPoly(polygon);
			entities.push_back(new PolygonEntity(polygon));
			polygon.n = 0;
		}
	}
	mouse_action = NO_ACTION;
}
Esempio n. 5
0
//Draw an explosion in the centre where your shell hit
void DrawExplosion() {
	iPoint boom[16];
	int i;
	double angle, distance;
	//Define a poly star with some random peaks
	for (i=0; i<16; i++) {
		if (i % 2 == 1)
			distance = 8;
		else
			//Random star points to stop all explosions being identical
			distance = Random(12.0, 24.0);
		angle = PI * 2 * i / 16.0;
		boom[i].x = 80.0 - distance * qsin(angle);
		boom[i].y = 60 + distance * qcos(angle);
	}
	DrawPoly(16, boom, YELLOW);
}
void ClipPoly( PolyFC *poly, UInt32 clipTest )
{
	PolyFC	newPoly;
	int		xyz[MAX_VERTS_PER_CLIPPED_POLYGON];
	int		i;

	// Initialize our temporary polygon
	newPoly.type	= poly->type;
	newPoly.rgba	= poly->rgba;
	newPoly.nVerts	= poly->nVerts;
	newPoly.xyz		= xyz;
	for (i=0; i<newPoly.nVerts; i++) {
		xyz[i] = poly->xyz[i];
	}

	// Clip the temporary polygon (destructive)
	if (pvtClipPoly( clipTest, &newPoly.nVerts, newPoly.xyz, NULL, NULL, NULL )) {
		DrawPoly( &newPoly );
	}
}
Esempio n. 7
0
void DrawPolygon(float_polygon_type poly)
{
	float_polygon_type poly_out;
	//for (int i = 0; i < poly.n; i++) // Transformação do usuário
	//<Matriz>.DoTransformatio(poly.vertex[i].x, poly.vertex[i].y)
	ClipPolygon(poly, poly_out);
	if (poly_out.n > 0) // resultou em poligono dentro
	{
		polygon_type device_poly;
		device_poly.n = poly_out.n;
		for (int i = 0; i < poly_out.n; i++) // transformacao de janelamento
		{
			ViewingTransformation(&poly_out.vertex[i].x, &poly_out.vertex[i].y);
			NormalizedToDevice(poly_out.vertex[i].x, poly_out.vertex[i].y, &device_poly.vertex[i].x, &device_poly.vertex[i].y);
		}
		DrawPoly(device_poly); // desenha
		//if (fill_polygon)
		//	FillPolygon(poly_out); // preenche poligono
	}
}
Esempio n. 8
0
/** Draws the entire game screen:

\li First, the background.
\li The players.
\li The debug wireframes (if debugging is turned on)
\li The doodads.
\li The hitpoint display.
\li The gametime display.
\li The FPS display.
\li The "Round x" text during Ph_Start

Input:
\li m_enGamePhase
\li g_oBackend.m_iRoundLength
\li m_iNumberOfRounds
\li oFpsCounter
*/
void CGame::Draw()
{
	#define GROUNDZERO (440 + m_iYOffset)

	m_iYOffset = ( gamescreen->h - 480 ) / 2;

	if ( m_iYOffset )
	{
		SDL_Rect oRect;
		oRect.x = 0;
		oRect.w = gamescreen->w;
		oRect.y = m_iYOffset;
		oRect.h = 480;
		SDL_SetClipRect( gamescreen, &oRect );
	}
	else
	{
		SDL_SetClipRect( gamescreen, NULL );
	}
	
	DrawBackground();

	// DRAW THE SHADOWS

	int i;

	for ( i=0; i<g_oState.m_iNumPlayers; ++i )
	{
		CBackend::SPlayer& roPlayer = g_oBackend.m_aoPlayers[i];
		int iFrame = roPlayer.m_iFrame;
		if ( iFrame == 0 )
			continue;
		
		CRlePack* poPack = g_oPlayerSelect.GetPlayerInfo(i).m_poPack;
		int w = poPack->GetWidth( omABS(iFrame)-1 );
		int h = poPack->GetHeight( omABS(iFrame)-1 );
		
		h = GROUNDZERO - ( h + roPlayer.m_iY );	// Distance of feet from ground
		if ( h < 0 ) h = 0;
		if ( h > 500 ) h = 500;
		h = 500 - h;
		int h2 = 15 * h / 500;
		h = ( w / 2 ) * h / 500;

		if ( gamescreen->format->BitsPerPixel <= 8 )
		{
			sge_FilledEllipse( gamescreen, g_oBackend.m_aoPlayers[i].m_iX + w/2, GROUNDZERO,
				h, h2, C_BLACK );
		}
		else
		{
			sge_FilledEllipseAlpha( gamescreen, g_oBackend.m_aoPlayers[i].m_iX + w/2, GROUNDZERO,
				h, h2, C_BLACK, 128 );
		}
	}

	for ( i=0; i<g_oState.m_iNumPlayers; ++i )
	{
		CBackend::SPlayer& roPlayer = g_oBackend.m_aoPlayers[i];
		int iFrame = roPlayer.m_iFrame;
		if ( iFrame == 0 )
			continue;

		CRlePack* poPack = g_oPlayerSelect.GetPlayerInfo(i).m_poPack;
		poPack->Draw( omABS(iFrame)-1, roPlayer.m_iX, roPlayer.m_iY + m_iYOffset, iFrame<0 );
	}
	
	if ( m_bDebug )
	{
		DrawPoly( "p1head", C_LIGHTRED );
		DrawPoly( "p1body", C_LIGHTGREEN );
		DrawPoly( "p1legs", C_LIGHTBLUE );
		DrawPoly( "p1hit", C_YELLOW );
		DrawPoly( "p2head", C_LIGHTRED );
		DrawPoly( "p2body", C_LIGHTGREEN );
		DrawPoly( "p2legs", C_LIGHTBLUE );
		DrawPoly( "p2hit", C_YELLOW );
	}

	DrawDoodads();
	DrawHitPointDisplays();

	if ( Ph_NORMAL == m_enGamePhase )
	{
		char s[100];
		sprintf( s, "%d", m_iGameTime );	// m_iGameTime is maintained by DoGame
		DrawTextMSZ( s, inkFont, 320, 10 + m_iYOffset, AlignHCenter, C_LIGHTCYAN, gamescreen, false );
	}
	else if ( Ph_START == m_enGamePhase )
	{
		char s[100];
		const char* format = Translate( "Round %d" );
		sprintf( s, format, m_iNumberOfRounds+1 );
		DrawTextMSZ( s, inkFont, 320, 200 + m_iYOffset, AlignHCenter, C_WHITE, gamescreen, false );
	}
	else if ( Ph_REWIND == m_enGamePhase )
	{
		DrawTextMSZ( "REW", inkFont, 320, 10 + m_iYOffset, AlignHCenter, C_WHITE, gamescreen );
		sge_BF_textout( gamescreen, fastFont, Translate("Press F1 to skip..."), 230, 450 + m_iYOffset );
	}
	else if ( Ph_SLOWFORWARD == m_enGamePhase )
	{
		DrawTextMSZ( "REPLAY", inkFont, 320, 10 + m_iYOffset, AlignHCenter, C_WHITE, gamescreen );
		sge_BF_textout( gamescreen, fastFont, Translate("Press F1 to skip..."), 230, 450 + m_iYOffset );
	}
	else if ( Ph_REPLAY == m_enGamePhase )
	{
		DrawTextMSZ( "DEMO", inkFont, 320, 10 + m_iYOffset, AlignHCenter, C_WHITE, gamescreen );
	}
	
	if ( oFpsCounter.m_iFps > 0 )
	{
		sge_BF_textoutf( gamescreen, fastFont, 2, 455 + m_iYOffset, "%d fps", oFpsCounter.m_iFps );
	}
	
	SDL_Flip( gamescreen );
}
Esempio n. 9
0
    int main(void)
{
    SHORT       width, height;	// variables to store the height and width of the 16-bit bitmap image
    SHORT       counter;		// loop control variable for each shape that controls how many shapes are printed and their scale
    SHORT  		triangle[] = {160,120,160,120,160,120,160,120};		// triangle polygon points (start triangle in center of LCD)
    
    #if defined(__dsPIC33F__) || defined(__PIC24H__)

    // Configure Oscillator to operate the device at 40Mhz
    // Fosc= Fin*M/(N1*N2), Fcy=Fosc/2
    // Fosc= 8M*40(2*2)=80Mhz for 8M input clock
    PLLFBD = 38;                    // M=40
    CLKDIVbits.PLLPOST = 0;         // N1=2
    CLKDIVbits.PLLPRE = 0;          // N2=2
    OSCTUN = 0;                     // Tune FRC oscillator, if FRC is used

    // Disable Watch Dog Timer
    RCONbits.SWDTEN = 0;

    // Clock switching to incorporate PLL
    __builtin_write_OSCCONH(0x03);  // Initiate Clock Switch to Primary

    // Oscillator with PLL (NOSC=0b011)
    __builtin_write_OSCCONL(0x01);  // Start clock switching
    while(OSCCONbits.COSC != 0b011);

    // Wait for Clock switch to occur	
    // Wait for PLL to lock
    while(OSCCONbits.LOCK != 1)
    { };
    #elif defined(__PIC32MX__)
    INTEnableSystemMultiVectoredInt();
    SYSTEMConfigPerformance(GetSystemClock());
    #ifdef MULTI_MEDIA_BOARD_DM00123
    CPLDInitialize();
    CPLDSetGraphicsConfiguration(GRAPHICS_HW_CONFIG);
    CPLDSetSPIFlashConfiguration(SPI_FLASH_CHANNEL);
    #endif
    #endif

    #if defined (PIC24FJ256DA210_DEV_BOARD)
    
    // _ANSG8 = 0; /* S1 */
    // _ANSE9 = 0; /* S2 */
    // _ANSB5 = 0; /* S3 */
        
    #else

    /////////////////////////////////////////////////////////////////////////////
    // ADC Explorer 16 Development Board Errata (work around 2)
    // RB15 should be output
    /////////////////////////////////////////////////////////////////////////////
    LATBbits.LATB15 = 0;
    TRISBbits.TRISB15 = 0;

    #endif

    /////////////////////////////////////////////////////////////////////////////
    #if defined(__dsPIC33FJ128GP804__) || defined(__PIC24HJ128GP504__)
    AD1PCFGL = 0xffff;
    #endif
    InitGraph();

    while(1)
    {
	    /* Display the Kettering Logo bit image with the Welcome to the ECE in the center 
	    /* The image was taken from a JPEG and converted to a 16-bit bitmap in order to meet 
	    /* the display requirement of 16-bits per pixel. This can be done by resaving the
	    /* JPEG as 16-bit bitmap in a image editing program and then converting it using
	    /* the graphics library resource converter. The LCD only supports 4-bit, 8-bit, and
	    /* 16-bits per pixel images 
	    */
	    width = GetImageWidth((void *) &kulogo);
		SetFont((void *) &Font25);
	    WAIT_UNTIL_FINISH(PutImage(45, 20 , (void *) &kulogo,  1)); // image location is relative to the top left corner of the image
        SetColor(WHITE);
        Bar(45, 110, width + 45, 135);	// Draw a bar over the image to place the text over.
        SetColor(BLUE);
        OutTextXY(65, 110, "WELCOME TO THE ECE");
        
        DelayMs(DEMODELAY);	// delay for 1 sec and clear the screen
        SetColor(BLACK);
        ClearDevice();

		/* Display multiple circles, starting at the center and increasing in size at 
        /* each draw until the LCD borders are met. Increasing the counter value will 
        /* expand the shape size more quickly. */
        for(counter = 0; counter < MIN(GetMaxX(), GetMaxY()) >> 1; counter += 14)
        {
	        SetColor(BLACK);	// refresh the screen
	        ClearDevice();	
	        SetColor(BRIGHTRED);
	        SetFont((void *) &Font25);		// draw the name of the shape in the center
	        OutTextXY(135, 110, "Circle");
            WAIT_UNTIL_FINISH(Circle(GetMaxX() >> 1, GetMaxY() >> 1, counter + 5));	// draw the shape
            DelayMs(50);	// display for 50 ms
        }

        DelayMs(DEMODELAY);	// delay for 1 sec and clear the screen
        SetColor(BLACK);
        ClearDevice();

		/* Display multiple rectangles, starting at the center and increasing in size at 
        /* each draw until the LCD borders are met. Increasing the counter value will 
        /* expand the shape size more quickly. */
        for(counter = 0; counter < MIN(GetMaxX() / 2, GetMaxY() / 2) >> 1; counter += 5)
        {	
	        SetColor(BLACK);	// refresh the screen
	        ClearDevice();	
	        SetColor(BRIGHTBLUE);
	        OutTextXY(120, 110, "Rectangle");	// draw the name of the shape in the center
            WAIT_UNTIL_FINISH
            (
                Rectangle
                    (
                        GetMaxX() / 2 - counter * 3 + 6,	// x value of top left corner of rectangle
                        GetMaxY() / 2 - counter * 2 - 8,	// y value of top left corner of rectangle
                        GetMaxX() / 2 + counter * 3 - 6,	// x value of bottom right corner of rectangle
                        GetMaxY() / 2 + counter * 2 + 8     // y value of bottom right corner of rectangle        
                    )
            );
            DelayMs(20); // Display for 20 ms
            
        }

        DelayMs(DEMODELAY); // delay for 1 sec and clear the screen
        SetColor(BLACK);
        ClearDevice();
        
        /* Display multiple triangles, starting at the center and increasing in size at 
        /* each draw until the LCD borders are met. Increasing the counter value will 
        /* expand the shape size more quickly. */
        int i;
		for(counter = 0; counter < MIN(GetMaxX() / 2, GetMaxY() / 2) >> 1; counter += 10)
		{
			SetColor(BLACK);	// refresh the screen
			ClearDevice();
			SetColor(GREEN);	// draw the name of the shape at the center
			OutTextXY(125, 110, "Triangle");
			
			//{160,120,160,120,160,120,160,120} start in center of screen
			triangle[1] = triangle[1] - counter * 2 - 20; 	 // top point y
			triangle[7] = triangle[1];				 		 // top point y (close triangle)
			triangle[2] = triangle[2] - counter * 2 - 58; 	 // left corner point x
			triangle[3] = triangle[3] + counter * 2 + 16;	 // left corner point y
			triangle[4] = triangle[4] + counter * 2 + 58; 	 // right corner point x
			triangle[5] = triangle[5] + counter * 2 + 16;	 // right corner point y
			
			DrawPoly(4, triangle);	// draw the triangle (4 points to enclose it)
			
			// reset each of the triangle points to the center to prevent over expansion
			for (i = 0; i < 8; i++)
				if (i % 2 == 0)
					triangle[i] = 160;
				else
					triangle[i] = 120;
				
			DelayMs(50);	// display for 50 ms
		}
		
       
		DelayMs(DEMODELAY); // delay for 1 sec and clear the screen
    	SetColor(BLACK);
    	ClearDevice();
        
    }
}
Esempio n. 10
0
void UpdateDrawOneFrame(void)
{
    // Update
    //----------------------------------------------------------------------------------
    if (!onTransition)
    {
        switch(currentScreen) 
        {
            case LOADING: 
            {
                // Update LOADING screen variables
                framesCounter++;    // Count frames

                if ((loadBarWidth < loadBarMaxWidth) && ((framesCounter%30) == 0)) loadBarWidth++;

                if (IsKeyDown(KEY_SPACE) && (loadBarWidth < loadBarMaxWidth)) loadBarWidth += 4;

                if (IsKeyPressed(KEY_ENTER) && (loadBarWidth >= loadBarMaxWidth)) TransitionToScreen(LOGO);

            } break;
            case LOGO:
            {
                // Update LOGO screen variables
                if (logoScreenState == 0)                 // State 0: Small box blinking
                {
                    framesCounter++;

                    if (framesCounter == 120)
                    {
                        logoScreenState = 1;
                        framesCounter = 0;      // Reset counter... will be used later...
                    }
                }
                else if (logoScreenState == 1)            // State 1: Top and left bars growing
                {
                    topSideRecWidth += 4;
                    leftSideRecHeight += 4;

                    if (topSideRecWidth == 256) logoScreenState = 2;
                }
                else if (logoScreenState == 2)            // State 2: Bottom and right bars growing
                {
                    bottomSideRecWidth += 4;
                    rightSideRecHeight += 4;

                    if (bottomSideRecWidth == 256)
                    {
                        lettersCounter = 0;
                        for (int i = 0; i < strlen(msgBuffer); i++) msgBuffer[i] = ' ';

                        logoScreenState = 3;
                    }
                }
                else if (logoScreenState == 3)            // State 3: Letters appearing (one by one)
                {
                    framesCounter++;

                    // Every 12 frames, one more letter!
                    if ((framesCounter%12) == 0) raylibLettersCount++;

                    switch (raylibLettersCount)
                    {
                        case 1: raylib[0] = 'r'; break;
                        case 2: raylib[1] = 'a'; break;
                        case 3: raylib[2] = 'y'; break;
                        case 4: raylib[3] = 'l'; break;
                        case 5: raylib[4] = 'i'; break;
                        case 6: raylib[5] = 'b'; break;
                        default: break;
                    }

                    if (raylibLettersCount >= 10)
                    {
                        // Write raylib description messages
                        if ((framesCounter%2) == 0) lettersCounter++;

                        if (!msgLogoADone)
                        {
                            if (lettersCounter <= strlen(msgLogoA)) strncpy(msgBuffer, msgLogoA, lettersCounter);
                            else
                            {
                                for (int i = 0; i < strlen(msgBuffer); i++) msgBuffer[i] = ' ';

                                lettersCounter = 0;
                                msgLogoADone = true;
                            }
                        }
                        else if (!msgLogoBDone)
                        {
                            if (lettersCounter <= strlen(msgLogoB)) strncpy(msgBuffer, msgLogoB, lettersCounter);
                            else
                            {
                                msgLogoBDone = true;
                                framesCounter = 0;
                            }
                        }
                    }
                }

                // Press enter to change to MODULES screen
                if (IsKeyPressed(KEY_ENTER) && msgLogoBDone) TransitionToScreen(MODULES);
                else if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(LOGO);

            } break;
            case MODULES:
            {
                // Update MODULES screen variables here!
                framesCounter++;

                if (IsKeyPressed(KEY_RIGHT) && (selectedModule < 5))
                {
                    selectedModule++;
                    framesCounter = 0;
                }
                else if (IsKeyPressed(KEY_LEFT) && (selectedModule > 0))
                {
                    selectedModule--;
                    framesCounter = 0;
                }

                if (selectedModule == CORE)
                {
                    if ((framesCounter > 60) && (windowOffset < 40))
                    {
                        windowOffset++;
                        ballPosition.x++;
                        ballPosition.y++;
                    }

                    if (framesCounter > 140)
                    {
                        if (IsKeyDown('A')) ballPosition.x -= 5;
                        if (IsKeyDown('D')) ballPosition.x += 5;
                        if (IsKeyDown('W')) ballPosition.y -= 5;
                        if (IsKeyDown('S')) ballPosition.y += 5;

                        if (IsKeyPressed('1')) coreWindow = 1;
                        if (IsKeyPressed('2')) coreWindow = 2;
                        if (IsKeyPressed('3')) coreWindow = 3;
                        if (IsKeyPressed('4')) coreWindow = 4;
                    }
                }

                if (selectedModule == TEXTURES) scaleFactor = (sinf(2*PI/240*framesCounter) + 1.0f)/2;

                if (selectedModule == AUDIO)
                {
                    if (IsKeyPressed(KEY_SPACE) && !MusicIsPlaying()) PlayMusicStream("resources/audio/guitar_noodling.ogg");         // Play music stream

                    if (IsKeyPressed('S'))
                    {
                        StopMusicStream();
                        timePlayed = 0.0f;

                        for (int i = 0; i < MAX_BALLS; i++)
                        {
                            soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
                            soundBallsColor[i] = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
                            soundBallsRadius[i] = GetRandomValue(2, 50);
                            soundBallsAlpha[i] = 1.0f;

                            soundBallsActive[i] = false;
                        }
                    }

                    if (MusicIsPlaying())
                    {
                        timePlayed = GetMusicTimePlayed() / GetMusicTimeLength() * 100 * 4;

                        if ((framesCounter%10) == 0)
                        {
                            for (int i = 0; i < MAX_BALLS; i++)
                            {
                                if (!soundBallsActive[i])
                                {
                                    soundBallsActive[i] = true;
                                    break;
                                }
                            }
                        }

                        for (int i = 0; i < MAX_BALLS; i++)
                        {
                            if (soundBallsActive[i]) soundBallsAlpha[i] -= 0.005f;

                            if (soundBallsAlpha[i] <= 0)
                            {
                                soundBallsActive[i] = false;

                                // Reset ball random
                                soundBallsPosition[i] = (Vector2){ 650 + 560/2 + GetRandomValue(-280, 280), 220 + 200 + GetRandomValue(-200, 200) };
                                soundBallsColor[i] = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
                                soundBallsRadius[i] = GetRandomValue(2, 60);
                                soundBallsAlpha[i] = 1.0f;
                            }
                        }
                    }

                    if (IsKeyPressed('N')) PlaySound(fxWav);
                    //if (IsKeyPressed('M')) PlaySound(fxOgg);
                }

                // Press enter to change to ENDING screen
                if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(ENDING);
                else if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(LOGO);

            } break;
            case PONG:
            {
                // Update SECRET screen variables here!
                framesCounter++;

                if (IsKeyPressed('P')) pongPaused = !pongPaused;
                
                if (!pongPaused)
                {
                    pongBallPosition.x += pongBallSpeed.x;
                    pongBallPosition.y += pongBallSpeed.y;

                    if ((pongBallPosition.x >= screenWidth - 5) || (pongBallPosition.x <= 5)) pongBallSpeed.x *= -1;
                    if ((pongBallPosition.y >= screenHeight - 5) || (pongBallPosition.y <= 5)) pongBallSpeed.y *= -1;

                    if (IsKeyDown(KEY_UP) || IsKeyDown('W'))
                    {
                        pongPlayerRec.y -= 5;
                        pongAutoMode = false;
                        pongAutoCounter = 180;
                    }
                    else if (IsKeyDown(KEY_DOWN) || IsKeyDown('S'))
                    {
                        pongPlayerRec.y += 5;
                        pongAutoMode = false;
                        pongAutoCounter = 180;
                    }
                    else if (pongAutoCounter > 0)
                    {
                        pongAutoCounter--;
                        
                        if (pongAutoCounter == 0) pongAutoMode = true;
                    }

                    if ((pongBallPosition.x < 600) && pongAutoMode)
                    {
                        if (pongBallPosition.y > (pongPlayerRec.y + pongPlayerRec.height/2)) pongPlayerRec.y += 5;
                        else if (pongBallPosition.y < (pongPlayerRec.y + pongPlayerRec.height/2)) pongPlayerRec.y -= 5;
                    }

                    if (pongPlayerRec.y <= 0) pongPlayerRec.y = 0;
                    else if ((pongPlayerRec.y + pongPlayerRec.height) >= screenHeight) pongPlayerRec.y = screenHeight - pongPlayerRec.height;
                    
                    if (pongBallPosition.x > screenWidth - 600)
                    {
                        if (pongBallPosition.y > (pongEnemyRec.y + pongEnemyRec.height/2)) pongEnemyRec.y += 5;
                        else if (pongBallPosition.y < (pongEnemyRec.y + pongEnemyRec.height/2)) pongEnemyRec.y -= 5;

                        if (pongEnemyRec.y <= 0) pongEnemyRec.y = 0;
                        else if ((pongEnemyRec.y + pongEnemyRec.height) >= screenHeight) pongEnemyRec.y = screenHeight - pongEnemyRec.height;
                    }

                    if ((CheckCollisionCircleRec(pongBallPosition, 10, pongPlayerRec)) || (CheckCollisionCircleRec(pongBallPosition, 10, pongEnemyRec))) pongBallSpeed.x *= -1;
                    
                    if (pongBallPosition.x >= screenWidth - 5) pongScorePlayer++;
                    else if (pongBallPosition.x <= 5) pongScoreEnemy++;
                }

                // Press enter to move back to MODULES screen
                if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(ENDING);
                if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(ENDING);
            } break;
            case ENDING:
            {
                // Update ENDING screen
                framesCounter++;

                // Press enter to move back to MODULES screen
                if (IsKeyPressed(KEY_ENTER)) TransitionToScreen(PONG);
                if (IsKeyPressed(KEY_BACKSPACE)) TransitionToScreen(MODULES);

            } break;
            default: break;
        }

        if ((currentScreen != LOADING) && (timeCounter < totalTime)) timeCounter++;
    }
    else UpdateTransition(); // Update transition (fade-in, fade-out)
    //----------------------------------------------------------------------------------

    // Draw
    //----------------------------------------------------------------------------------
    BeginDrawing();

        ClearBackground(RAYWHITE);

        switch(currentScreen)
        {
            case LOADING:
            {
                // Draw LOADING screen
                if ((loadBarWidth < loadBarMaxWidth) && ((framesCounter/40)%2)) DrawText(msgLoading, 360, 240, 40, DARKGRAY);

                DrawRectangle(360 - 4, 300 - 4, loadBarMaxWidth + 8, 60 + 8, LIGHTGRAY);
                DrawRectangle(360, 300, loadBarWidth - 1, 60, DARKGRAY);
                DrawRectangleLines(360 - 4, 300 - 5, loadBarMaxWidth + 8, 60 + 8, DARKGRAY);

                if (loadBarWidth >= loadBarMaxWidth)
                {
                    //DrawText(msgLoading, 360, 240, 40, DARKGRAY);
                    if ((framesCounter/30)%2) DrawText(msgPressEnter, screenWidth/2 - MeasureText(msgPressEnter, 40)/2 + 20, 400, 40, DARKGRAY);
                }
                else DrawText("PRESS SPACE to ACCELERATE LOADING! ;)", screenWidth/2 - 200, 400, 20, LIGHTGRAY);

            } break;
            case LOGO:
            {
                // Draw LOGO screen
                if (logoScreenState == 0)
                {
                    if ((framesCounter/15)%2) DrawRectangle(logoPositionX, logoPositionY - 60, 16, 16, BLACK);
                }
                else if (logoScreenState == 1)
                {
                    DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
                    DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK);
                }
                else if (logoScreenState == 2)
                {
                    DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
                    DrawRectangle(logoPositionX, logoPositionY - 60, 16, leftSideRecHeight, BLACK);

                    DrawRectangle(logoPositionX + 240, logoPositionY - 60, 16, rightSideRecHeight, BLACK);
                    DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK);
                }
                else if (logoScreenState == 3)
                {
                    DrawRectangle(logoPositionX, logoPositionY - 60, topSideRecWidth, 16, BLACK);
                    DrawRectangle(logoPositionX, logoPositionY + 16 - 60, 16, leftSideRecHeight - 32, BLACK);

                    DrawRectangle(logoPositionX + 240, logoPositionY + 16 - 60, 16, rightSideRecHeight - 32, BLACK);
                    DrawRectangle(logoPositionX, logoPositionY + 240 - 60, bottomSideRecWidth, 16, BLACK);

                    DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112 - 60, 224, 224, RAYWHITE);

                    DrawText(raylib, screenWidth/2 - 44, screenHeight/2 + 48 - 60, 50, BLACK);

                    if (!msgLogoADone) DrawText(msgBuffer, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 460, 30, GRAY);
                    else
                    {
                        DrawText(msgLogoA, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 460, 30, GRAY);

                        if (!msgLogoBDone) DrawText(msgBuffer, screenWidth/2 - MeasureText(msgLogoB, 30)/2, 510, 30, GRAY);
                        else
                        {
                            DrawText(msgLogoB, screenWidth/2 - MeasureText(msgLogoA, 30)/2, 510, 30, GRAY);

                            if ((framesCounter > 90) && ((framesCounter/30)%2)) DrawText("PRESS ENTER to CONTINUE", 930, 650, 20, GRAY);
                        }
                    }
                }
            } break;
            case MODULES:
            {
                // Draw MODULES screen
                DrawTexture(raylibLogoB, 40, 40, WHITE);
                DrawText("raylib is composed of 6 main modules:", 128 + 40 + 30, 50, 20, GRAY);

                if (framesCounter < 120)
                {
                    if (((framesCounter/30)%2) == 0) DrawRectangle(128 + 40 + 30 - 4 + 175*selectedModule, 128 + 40 - 70 - 8 - 4, 158, 78, RED);
                }
                else DrawRectangle(128 + 40 + 30 - 4 + 175*selectedModule, 128 + 40 - 70 - 8 - 4, 158, 78, RED);
                
                if (selectedModule != AUDIO)
                {
                    DrawTriangle((Vector2){950 - 40, 685 - 10}, (Vector2){950 - 60, 685}, (Vector2){950 - 40, 685 + 10}, GRAY);
                    DrawTriangle((Vector2){950 - 30, 685 - 10}, (Vector2){950 - 30, 685 + 10}, (Vector2){950 - 10, 685}, GRAY);
                    DrawText("PRESS RIGHT or LEFT to EXPLORE MODULES", 960, 680, 10, GRAY);
                }

                switch (selectedModule)
                {
                    case CORE:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x5c5a5aff));
                    
                        DrawTextEx(fontRomulus, "Open-Close Window", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
                        DrawTextEx(fontRomulus, "Manage Drawing Area", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
                        DrawTextEx(fontRomulus, "Manage Inputs", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
                        DrawTextEx(fontRomulus, "Manage Timming", (Vector2){ 48, 320 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));
                        DrawTextEx(fontRomulus, "Auxiliar Functions", (Vector2){ 48, 350 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x5c5a5aff));

                        switch (coreWindow)
                        {
                            case 1: DrawTexture(raylibWindow, 520, 220, WHITE); break;
                            case 2: DrawTextureEx(raylibWindow01, (Vector2){ 450, 220 - 45 }, 0.0f, 4.0f, WHITE); break;
                            case 3: DrawTextureEx(raylibWindow02, (Vector2){ 430, 220 - 40 }, 0.0f, 4.0f, WHITE); break;
                            case 4: DrawTextureEx(raylibWindow03, (Vector2){ 470, 220 - 65 }, 0.0f, 4.0f, WHITE); break;
                            default: DrawTexture(raylibWindow, 520, 220, WHITE); break;
                        }
                        
                        if (framesCounter > 140) DrawText("Check the possible windows raylib can run on. PRESS KEY: 1, 2, 3 or 4", 520 + 8 + windowOffset + 160, 220 + windowOffset + 10, 10, LIGHTGRAY);                        
                        
                        DrawText("Compile raylib C code for the folowing platforms:", 48, 400, 10, MAROON);
                        
                        DrawTextureRec(platforms, (Rectangle){ 0, 0, platforms.width, platforms.height}, (Vector2){ 75, 420 }, WHITE);

                        DrawRectangle(520 + 8 + windowOffset, 220 + 31 + windowOffset, 640, 360, RAYWHITE);
                        DrawRectangleLines(520 + 8 + windowOffset - 1, 220 + 31 + windowOffset - 2, 640 + 2, 360 + 2, GRAY);
                        DrawFPS(520 + 8 + windowOffset + 10, 220 + 31 + windowOffset + 10);
                        
                        DrawRectangle(ballPosition.x - 50, ballPosition.y - 50, 100, 100, Fade(MAROON, 0.5f));
                        DrawRectangleRec(GetCollisionRec((Rectangle){ 520 + 8 + windowOffset - 1, 220 + 31 + windowOffset - 1, 640 + 2, 360 + 2 }, (Rectangle){ (int)ballPosition.x - 50, (int)ballPosition.y - 50, 100, 100 }), MAROON);
                        
                        if (framesCounter > 140)
                        {
                            DrawTextEx(fontMecha, "MOVE ME", (Vector2){ ballPosition.x - 26, ballPosition.y - 20 }, GetFontBaseSize(fontMecha), 2, BLACK);
                            DrawTextEx(fontMecha, "[ W A S D ]", (Vector2){ ballPosition.x - 36, ballPosition.y }, GetFontBaseSize(fontMecha), 2, BLACK);
                        }
                    } break;
                    case SHAPES:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0xcd5757ff));
                    
                        DrawTextEx(fontRomulus, "Draw Basic Shapes", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0xcd5757ff));
                        DrawTextEx(fontRomulus, "Basic Collision Detection", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0xcd5757ff));

                        DrawCircle(screenWidth/4, 120 + 240, 35, DARKBLUE);
                        DrawCircleGradient(screenWidth/4, 220 + 240, 60, GREEN, SKYBLUE);
                        DrawCircleLines(screenWidth/4, 340 + 240, 80, DARKBLUE);

                        DrawRectangle(screenWidth/4*2 - 110, 100 + 180, 220, 100, LIME);
                        DrawRectangleGradient(screenWidth/4*2 - 90, 170 + 240, 180, 130, MAROON, GOLD);
                        DrawRectangleLines(screenWidth/4*2 - 80, 320 + 240, 160, 80, ORANGE);

                        DrawTriangle((Vector2){screenWidth/4*3, 60 + 220}, (Vector2){screenWidth/4*3 - 60, 160 + 220}, (Vector2){screenWidth/4*3 + 60, 160 + 220}, VIOLET);

                        DrawTriangleLines((Vector2){screenWidth/4*3, 140 + 220}, (Vector2){screenWidth/4*3 - 60, 210 + 260}, (Vector2){screenWidth/4*3 + 60, 210 + 260}, SKYBLUE);

                        DrawPoly((Vector2){screenWidth/4*3, 320 + 240}, 6, 80, 0, BROWN);

                    } break;
                    case TEXTURES:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x60815aff));
                    
                        DrawTextEx(fontRomulus, "Load Images and Textures", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x60815aff));
                        DrawTextEx(fontRomulus, "Draw Textures", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x60815aff));

                        DrawRectangle(138, 348, 260, 260, GRAY);
                        DrawTexturePro(lena, (Rectangle){ 0, 0, lena.width, lena.height }, (Rectangle){ 140 + 128, 350 + 128, lena.width/2*scaleFactor, lena.height/2*scaleFactor }, (Vector2){ lena.width/4*scaleFactor, lena.height/4*scaleFactor }, 0.0f, WHITE);

                        DrawTexture(lena, 600, 180, Fade(WHITE, 0.3f));
                        DrawTextureRec(lena, (Rectangle){ 225, 240, 155, 50 }, (Vector2){ 600 + 256 - 82 + 50, 180 + 241 }, PINK);

                        DrawTexturePro(mandrill, (Rectangle){ 0, 0, mandrill.width, mandrill.height }, (Rectangle){ screenWidth/2 - 40, 350 + 128, mandrill.width/2, mandrill.height/2 },
                                        (Vector2){ mandrill.width/4, mandrill.height/4 }, framesCounter, GOLD);

                    } break;
                    case TEXT:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x377764ff));
                    
                        DrawTextEx(fontRomulus, "Load SpriteFonts", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));
                        DrawTextEx(fontRomulus, "Draw Text", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));
                        DrawTextEx(fontRomulus, "Text Formatting", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x377764ff));

                        DrawTexture(texAlagard, 60, 360, WHITE);

                        DrawTextEx(fontMechaC, msg1, (Vector2){ 540 + 168, 210 }, GetFontBaseSize(fontMechaC), -3, WHITE);
                        DrawTextEx(fontAlagardC, msg2, (Vector2){ 460 + 140, 260 }, GetFontBaseSize(fontAlagardC), -2, WHITE);
                        DrawTextEx(fontJupiterC, msg3, (Vector2){ 640 + 70, 300 }, GetFontBaseSize(fontJupiterC), 2, WHITE);

                        DrawTextEx(fontAlagard, "It also includes some...", (Vector2){ 650 + 70, 400 }, GetFontBaseSize(fontAlagard)*2, 2, MAROON);
                        DrawTextEx(fontPixelplay, "...free fonts in rBMF format...", (Vector2){ 705 - 26, 450 }, GetFontBaseSize(fontPixelplay)*2, 4, ORANGE);
                        DrawTextEx(fontMecha, "...to be used even in...", (Vector2){ 700 + 40, 500 }, GetFontBaseSize(fontMecha)*2, 4, DARKGREEN);
                        DrawTextEx(fontSetback, "...comercial projects...", (Vector2){ 710, 550 }, GetFontBaseSize(fontSetback)*2, 4, DARKBLUE);
                        DrawTextEx(fontRomulus, "...completely for free!", (Vector2){ 710 + 17, 600 }, GetFontBaseSize(fontRomulus)*2, 3, DARKPURPLE);
                        
                        DrawText("This is a custom font spritesheet, raylib can load it automatically!", 228, 360 + 295, 10, GRAY);

                    } break;
                    case MODELS:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x417794ff));
                        
                        DrawTextEx(fontRomulus, "Draw Geometric Models", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));
                        DrawTextEx(fontRomulus, "Load 3D Models", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));
                        DrawTextEx(fontRomulus, "Draw 3D Models", (Vector2){ 48, 290 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x417794ff));

                        Begin3dMode(camera);

                            DrawCube((Vector3){-4, 0, 2}, 2, 5, 2, RED);
                            DrawCubeWires((Vector3){-4, 0, 2}, 2, 5, 2, GOLD);
                            DrawCubeWires((Vector3){-4, 0, -2}, 3, 6, 2, MAROON);

                            DrawSphere((Vector3){-1, 0, -2}, 1, GREEN);
                            DrawSphereWires((Vector3){1, 0, 2}, 2, 16, 16, LIME);

                            DrawCylinder((Vector3){4, 0, -2}, 1, 2, 3, 4, SKYBLUE);
                            DrawCylinderWires((Vector3){4, 0, -2}, 1, 2, 3, 4, DARKBLUE);
                            DrawCylinderWires((Vector3){4.5, -1, 2}, 1, 1, 2, 6, BROWN);

                            DrawCylinder((Vector3){1, 0, -4}, 0, 1.5, 3, 8, GOLD);
                            DrawCylinderWires((Vector3){1, 0, -4}, 0, 1.5, 3, 8, PINK);

                            DrawModelEx(cat, (Vector3){ 8.0f, 0.0f, 2.0f }, (Vector3){ 0.0f, 0.5f*framesCounter, 0.0f }, (Vector3){ 0.1f, 0.1f, 0.1f }, WHITE);
                            DrawGizmo((Vector3){ 8.0f, 0.0f, 2.0f });

                            DrawGrid(10.0, 1.0);        // Draw a grid

                        End3dMode();

                        DrawFPS(900, 220);

                    } break;
                    case AUDIO:
                    {
                        DrawText("This module give you functions to:", 48, 200, 10, GetColor(0x8c7539ff));
                        
                        DrawTextEx(fontRomulus, "Load and Play Sounds", (Vector2){ 48, 230 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x8c7539ff));
                        DrawTextEx(fontRomulus, "Play Music (streaming)", (Vector2){ 48, 260 }, GetFontBaseSize(fontRomulus)*2, 4, GetColor(0x8c7539ff));

                        DrawText("PRESS SPACE to START PLAYING MUSIC", 135, 350, 20, GRAY);
                        DrawRectangle(150, 390, 400, 12, LIGHTGRAY);
                        DrawRectangle(150, 390, (int)timePlayed, 12, MAROON);

                        if (MusicIsPlaying())
                        {
                            DrawText("PRESS 'S' to STOP PLAYING MUSIC", 165, 425, 20, GRAY);

                            for (int i = 0; i < MAX_BALLS; i++)
                            {
                                if (soundBallsActive[i]) DrawPoly(soundBallsPosition[i], 18, soundBallsRadius[i], 0.0f, Fade(soundBallsColor[i], soundBallsAlpha[i]));
                            }
                        }

                        DrawText("PRESS 'N' to PLAY a SOUND", 200, 540, 20, VIOLET);

                        if ((framesCounter/30)%2) DrawText("PRESS ENTER to CONTINUE", 930, 650, 20, GRAY);

                    } break;
                    default: break;
                }

                // Draw modules menu
                DrawRectangle(128 + 40 + 30, 128 + 40 - 70 - 8, 150, 70, GetColor(0x898888ff));
                DrawRectangle(128 + 40 + 30 + 8, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xe1e1e1ff));
                DrawText("CORE", 128 + 40 + 30 + 8 + 38, 128 + 40 - 50, 20, GetColor(0x5c5a5aff));

                DrawRectangle(128 + 40 + 30 + 175, 128 + 40 - 70 - 8, 150, 70, GetColor(0xe66666ff));
                DrawRectangle(128 + 40 + 30 + 8 + 175, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xf0d6d6ff));
                DrawText("SHAPES", 128 + 40 + 30 + 8 + 175 + 28, 128 + 40 - 50, 20, GetColor(0xcd5757ff));

                DrawRectangle(128 + 40 + 30 + 175*2, 128 + 40 - 70 - 8, 150, 70, GetColor(0x75a06dff));
                DrawRectangle(128 + 40 + 30 + 8 + 175*2, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xc8eabfff));
                DrawText("TEXTURES", 128 + 40 + 30 + 175*2 + 8 + 9, 128 + 40 - 50, 20, GetColor(0x60815aff));

                DrawRectangle(128 + 40 + 30 + 175*3, 128 + 40 - 70 - 8, 150, 70, GetColor(0x52b296ff));
                DrawRectangle(128 + 40 + 30 + 8 + 175*3, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xbef0ddff));
                DrawText("TEXT", 128 + 40 + 30 + 8 + 175*3 + 38, 128 + 40 - 50, 20, GetColor(0x377764ff));

                DrawRectangle(128 + 40 + 30 + 175*4, 128 + 40 - 70 - 8, 150, 70, GetColor(0x5d9cbdff));
                DrawRectangle(128 + 40 + 30 + 8 + 175*4, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xbedce8ff));
                DrawText("MODELS", 128 + 40 + 30 + 8 + 175*4 + 28, 128 + 40 - 50, 20, GetColor(0x417794ff));

                DrawRectangle(128 + 40 + 30 + 175*5, 128 + 40 - 70 - 8, 150, 70, GetColor(0xd3b157ff));
                DrawRectangle(128 + 40 + 30 + 8 + 175*5, 128 + 40 - 70, 150 - 16, 70 - 16, GetColor(0xebddaeff));
                DrawText("AUDIO", 128 + 40 + 30 + 8 + 175*5 + 36, 128 + 40 - 50, 20, GetColor(0x8c7539ff));

            } break;
            case ENDING:
            {
                // Draw ENDING screen
                DrawTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", (Vector2){ screenWidth/2 - MeasureTextEx(fontAlagard, "LEARN VIDEOGAMES PROGRAMMING", GetFontBaseSize(fontAlagard)*4, 4).x/2, 80 }, GetFontBaseSize(fontAlagard)*4, 4, MAROON);

                DrawTexture(raylibLogoA, logoPositionX, logoPositionY - 40, WHITE);

                DrawText(msgWeb, screenWidth/2 - MeasureText(msgWeb, 40)/2, 470, 40, DARKGRAY);

                if (framesCounter > 60) DrawText(msgCredits, screenWidth/2 - MeasureText(msgCredits, 30)/2, 550, 30, GRAY);

                if (framesCounter > 120) if ((framesCounter/30)%2) DrawText("PRESS ENTER to CONTINUE", screenWidth/2 - MeasureText("PRESS ENTER to CONTINUE", 20)/2, 640, 20, LIGHTGRAY);

            } break;
            case PONG:
            {
                // Pong
                DrawCircleV(pongBallPosition, 10, LIGHTGRAY);
                DrawRectangleRec(pongPlayerRec, GRAY);
                DrawRectangleRec(pongEnemyRec, GRAY);

                DrawText(FormatText("%02i", pongScorePlayer), 150, 10, 80, LIGHTGRAY);
                DrawText(FormatText("%02i", pongScoreEnemy), screenWidth - MeasureText("00", 80) - 150, 10, 80, LIGHTGRAY);

                if (pongPaused) if ((framesCounter/30)%2) DrawText("GAME PAUSED [P]", screenWidth/2 - 100, 40, 20, MAROON);
            } break;
            default: break;
        }

        if (currentScreen != LOADING) DrawRectangle(0, screenHeight - 10, ((float)timeCounter/(float)totalTime)*screenWidth, 10, LIGHTGRAY);

        if (onTransition) DrawTransition();

    EndDrawing();
    //----------------------------------------------------------------------------------
}
Esempio n. 11
0
//--------------------------
// DrawMagnet
//--------------------------
void DrawMagnet(int yoke_color=Magnet_color, int coil_color=Magnet_color)
{
	// Yoke
	int N = 0;
	double z[50], r[50];
	z[N] =   0.000; r[N++] =   89.540;
	z[N] =   0.000; r[N++] =  147.320;
	z[N] =  53.820; r[N++] =  147.320;
	z[N] =  53.820; r[N++] =  150.500;
	z[N] =  56.200; r[N++] =  150.500;
	z[N] =  56.200; r[N++] =  154.940;
	z[N] =  60.960; r[N++] =  154.940;
	z[N] =  60.960; r[N++] =  147.320;
	z[N] = 187.800; r[N++] =  147.320;
	z[N] = 187.800; r[N++] =  150.500;
	z[N] = 190.180; r[N++] =  150.500;
	z[N] = 190.180; r[N++] =  154.940;
	z[N] = 194.950; r[N++] =  154.940;
	z[N] = 194.950; r[N++] =  147.320;
	z[N] = 264.000; r[N++] =  147.320;
	z[N] = 264.000; r[N++] =  150.500;
	z[N] = 266.380; r[N++] =  150.500;
	z[N] = 266.380; r[N++] =  154.940;
	z[N] = 271.150; r[N++] =  154.940;
	z[N] = 271.150; r[N++] =  147.320;
	z[N] = 340.200; r[N++] =  147.320;
	z[N] = 340.200; r[N++] =  150.500;
	z[N] = 342.580; r[N++] =  150.500;
	z[N] = 342.580; r[N++] =  154.940;
	z[N] = 347.350; r[N++] =  154.940;
	z[N] = 347.350; r[N++] =  147.320;
	z[N] = 354.970; r[N++] =  147.320;
	z[N] = 354.970; r[N++] =   92.710;
	z[N] = 428.630; r[N++] =   92.710;
	z[N] = 428.630; r[N++] =  187.960;
	z[N] = -50.800; r[N++] =  187.960;
	z[N] = -50.800; r[N++] =   89.540;
	z[N] =   0.000; r[N++] =   89.540;
	DrawPoly(N, z, r, yoke_color);
	 
	// Baffles
	N = 0;
	z[N] =   76.200; r[N++] =  147.320;
	z[N] =   76.200; r[N++] =   92.710;
	z[N] =   84.460; r[N++] =   92.710;
	z[N] =   84.460; r[N++] =  147.320;
	z[N] =   76.200; r[N++] =  147.320;
	DrawPoly(N, z, r, yoke_color);

	N = 0;
	z[N] =  202.570; r[N++] =  147.320;
	z[N] =  202.570; r[N++] =   92.710;
	z[N] =  210.190; r[N++] =   92.710;
	z[N] =  210.190; r[N++] =  147.320;
	z[N] =  202.570; r[N++] =  147.320;
	DrawPoly(N, z, r, yoke_color);

	// Coils
	//&reg mat=1, cur= 432000.0; ; Coil 1A 
	N = 0;
	z[N] =   92.853; r[N++] =  101.881;
	z[N] =  104.548; r[N++] =  101.881;
	z[N] =  104.548; r[N++] =  116.952;
	z[N] =   92.853; r[N++] =  116.952;
	z[N] =   92.853; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 414000.0; ; Coil 1B 
	N = 0;
	z[N] =  104.548; r[N++] =  101.881;
	z[N] =  116.511; r[N++] =  101.881;
	z[N] =  116.511; r[N++] =  116.320;
	z[N] =  104.548; r[N++] =  116.320;
	z[N] =  104.548; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 180000.0; ; Coil 1C 
	N = 0;
	z[N] =  124.961; r[N++] =  101.881;
	z[N] =  132.679; r[N++] =  101.881;
	z[N] =  132.679; r[N++] =  111.263;
	z[N] =  124.961; r[N++] =  111.263;
	z[N] =  124.961; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 120000.0; ; Coil 1D 
	N = 0;
	z[N] =  140.845; r[N++] =  101.881;
	z[N] =  148.563; r[N++] =  101.881;
	z[N] =  148.563; r[N++] =  108.607;
	z[N] =  140.845; r[N++] =  108.607;
	z[N] =  140.845; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 324000.0; ; Coil 1E 
	N = 0;
	z[N] =  156.729; r[N++] =  101.881;
	z[N] =  168.423; r[N++] =  101.881;
	z[N] =  168.423; r[N++] =  113.159;
	z[N] =  156.729; r[N++] =  113.159;
	z[N] =  156.729; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 324000.0; ; Coil 1F 
	N = 0;
	z[N] =  172.416; r[N++] =  101.881;
	z[N] =  180.134; r[N++] =  101.881;
	z[N] =  180.134; r[N++] =  118.849;
	z[N] =  172.416; r[N++] =  118.849;
	z[N] =  172.416; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 348000.0; ; Coil 1G 
	N = 0;
	z[N] =  180.134; r[N++] =  101.881;
	z[N] =  188.087; r[N++] =  101.881;
	z[N] =  188.087; r[N++] =  120.113;
	z[N] =  180.134; r[N++] =  120.113;
	z[N] =  180.134; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 468000.0; ; Coil 2A 
	N = 0;
	z[N] =    7.256; r[N++] =  101.881;
	z[N] =   18.950; r[N++] =  101.881;
	z[N] =   18.950; r[N++] =  118.217;
	z[N] =    7.256; r[N++] =  118.217;
	z[N] =    7.256; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 204000.0; ; Coil 2B 
	N = 0;
	z[N] =   22.124; r[N++] =  101.881;
	z[N] =   29.842; r[N++] =  101.881;
	z[N] =   29.842; r[N++] =  112.527;
	z[N] =   22.124; r[N++] =  112.527;
	z[N] =   22.124; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 324000.0; ; Coil 2C 
	N = 0;
	z[N] =   29.842; r[N++] =  101.881;
	z[N] =   41.772; r[N++] =  101.881;
	z[N] =   41.772; r[N++] =  112.527;
	z[N] =   29.842; r[N++] =  112.527;
	z[N] =   29.842; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 396000.0; ; Coil 2D 
	N = 0;
	z[N] =   42.007; r[N++] =  101.881;
	z[N] =   53.702; r[N++] =  101.881;
	z[N] =   53.702; r[N++] =  115.688;
	z[N] =   42.007; r[N++] =  115.688;
	z[N] =   42.007; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 468000.0; ; Coil 3A 
	N = 0;
	z[N] =  217.441; r[N++] =  101.881;
	z[N] =  229.135; r[N++] =  101.881;
	z[N] =  229.135; r[N++] =  118.217;
	z[N] =  217.441; r[N++] =  118.217;
	z[N] =  217.441; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 306000.0; ; Coil 3B 
	N = 0;
	z[N] =  232.309; r[N++] =  101.881;
	z[N] =  244.003; r[N++] =  101.881;
	z[N] =  244.003; r[N++] =  112.527;
	z[N] =  232.309; r[N++] =  112.527;
	z[N] =  232.309; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 192000.0; ; Coil 3C 
	N = 0;
	z[N] =  244.003; r[N++] =  101.881;
	z[N] =  251.957; r[N++] =  101.881;
	z[N] =  251.957; r[N++] =  112.527;
	z[N] =  244.003; r[N++] =  112.527;
	z[N] =  244.003; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 198000.0; ; Coil 3D 
	N = 0;
	z[N] =  251.957; r[N++] =  101.881;
	z[N] =  263.887; r[N++] =  101.881;
	z[N] =  263.887; r[N++] =  108.734;
	z[N] =  251.957; r[N++] =  108.734;
	z[N] =  251.957; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur= 324000.0; ; Coil 4A/B 
	N = 0;
	z[N] =  293.929; r[N++] =  101.881;
	z[N] =  305.623; r[N++] =  101.881;
	z[N] =  305.623; r[N++] =  113.159;
	z[N] =  293.929; r[N++] =  113.159;
	z[N] =  293.929; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	//&reg mat=1, cur=1890000.0; ; Coil 4C/D 
	N = 0;
	z[N] =  310.709; r[N++] =  101.881;
	z[N] =  340.299; r[N++] =  101.881;
	z[N] =  340.299; r[N++] =  128.331;
	z[N] =  310.709; r[N++] =  128.331;
	z[N] =  310.709; r[N++] =  101.881;
	DrawPoly(N, z, r, coil_color);

	// Label
	TLatex *lab_hi = new TLatex(-48.0, 180.0, "solenoid");
	lab_hi->SetTextAlign(12);
	lab_hi->SetTextSize(0.03);
	lab_hi->SetTextColor(coil_color);
	lab_hi->Draw();

}
Esempio n. 12
0
// Draw a color-filled circle
void DrawCircle(int centerX, int centerY, float radius, Color color)
{
    DrawPoly((Vector2){ centerX, centerY }, 36, radius, 0, color);
}
Esempio n. 13
0
File: poly.cpp Progetto: paud/d2x-xl
void CMineView::InterpModelData(UINT8 *p) 
{
	assert(p);
	assert(gModel.polys);

	while (W(p) != OP_EOF) {
		switch (W(p)) {
			// Point Definitions with Start Offset:
			// 2  UINT16      n_points       number of points
			// 4  UINT16      start_point    starting point
			// 6  UINT16      unknown
			// 8  VMS_VECTOR  pts[n_points]  x,y,z data
			case OP_DEFP_START: {
				pt0 = W(p+4);
				n_points = W(p+2);
				gModel.n_points += n_points;
				assert(W(p+6)==0);
				assert(gModel.n_points < MAX_POLY_MODEL_POINTS);
				assert(pt0+n_points < MAX_POLY_MODEL_POINTS);
				for (pt=0;pt< n_points;pt++) {
					gModel.points[pt+pt0].x = VP(p+8)[pt].x + gOffset.x;
					gModel.points[pt+pt0].y = VP(p+8)[pt].y + gOffset.y;
					gModel.points[pt+pt0].z = VP(p+8)[pt].z + gOffset.z;
				}
				SetModelPoints(pt0,pt0+n_points);
				p += W(p+2)*sizeof(VMS_VECTOR) + 8;
				break;
			}
			// Flat Shaded Polygon:
			// 2  UINT16     n_verts
			// 4  VMS_VECTOR vector1
			// 16 VMS_VECTOR vector2
			// 28 UINT16     color
			// 30 UINT16     verts[n_verts]
			case OP_FLATPOLY: {
				panel = &gModel.polys[gModel.n_polys];
				panel->n_verts = W(p+2);
				panel->offset   = *VP(p+4);
				panel->normal   = *VP(p+16);
				for (pt=0;pt<panel->n_verts;pt++) {
					panel->verts[pt] = WP(p+30)[pt];
				}
				assert(panel->n_verts>=MIN_POLY_POINTS);
				assert(panel->n_verts<=MAX_POLY_POINTS);
				assert(gModel.n_polys < MAX_POLYS);
				DrawPoly(panel);
				p += 30 + ((panel->n_verts&~1)+1)*2;
				break;
			}
			// Texture Mapped Polygon:
			// 2  UINT16     n_verts
			// 4  VMS_VECTOR vector1
			// 16 VMS_VECTOR vector2
			// 28 UINT16     nBaseTex
			// 30 UINT16     verts[n_verts]
			// -- UVL        uvls[n_verts]
			case OP_TMAPPOLY: {
				panel = &gModel.polys[gModel.n_polys];
				panel->n_verts  = W(p+2);
				assert(panel->n_verts>=MIN_POLY_POINTS);
				assert(panel->n_verts<=MAX_POLY_POINTS);
				assert(gModel.n_polys < MAX_POLYS);
				panel->offset   = *VP(p+4);
				panel->normal   = *VP(p+16);
				panel->color    = -1;
				panel->nBaseTex = W(p+28);
				panel->glow_num = glow_num;
				for (pt=0;pt<panel->n_verts;pt++) {
					panel->verts[pt] = WP(p+30)[pt];
				}
				p += 30 + ((panel->n_verts&~1)+1)*2;
				DrawPoly(panel);
				p += panel->n_verts * 12;
				break;
			}
			// Sort by Normal
			// 2  UINT16      unknown
			// 4  VMS_VECTOR  Front Model normal
			// 16 VMS_VECTOR  Back Model normal
			// 28 UINT16      Front Model Offset
			// 30 UINT16      Back Model Offset
			case OP_SORTNORM: {
				/* = W(p+2); */
				/* = W(p+4); */
				/* = W(p+16); */
				assert(W(p+2)==0);
				assert(W(p+28)>0);
				assert(W(p+30)>0);
				if ( m_matrix.CheckNormal(gpObject, VP(p+4),VP(p+16)) ) {
				  InterpModelData(p + W(p+28));
				  InterpModelData(p + W(p+30));
				} else {
				  InterpModelData(p + W(p+30));
				  InterpModelData(p + W(p+28));
				}
				p += 32;
				break;
			}
			// Call a Sub Object
			// 2  UINT16     n_anims
			// 4  VMS_VECTOR offset
			// 16 UINT16     model offset
			case OP_SUBCALL: {
				assert(W(p+16)>0);
				/* = VP(p+4) */
				gOffset.x += VP(p+4)->x;
				gOffset.y += VP(p+4)->y;
				gOffset.z += VP(p+4)->z;
				InterpModelData(p + W(p+16));
				gOffset.x -= VP(p+4)->x;
				gOffset.y -= VP(p+4)->y;
				gOffset.z -= VP(p+4)->z;
				p += 20;
				break;
			}
			// Glow Number for Next Poly
			// 2 UINTW  Glow_Value
			case OP_GLOW: {
				glow_num = W(p+2);
				p += 4;
				break;
			}
			default: {
				assert(0);
			}
		}
	}
	return;
}