Browse Source

Delete some old data...

- Removed raylib_demo (outdated)
- Removed some old examples
pull/262/head
Ray 8 years ago
parent
commit
99c226b344
63 changed files with 0 additions and 6553 deletions
  1. +0
    -158
      examples/others/font_selector.c
  2. +0
    -244
      examples/others/image_formats_loading.c
  3. BIN
      examples/others/resources/formats/sonic.png
  4. BIN
      examples/others/resources/formats/sonic_A1R5G5B5.dds
  5. BIN
      examples/others/resources/formats/sonic_A4R4G4B4.dds
  6. BIN
      examples/others/resources/formats/sonic_A8R8G8B8.dds
  7. BIN
      examples/others/resources/formats/sonic_ASTC_4x4_ldr.astc
  8. BIN
      examples/others/resources/formats/sonic_ASTC_8x8_ldr.astc
  9. BIN
      examples/others/resources/formats/sonic_DXT1_RGB.dds
  10. BIN
      examples/others/resources/formats/sonic_DXT1_RGBA.dds
  11. BIN
      examples/others/resources/formats/sonic_DXT3_RGBA.dds
  12. BIN
      examples/others/resources/formats/sonic_DXT5_RGBA.dds
  13. BIN
      examples/others/resources/formats/sonic_ETC1_RGB.ktx
  14. BIN
      examples/others/resources/formats/sonic_ETC1_RGB.pkm
  15. BIN
      examples/others/resources/formats/sonic_ETC2_EAC_RGBA.ktx
  16. BIN
      examples/others/resources/formats/sonic_ETC2_EAC_RGBA.old.pkm
  17. BIN
      examples/others/resources/formats/sonic_ETC2_EAC_RGBA.pkm
  18. BIN
      examples/others/resources/formats/sonic_ETC2_RGB.ktx
  19. BIN
      examples/others/resources/formats/sonic_ETC2_RGB.pkm
  20. BIN
      examples/others/resources/formats/sonic_GRAYSCALE.pvr
  21. BIN
      examples/others/resources/formats/sonic_L8A8.pvr
  22. BIN
      examples/others/resources/formats/sonic_PVRT_RGB.pvr
  23. BIN
      examples/others/resources/formats/sonic_PVRT_RGBA.pvr
  24. BIN
      examples/others/resources/formats/sonic_PVRT_RGBA_2bpp.pvr
  25. BIN
      examples/others/resources/formats/sonic_PVRT_RGB_2bpp.pvr
  26. BIN
      examples/others/resources/formats/sonic_R4G4B4A4.pvr
  27. BIN
      examples/others/resources/formats/sonic_R5G5B5A1.pvr
  28. BIN
      examples/others/resources/formats/sonic_R5G6B5.dds
  29. BIN
      examples/others/resources/formats/sonic_R5G6B5.pvr
  30. BIN
      examples/others/resources/formats/sonic_R8G8B8.pvr
  31. BIN
      examples/others/resources/formats/sonic_R8G8B8A8.pvr
  32. BIN
      examples/others/resources/formats/sonic_R8G8B8A8.raw
  33. +0
    -286
      games/arkanoid.lua
  34. +0
    -191
      games/raylib_demo/makefile
  35. +0
    -932
      games/raylib_demo/raylib_demo.c
  36. BIN
      games/raylib_demo/resources/audio/coin.wav
  37. BIN
      games/raylib_demo/resources/audio/guitar_noodling.ogg
  38. BIN
      games/raylib_demo/resources/audio/spring.wav
  39. BIN
      games/raylib_demo/resources/audio/tanatana.ogg
  40. BIN
      games/raylib_demo/resources/audio/weird.wav
  41. +0
    -4731
      games/raylib_demo/resources/cat.obj
  42. BIN
      games/raylib_demo/resources/catsham.png
  43. BIN
      games/raylib_demo/resources/catwhite.png
  44. BIN
      games/raylib_demo/resources/fonts/alagard.rbmf
  45. BIN
      games/raylib_demo/resources/fonts/alpha_beta.rbmf
  46. BIN
      games/raylib_demo/resources/fonts/custom_alagard.png
  47. BIN
      games/raylib_demo/resources/fonts/custom_jupiter_crash.png
  48. BIN
      games/raylib_demo/resources/fonts/custom_mecha.png
  49. BIN
      games/raylib_demo/resources/fonts/jupiter_crash.rbmf
  50. BIN
      games/raylib_demo/resources/fonts/mecha.rbmf
  51. BIN
      games/raylib_demo/resources/fonts/pixantiqua.rbmf
  52. BIN
      games/raylib_demo/resources/fonts/pixelplay.rbmf
  53. BIN
      games/raylib_demo/resources/fonts/romulus.rbmf
  54. BIN
      games/raylib_demo/resources/fonts/setback.rbmf
  55. BIN
      games/raylib_demo/resources/lena.png
  56. BIN
      games/raylib_demo/resources/mandrill.png
  57. BIN
      games/raylib_demo/resources/platforms.png
  58. BIN
      games/raylib_demo/resources/raylib_logo.png
  59. BIN
      games/raylib_demo/resources/raylib_logo128x128.png
  60. BIN
      games/raylib_demo/resources/raylib_window.png
  61. BIN
      games/raylib_demo/resources/raylib_window_01.png
  62. BIN
      games/raylib_demo/resources/raylib_window_02.png
  63. BIN
      games/raylib_demo/resources/raylib_window_03.png

+ 0
- 158
examples/others/font_selector.c View File

@ -1,158 +0,0 @@
/*******************************************************************************************
*
* raylib [text] example - Font selector
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [text] example - font selector");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
SpriteFont fonts[8]; // SpriteFont array
fonts[0] = LoadSpriteFont("resources/fonts/alagard.rbmf"); // SpriteFont loading
fonts[1] = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // SpriteFont loading
fonts[2] = LoadSpriteFont("resources/fonts/mecha.rbmf"); // SpriteFont loading
fonts[3] = LoadSpriteFont("resources/fonts/setback.rbmf"); // SpriteFont loading
fonts[4] = LoadSpriteFont("resources/fonts/romulus.rbmf"); // SpriteFont loading
fonts[5] = LoadSpriteFont("resources/fonts/pixantiqua.rbmf"); // SpriteFont loading
fonts[6] = LoadSpriteFont("resources/fonts/alpha_beta.rbmf"); // SpriteFont loading
fonts[7] = LoadSpriteFont("resources/fonts/jupiter_crash.rbmf"); // SpriteFont loading
int currentFont = 0; // Selected font
Color colors[8] = { MAROON, ORANGE, DARKGREEN, DARKBLUE, DARKPURPLE, LIME, GOLD, RED };
const char fontNames[8][20] = { "[0] Alagard", "[1] PixelPlay", "[2] MECHA", "[3] Setback",
"[4] Romulus", "[5] PixAntiqua", "[6] Alpha Beta", "[7] Jupiter Crash" };
const char text[50] = "THIS is THE FONT you SELECTED!"; // Main text
Vector2 textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].baseSize*3, 1);
Vector2 mousePoint;
Color btnNextOutColor = DARKBLUE; // Button color (outside line)
Color btnNextInColor = SKYBLUE; // Button color (inside)
int framesCounter = 0; // Useful to count frames button is 'active' = clicked
int positionY = 180; // Text selector and button Y position
Rectangle btnNextRec = { 673, positionY, 109, 44 }; // Button rectangle (useful for collision)
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// Keyboard-based font selection (easy)
if (IsKeyPressed(KEY_RIGHT))
{
if (currentFont < 7) currentFont++;
}
if (IsKeyPressed(KEY_LEFT))
{
if (currentFont > 0) currentFont--;
}
if (IsKeyPressed('0')) currentFont = 0;
else if (IsKeyPressed('1')) currentFont = 1;
else if (IsKeyPressed('2')) currentFont = 2;
else if (IsKeyPressed('3')) currentFont = 3;
else if (IsKeyPressed('4')) currentFont = 4;
else if (IsKeyPressed('5')) currentFont = 5;
else if (IsKeyPressed('6')) currentFont = 6;
else if (IsKeyPressed('7')) currentFont = 7;
// Mouse-based font selection (NEXT button logic)
mousePoint = GetMousePosition();
if (CheckCollisionPointRec(mousePoint, btnNextRec))
{
// Mouse hover button logic
if (framesCounter == 0)
{
btnNextOutColor = DARKPURPLE;
btnNextInColor = PURPLE;
}
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON))
{
framesCounter = 20; // Frames button is 'active'
btnNextOutColor = MAROON;
btnNextInColor = RED;
}
}
else
{
// Mouse not hover button
btnNextOutColor = DARKBLUE;
btnNextInColor = SKYBLUE;
}
if (framesCounter > 0) framesCounter--;
if (framesCounter == 1) // We change font on frame 1
{
currentFont++;
if (currentFont > 7) currentFont = 0;
}
// Text measurement for better positioning on screen
textSize = MeasureTextEx(fonts[currentFont], text, fonts[currentFont].baseSize*3, 1);
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("font selector - use arroys, button or numbers", 160, 80, 20, DARKGRAY);
DrawLine(120, 120, 680, 120, DARKGRAY);
DrawRectangle(18, positionY, 644, 44, DARKGRAY);
DrawRectangle(20, positionY + 2, 640, 40, LIGHTGRAY);
DrawText(fontNames[currentFont], 30, positionY + 13, 20, BLACK);
DrawText("< >", 610, positionY + 8, 30, BLACK);
DrawRectangleRec(btnNextRec, btnNextOutColor);
DrawRectangle(675, positionY + 2, 105, 40, btnNextInColor);
DrawText("NEXT", 700, positionY + 13, 20, btnNextOutColor);
DrawTextEx(fonts[currentFont], text, (Vector2){ screenWidth/2 - textSize.x/2,
260 + (70 - textSize.y)/2 }, fonts[currentFont].baseSize*3,
1, colors[currentFont]);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
for (int i = 0; i < 8; i++) UnloadSpriteFont(fonts[i]); // SpriteFont(s) unloading
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

+ 0
- 244
examples/others/image_formats_loading.c View File

@ -1,244 +0,0 @@
/*******************************************************************************************
*
* raylib [textures] example - texture formats loading (compressed and uncompressed)
*
* NOTE: This example requires raylib OpenGL 3.3+ or ES2 versions for compressed textures,
* OpenGL 1.1 does not support compressed textures, only uncompressed ones.
*
* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#define NUM_TEXTURES 24
typedef enum {
PNG_R8G8B8A8 = 0,
PVR_GRAYSCALE,
PVR_GRAY_ALPHA,
PVR_R5G6B5,
PVR_R5G5B5A1,
PVR_R4G4B4A4,
DDS_R5G6B5,
DDS_R5G5B5A1,
DDS_R4G4B4A4,
DDS_R8G8B8A8,
DDS_DXT1_RGB,
DDS_DXT1_RGBA,
DDS_DXT3_RGBA,
DDS_DXT5_RGBA,
PKM_ETC1_RGB,
PKM_ETC2_RGB,
PKM_ETC2_EAC_RGBA,
KTX_ETC1_RGB,
KTX_ETC2_RGB,
KTX_ETC2_EAC_RGBA,
ASTC_4x4_LDR,
ASTC_8x8_LDR,
PVR_PVRT_RGB,
PVR_PVRT_RGBA
} TextureFormats;
static const char *formatText[] = {
"PNG_R8G8B8A8",
"PVR_GRAYSCALE",
"PVR_GRAY_ALPHA",
"PVR_R5G6B5",
"PVR_R5G5B5A1",
"PVR_R4G4B4A4",
"DDS_R5G6B5",
"DDS_R5G5B5A1",
"DDS_R4G4B4A4",
"DDS_R8G8B8A8",
"DDS_DXT1_RGB",
"DDS_DXT1_RGBA",
"DDS_DXT3_RGBA",
"DDS_DXT5_RGBA",
"PKM_ETC1_RGB",
"PKM_ETC2_RGB",
"PKM_ETC2_EAC_RGBA",
"KTX_ETC1_RGB",
"KTX_ETC2_RGB",
"KTX_ETC2_EAC_RGBA",
"ASTC_4x4_LDR",
"ASTC_8x8_LDR",
"PVR_PVRT_RGB",
"PVR_PVRT_RGBA"
};
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture formats loading");
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
Texture2D sonic[NUM_TEXTURES];
sonic[PNG_R8G8B8A8] = LoadTexture("resources/formats/sonic.png");
// Load UNCOMPRESSED PVR texture data
sonic[PVR_GRAYSCALE] = LoadTexture("resources/formats/sonic_GRAYSCALE.pvr");
sonic[PVR_GRAY_ALPHA] = LoadTexture("resources/formats/sonic_L8A8.pvr");
sonic[PVR_R5G6B5] = LoadTexture("resources/formats/sonic_R5G6B5.pvr");
sonic[PVR_R5G5B5A1] = LoadTexture("resources/formats/sonic_R5G5B5A1.pvr");
sonic[PVR_R4G4B4A4] = LoadTexture("resources/formats/sonic_R4G4B4A4.pvr");
// Load UNCOMPRESSED DDS texture data
sonic[DDS_R5G6B5] = LoadTexture("resources/formats/sonic_R5G6B5.dds");
sonic[DDS_R5G5B5A1] = LoadTexture("resources/formats/sonic_A1R5G5B5.dds");
sonic[DDS_R4G4B4A4] = LoadTexture("resources/formats/sonic_A4R4G4B4.dds");
sonic[DDS_R8G8B8A8] = LoadTexture("resources/formats/sonic_A8R8G8B8.dds");
// Load COMPRESSED DXT DDS texture data (if supported)
sonic[DDS_DXT1_RGB] = LoadTexture("resources/formats/sonic_DXT1_RGB.dds");
sonic[DDS_DXT1_RGBA] = LoadTexture("resources/formats/sonic_DXT1_RGBA.dds");
sonic[DDS_DXT3_RGBA] = LoadTexture("resources/formats/sonic_DXT3_RGBA.dds");
sonic[DDS_DXT5_RGBA] = LoadTexture("resources/formats/sonic_DXT5_RGBA.dds");
// Load COMPRESSED ETC texture data (if supported)
sonic[PKM_ETC1_RGB] = LoadTexture("resources/formats/sonic_ETC1_RGB.pkm");
sonic[PKM_ETC2_RGB] = LoadTexture("resources/formats/sonic_ETC2_RGB.pkm");
sonic[PKM_ETC2_EAC_RGBA] = LoadTexture("resources/formats/sonic_ETC2_EAC_RGBA.pkm");
sonic[KTX_ETC1_RGB] = LoadTexture("resources/formats/sonic_ETC1_RGB.ktx");
sonic[KTX_ETC2_RGB] = LoadTexture("resources/formats/sonic_ETC2_RGB.ktx");
sonic[KTX_ETC2_EAC_RGBA] = LoadTexture("resources/formats/sonic_ETC2_EAC_RGBA.ktx");
// Load COMPRESSED ASTC texture data (if supported)
sonic[ASTC_4x4_LDR] = LoadTexture("resources/formats/sonic_ASTC_4x4_ldr.astc");
sonic[ASTC_8x8_LDR] = LoadTexture("resources/formats/sonic_ASTC_8x8_ldr.astc");
// Load COMPRESSED PVR texture data (if supported)
sonic[PVR_PVRT_RGB] = LoadTexture("resources/formats/sonic_PVRT_RGB.pvr");
sonic[PVR_PVRT_RGBA] = LoadTexture("resources/formats/sonic_PVRT_RGBA.pvr");
int selectedFormat = PNG_R8G8B8A8;
Rectangle selectRecs[NUM_TEXTURES];
for (int i = 0; i < NUM_TEXTURES; i++)
{
if (i < NUM_TEXTURES/2) selectRecs[i] = (Rectangle){ 40, 30 + 32*i, 150, 30 };
else selectRecs[i] = (Rectangle){ 40 + 152, 30 + 32*(i - NUM_TEXTURES/2), 150, 30 };
}
// Texture sizes in KB
float textureSizes[NUM_TEXTURES] = {
512*512*32/8/1024, //PNG_R8G8B8A8 (32 bpp)
512*512*8/8/1024, //PVR_GRAYSCALE (8 bpp)
512*512*16/8/1024, //PVR_GRAY_ALPHA (16 bpp)
512*512*16/8/1024, //PVR_R5G6B5 (16 bpp)
512*512*16/8/1024, //PVR_R5G5B5A1 (16 bpp)
512*512*16/8/1024, //PVR_R4G4B4A4 (16 bpp)
512*512*16/8/1024, //DDS_R5G6B5 (16 bpp)
512*512*16/8/1024, //DDS_R5G5B5A1 (16 bpp)
512*512*16/8/1024, //DDS_R4G4B4A4 (16 bpp)
512*512*32/8/1024, //DDS_R8G8B8A8 (32 bpp)
512*512*4/8/1024, //DDS_DXT1_RGB (4 bpp) -Compressed-
512*512*4/8/1024, //DDS_DXT1_RGBA (4 bpp) -Compressed-
512*512*8/8/1024, //DDS_DXT3_RGBA (8 bpp) -Compressed-
512*512*8/8/1024, //DDS_DXT5_RGBA (8 bpp) -Compressed-
512*512*4/8/1024, //PKM_ETC1_RGB (4 bpp) -Compressed-
512*512*4/8/1024, //PKM_ETC2_RGB (4 bpp) -Compressed-
512*512*8/8/1024, //PKM_ETC2_EAC_RGBA (8 bpp) -Compressed-
512*512*4/8/1024, //KTX_ETC1_RGB (4 bpp) -Compressed-
512*512*4/8/1024, //KTX_ETC2_RGB (4 bpp) -Compressed-
512*512*8/8/1024, //KTX_ETC2_EAC_RGBA (8 bpp) -Compressed-
512*512*8/8/1024, //ASTC_4x4_LDR (8 bpp) -Compressed-
512*512*2/8/1024, //ASTC_8x8_LDR (2 bpp) -Compressed-
512*512*4/8/1024, //PVR_PVRT_RGB (4 bpp) -Compressed-
512*512*4/8/1024, //PVR_PVRT_RGBA (4 bpp) -Compressed-
};
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//---------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_DOWN))
{
selectedFormat++;
if (selectedFormat >= NUM_TEXTURES) selectedFormat = 0;
}
else if (IsKeyPressed(KEY_UP))
{
selectedFormat--;
if (selectedFormat < 0) selectedFormat = NUM_TEXTURES - 1;
}
else if (IsKeyPressed(KEY_RIGHT))
{
if (selectedFormat < NUM_TEXTURES/2) selectedFormat += NUM_TEXTURES/2;
}
else if (IsKeyPressed(KEY_LEFT))
{
if (selectedFormat >= NUM_TEXTURES/2) selectedFormat -= NUM_TEXTURES/2;
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
// Draw rectangles
for (int i = 0; i < NUM_TEXTURES; i++)
{
if (i == selectedFormat)
{
DrawRectangleRec(selectRecs[i], SKYBLUE);
DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, BLUE);
DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)/2, selectRecs[i].y + 11, 10, DARKBLUE);
}
else
{
DrawRectangleRec(selectRecs[i], LIGHTGRAY);
DrawRectangleLines(selectRecs[i].x, selectRecs[i].y, selectRecs[i].width, selectRecs[i].height, GRAY);
DrawText(formatText[i], selectRecs[i].x + selectRecs[i].width/2 - MeasureText(formatText[i], 10)/2, selectRecs[i].y + 11, 10, DARKGRAY);
}
}
// Draw selected texture
if (sonic[selectedFormat].id != 0)
{
DrawTexture(sonic[selectedFormat], 350, -10, WHITE);
}
else
{
DrawRectangleLines(488, 165, 200, 110, DARKGRAY);
DrawText("FORMAT", 550, 180, 20, MAROON);
DrawText("NOT SUPPORTED", 500, 210, 20, MAROON);
DrawText("ON YOUR GPU", 520, 240, 20, MAROON);
}
DrawText("Select texture format (use cursor keys):", 40, 10, 10, DARKGRAY);
DrawText("Required GPU memory size (VRAM):", 40, 427, 10, DARKGRAY);
DrawText(FormatText("%4.0f KB", textureSizes[selectedFormat]), 240, 420, 20, DARKBLUE);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(sonic[i]);
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}

BIN
examples/others/resources/formats/sonic.png View File

Before After
Width: 512  |  Height: 512  |  Size: 114 KiB

BIN
examples/others/resources/formats/sonic_A1R5G5B5.dds View File


BIN
examples/others/resources/formats/sonic_A4R4G4B4.dds View File


BIN
examples/others/resources/formats/sonic_A8R8G8B8.dds View File


BIN
examples/others/resources/formats/sonic_ASTC_4x4_ldr.astc View File


BIN
examples/others/resources/formats/sonic_ASTC_8x8_ldr.astc View File


BIN
examples/others/resources/formats/sonic_DXT1_RGB.dds View File


BIN
examples/others/resources/formats/sonic_DXT1_RGBA.dds View File


BIN
examples/others/resources/formats/sonic_DXT3_RGBA.dds View File


BIN
examples/others/resources/formats/sonic_DXT5_RGBA.dds View File


BIN
examples/others/resources/formats/sonic_ETC1_RGB.ktx View File


BIN
examples/others/resources/formats/sonic_ETC1_RGB.pkm View File


BIN
examples/others/resources/formats/sonic_ETC2_EAC_RGBA.ktx View File


BIN
examples/others/resources/formats/sonic_ETC2_EAC_RGBA.old.pkm View File


BIN
examples/others/resources/formats/sonic_ETC2_EAC_RGBA.pkm View File


BIN
examples/others/resources/formats/sonic_ETC2_RGB.ktx View File


BIN
examples/others/resources/formats/sonic_ETC2_RGB.pkm View File


BIN
examples/others/resources/formats/sonic_GRAYSCALE.pvr View File


BIN
examples/others/resources/formats/sonic_L8A8.pvr View File


BIN
examples/others/resources/formats/sonic_PVRT_RGB.pvr View File


BIN
examples/others/resources/formats/sonic_PVRT_RGBA.pvr View File


BIN
examples/others/resources/formats/sonic_PVRT_RGBA_2bpp.pvr View File


BIN
examples/others/resources/formats/sonic_PVRT_RGB_2bpp.pvr View File


BIN
examples/others/resources/formats/sonic_R4G4B4A4.pvr View File


BIN
examples/others/resources/formats/sonic_R5G5B5A1.pvr View File


BIN
examples/others/resources/formats/sonic_R5G6B5.dds View File


BIN
examples/others/resources/formats/sonic_R5G6B5.pvr View File


BIN
examples/others/resources/formats/sonic_R8G8B8.pvr View File


BIN
examples/others/resources/formats/sonic_R8G8B8A8.pvr View File


BIN
examples/others/resources/formats/sonic_R8G8B8A8.raw View File


+ 0
- 286
games/arkanoid.lua View File

@ -1,297 +0,0 @@
--[[
raylib - sample game: arkanoid
Sample game Marc Palau and Ramon Santamaria
This game has been created using raylib v1.3 (www.raylib.com)
raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
Copyright (c) 2015 Ramon Santamaria (@raysan5)
Translated to Lua by Ghassan Al-Mashareqa (ghassan@ghassan.pl)
--]]
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
PLAYER_MAX_LIFE = 5
LINES_OF_BRICKS = 5
BRICKS_PER_LINE = 20
------------------------------------------------------------------------------------
------------------------------------------------------------------------------------
GameScreen = { LOGO = 0, TITLE = 1, GAMEPLAY = 2, ENDING = 3 }
function Player()
return { position = Vector2(0,0), size = Vector2(0,0), life = 0 }
end
function Ball()
return { position = Vector2(0,0), speed = Vector2(0,0), radius = 0, active = false }
end
function Brick()
return { position = Vector2(0,0), active = false }
end
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
screenWidth = 800;
screenHeight = 450;
framesCounter = 0;
gameOver = false;
pause = false;
player = Player()
ball = Ball()
brick = {}--[LINES_OF_BRICKS][BRICKS_PER_LINE];
for i = 0, LINES_OF_BRICKS-1 do
brick[i] = {}
for j = 0, BRICKS_PER_LINE-1 do
brick[i][j] = Brick()
end
end
brickSize = Vector2(0,0)
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
function InitGame()
brickSize = Vector2(GetScreenWidth()/BRICKS_PER_LINE, 40)
-- Initialize player
player.position = Vector2(screenWidth/2, screenHeight*7/8)
player.size = Vector2(screenWidth/10, 20)
player.life = PLAYER_MAX_LIFE;
-- Initialize ball
ball.position = Vector2(screenWidth/2, screenHeight*7/8 - 30)
ball.speed = Vector2(0, 0)
ball.radius = 7;
ball.active = false;
-- Initialize bricks
local initialDownPosition = 50;
for i = 0, LINES_OF_BRICKS-1 do
for j = 0, BRICKS_PER_LINE-1 do
brick[i][j].position = Vector2(j*brickSize.x + brickSize.x/2, i*brickSize.y + initialDownPosition)
brick[i][j].active = true;
end
end
end
function UpdateGame()
if (not gameOver) then
if (IsKeyPressed(KEY.P)) then pause = not pause; end
if (not pause) then
-- Player movement
if (IsKeyDown(KEY.LEFT)) then player.position.x = player.position.x - 5; end
if ((player.position.x - player.size.x/2) <= 0) then player.position.x = player.size.x/2; end
if (IsKeyDown(KEY.RIGHT)) then player.position.x = player.position.x + 5; end
if ((player.position.x + player.size.x/2) >= screenWidth) then player.position.x = screenWidth - player.size.x/2; end
-- Launch ball
if (not ball.active) then
if (IsKeyPressed(KEY.SPACE)) then
ball.active = true;
ball.speed = Vector2(0, -5)
end
end
UpdateBall();
-- Game over logic
if (player.life <= 0) then
gameOver = true;
else
gameOver = true;
for i = 0, LINES_OF_BRICKS-1 do
for j = 0, BRICKS_PER_LINE-1 do
if (brick[i][j].active) then gameOver = false; end
end
end
end
end
else
if (IsKeyPressed(KEY.ENTER)) then
InitGame();
gameOver = false;
end
end
end
function DrawGame()
BeginDrawing();
ClearBackground(RAYWHITE);
if (not gameOver) then
-- Draw player bar
DrawRectangle(player.position.x - player.size.x/2, player.position.y - player.size.y/2, player.size.x, player.size.y, BLACK);
-- Draw player lives
for i = 0, player.life-1 do
DrawRectangle(20 + 40*i, screenHeight - 30, 35, 10, LIGHTGRAY);
end
-- Draw ball
DrawCircleV(ball.position, ball.radius, MAROON);
-- Draw bricks
for i = 0, LINES_OF_BRICKS-1 do
for j = 0, BRICKS_PER_LINE-1 do
if (brick[i][j].active) then
if ((i + j) % 2 == 0) then
DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, GRAY);
else
DrawRectangle(brick[i][j].position.x - brickSize.x/2, brick[i][j].position.y - brickSize.y/2, brickSize.x, brickSize.y, DARKGRAY);
end
end
end
end
if (pause) then
DrawText("GAME PAUSED", screenWidth/2 - MeasureText("GAME PAUSED", 40)/2, screenHeight/2 - 40, 40, GRAY);
end
else
DrawText("PRESS [ENTER] TO PLAY AGAIN", GetScreenWidth()/2 - MeasureText("PRESS [ENTER] TO PLAY AGAIN", 20)/2, GetScreenHeight()/2 - 50, 20, GRAY);
end
EndDrawing();
end
function UnloadGame()
-- TODO: Unload all dynamic loaded data (textures, sounds, models...)
end
function UpdateDrawFrame()
UpdateGame();
DrawGame();
end
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
function UpdateBall()
-- Update position
if (ball.active) then
ball.position.x = ball.position.x + ball.speed.x;
ball.position.y = ball.position.y + ball.speed.y;
else
ball.position = Vector2(player.position.x, screenHeight*7/8 - 30);
end
-- Bounce in x
if (((ball.position.x + ball.radius) >= screenWidth) or ((ball.position.x - ball.radius) <= 0))
then
ball.speed.x = ball.speed.x * -1;
end
-- Bounce in y
if ((ball.position.y - ball.radius) <= 0) then
ball.speed.y = ball.speed.y * -1;
end
-- Ball reaches bottom of the screen
if ((ball.position.y + ball.radius) >= screenHeight) then
ball.speed = Vector2(0, 0);
ball.active = false;
player.life = player.life - 1;
end
-- Collision logic: ball vs player
if CheckCollisionCircleRec(ball.position, ball.radius,
Rectangle(
player.position.x - player.size.x/2,
player.position.y - player.size.y/2,
player.size.x,
player.size.y)) then
if (ball.speed.y > 0) then
ball.speed.y = ball.speed.y * -1;
ball.speed.x = (ball.position.x - player.position.x)/(player.size.x/2)*5;
end
end
-- Collision logic: ball vs bricks
for i = 0,LINES_OF_BRICKS-1 do
for j = 0,BRICKS_PER_LINE-1 do
if (brick[i][j].active) then
-- Hit below
if (((ball.position.y - ball.radius) <= (brick[i][j].position.y + brickSize.y/2)) and
((ball.position.y - ball.radius) > (brick[i][j].position.y + brickSize.y/2 + ball.speed.y)) and
((math.abs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) and (ball.speed.y < 0))
then
brick[i][j].active = false;
ball.speed.y = ball.speed.y * -1;
-- Hit above
elseif (((ball.position.y + ball.radius) >= (brick[i][j].position.y - brickSize.y/2)) and
((ball.position.y + ball.radius) < (brick[i][j].position.y - brickSize.y/2 + ball.speed.y)) and
((math.abs(ball.position.x - brick[i][j].position.x)) < (brickSize.x/2 + ball.radius*2/3)) and (ball.speed.y > 0))
then
brick[i][j].active = false;
ball.speed.y = ball.speed.y * -1;
-- Hit left
elseif (((ball.position.x + ball.radius) >= (brick[i][j].position.x - brickSize.x/2)) and
((ball.position.x + ball.radius) < (brick[i][j].position.x - brickSize.x/2 + ball.speed.x)) and
((math.abs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) and (ball.speed.x > 0))
then
brick[i][j].active = false;
ball.speed.x = ball.speed.x * -1;
-- Hit right
elseif (((ball.position.x - ball.radius) <= (brick[i][j].position.x + brickSize.x/2)) and
((ball.position.x - ball.radius) > (brick[i][j].position.x + brickSize.x/2 + ball.speed.x)) and
((math.abs(ball.position.y - brick[i][j].position.y)) < (brickSize.y/2 + ball.radius*2/3)) and (ball.speed.x < 0))
then
brick[i][j].active = false;
ball.speed.x = ball.speed.x * -1;
end
end
end
end
end
InitWindow(screenWidth, screenHeight, "sample game: arkanoid");
InitGame();
SetTargetFPS(60);
----------------------------------------------------------------------------------------
while (not WindowShouldClose()) -- Detect window close button or ESC key
do
-- Update
------------------------------------------------------------------------------------
UpdateGame();
------------------------------------------------------------------------------------
-- Draw
------------------------------------------------------------------------------------
DrawGame();
------------------------------------------------------------------------------------
end
UnloadGame(); -- Unload loaded data (textures, sounds, models...)
CloseWindow(); -- Close window and OpenGL context

+ 0
- 191
games/raylib_demo/makefile View File

@ -1,191 +0,0 @@
#**************************************************************************************************
#
# raylib - Basic Game
#
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten)
#
# Copyright (c) 2014 Ramon Santamaria (@raysan5)
#
# This software is provided "as-is", without any express or implied warranty. In no event
# will the authors be held liable for any damages arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose, including commercial
# applications, and to alter it and redistribute it freely, subject to the following restrictions:
#
# 1. The origin of this software must not be misrepresented; you must not claim that you
# wrote the original software. If you use this software in a product, an acknowledgment
# in the product documentation would be appreciated but is not required.
#
# 2. Altered source versions must be plainly marked as such, and must not be misrepresented
# as being the original software.
#
# 3. This notice may not be removed or altered from any source distribution.
#
#**************************************************************************************************
# define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
ifeq ($(OS),Windows_NT)
PLATFORM_OS=WINDOWS
LIBPATH=win32
else
UNAMEOS:=$(shell uname)
ifeq ($(UNAMEOS),Linux)
PLATFORM_OS=LINUX
LIBPATH=linux
else
ifeq ($(UNAMEOS),Darwin)
PLATFORM_OS=OSX
LIBPATH=osx
endif
endif
endif
endif
# define compiler: gcc for C program, define as g++ for C++
ifeq ($(PLATFORM),PLATFORM_WEB)
# define emscripten compiler
CC = emcc
else
ifeq ($(PLATFORM_OS),OSX)
# define llvm compiler for mac
CC = clang
else
# define default gcc compiler
CC = gcc
endif
endif
# define compiler flags:
# -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings
# -std=c99 use standard C from 1999 revision
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline
else
CFLAGS = -O2 -Wall -std=c99
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources --shell-file ../../templates/web_shell/shell.html
#-s ASSERTIONS=1 # to check for memory allocation errors (-O1 disables it)
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else
INCLUDES = -I. -I../../src
# external libraries headers
# GLFW3
INCLUDES += -I../../external/glfw3/include
# GLEW - Not required any more, replaced by GLAD
#INCLUDES += -I../external/glew/include
# OpenAL Soft
INCLUDES += -I../../external/openal_soft/include
endif
# define library paths containing required libs
ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib
else
LFLAGS = -L. -L../../src -LC:/raylib/raylib/src
# external libraries to link with
# GLFW3
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH)
ifneq ($(PLATFORM_OS),OSX)
# OpenAL Soft
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH)
# GLEW: Not used, replaced by GLAD
#LFLAGS += -L../../external/glew/lib/$(LIBPATH)
endif
endif
# define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl
# on XWindow could require also below libraries, just uncomment
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else
ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling
# requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa
else
# libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
# libraries for Raspberry Pi compiling
# NOTE: OpenAL Soft library should be installed (libopenal1 package)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
# NOTE: Set the correct path to libraylib.bc
LIBS = ../../src/libraylib.bc
endif
# define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources -Wl,--subsystem,windows
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html
endif
# typing 'make' will invoke the first target entry in the file,
# in this case, the 'default' target entry is qidv_raylib
default: raylib_demo
# compile raylib demo
raylib_demo: raylib_demo.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS)
# clean everything
clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete
rm -f *.o
else
ifeq ($(PLATFORM_OS),LINUX)
find -type f -executable | xargs file -i | grep -E 'x-object|x-archive|x-sharedlib|x-executable' | rev | cut -d ':' -f 2- | rev | xargs rm -f
else
del *.o *.exe
endif
endif
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete
rm -f *.o
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
del *.o *.html *.js
endif
@echo Cleaning done
# instead of defining every module one by one, we can define a pattern
# this pattern below will automatically compile every module defined on $(OBJS)
#%.exe : %.c
# $(CC) -o $@ $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM)

+ 0
- 932
games/raylib_demo/raylib_demo.c View File

@ -1,932 +0,0 @@
/*******************************************************************************************
*
* raylib - Features demo 01 (Learn Videogames Programming)
*
* This show has been created using raylib v1.4 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
#if defined(PLATFORM_WEB)
#include <emscripten/emscripten.h>
#endif
#include <string.h>
#include <math.h>
#define MAX_BALLS 16
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
typedef enum TalkScreen { LOADING, LOGO, MODULES, ENDING, PONG } TalkScreen;
typedef enum Modules { CORE = 0, SHAPES, TEXTURES, TEXT, MODELS, AUDIO } Modules;
//----------------------------------------------------------------------------------
// Global Variables Definition (local to this module)
//----------------------------------------------------------------------------------
int screenWidth = 1280;
int screenHeight = 720;
const char msgLoading[30] = "LOADING...";
const char msgPressEnter[30] = "Press ENTER to START";
const char msgCredits[40] = "by RAMON SANTAMARIA [@raysan5]";
const char msgWeb[30] = "www.raylib.com";
const char msgLogoA[40] = "A simple and easy-to-use library";
const char msgLogoB[40] = "to learn videogames programming";
const char msg1[50] = "THIS is a CUSTOM FONT...";
const char msg2[50] = "...and ANOTHER CUSTOM ONE...";
const char msg3[50] = "...AND ONE MORE! :)";
bool closeWindow = false;
int totalTime = 60*60*60; // fps*sec*min
int timeCounter = 0;
TalkScreen currentScreen = LOADING;
// LOADING screen variables
int loadBarWidth = 0;
int loadBarMaxWidth = 600;
// TITLE screen variables
SpriteFont fontAlagard;
SpriteFont fontPixelplay;
SpriteFont fontMecha;
SpriteFont fontSetback;
SpriteFont fontRomulus;
Vector2 pongBallPosition;
Vector2 pongBallSpeed;
Rectangle pongPlayerRec;
Rectangle pongEnemyRec;
int pongScorePlayer = 0;
int pongScoreEnemy = 0;
bool pongAutoMode = true;
int pongAutoCounter = 0;
bool pongPaused = true;
int lettersCounter = 0;
char msgBuffer[120] = { ' ' };
// LOGO screen variables
int logoPositionX;
int logoPositionY;
int raylibLettersCount = 0;
int topSideRecWidth = 16;
int leftSideRecHeight = 16;
int bottomSideRecWidth = 16;
int rightSideRecHeight = 16;
char raylib[8] = " \0"; // raylib text array, max 8 letters
int logoScreenState = 0; // Tracking animation states (State Machine)
bool msgLogoADone = false;
bool msgLogoBDone = false;
// MODULES screen variables
Modules selectedModule = CORE;
Texture2D raylibWindow;
Texture2D raylibWindow01;
Texture2D raylibWindow02;
Texture2D raylibWindow03;
Texture2D platforms;
Texture2D raylibLogoB;
Texture2D lena;
Texture2D mandrill;
Texture2D texAlagard;
SpriteFont fontMechaC;
SpriteFont fontAlagardC;
SpriteFont fontJupiterC;
int coreWindow = 1;
int windowOffset = 0;
Vector2 ballPosition;
Camera camera;
Texture2D catTexture;
Model cat;
Sound fxWav;
Sound fxOgg;
Music music;
Vector2 soundBallsPosition[MAX_BALLS];
Color soundBallsColor[MAX_BALLS];
bool soundBallsActive[MAX_BALLS];
float soundBallsAlpha[MAX_BALLS];
int soundBallsRadius[MAX_BALLS];
float scaleFactor = 0.0f;
float timePlayed = 0;
// ENDING screen variables
Texture2D raylibLogoA;
// Required variables to manage screen transitions (fade-in, fade-out)
float transAlpha = 0;
bool onTransition = false;
bool transFadeOut = false;
int transFromScreen = -1;
int transToScreen = -1;
int framesCounter = 0;
//----------------------------------------------------------------------------------
// Local Functions Declaration
//----------------------------------------------------------------------------------
void TransitionToScreen(int screen);
void UpdateTransition(void);
void DrawTransition(void);
void UpdateDrawOneFrame(void);
//----------------------------------------------------------------------------------
// Main entry point
//----------------------------------------------------------------------------------
int main()
{
// Initialization
//--------------------------------------------------------------------------------------
const char windowTitle[30] = "raylib functionality demo";
//SetupFlags(FLAG_FULLSCREEN_MODE);
InitWindow(screenWidth, screenHeight, windowTitle);
InitAudioDevice(); // Initialize audio device
// TITLE screen variables Initialization
fontAlagard = LoadSpriteFont("resources/fonts/alagard.rbmf"); // rBMF font loading
fontPixelplay = LoadSpriteFont("resources/fonts/pixelplay.rbmf"); // rBMF font loading
fontMecha = LoadSpriteFont("resources/fonts/mecha.rbmf"); // rBMF font loading
fontSetback = LoadSpriteFont("resources/fonts/setback.rbmf"); // rBMF font loading
fontRomulus = LoadSpriteFont("resources/fonts/romulus.rbmf"); // rBMF font loading
pongBallPosition = (Vector2){ screenWidth/2, screenHeight/2 + 20 };
pongBallSpeed = (Vector2){ 6, 6 };
pongPlayerRec = (Rectangle){ 20, screenHeight/2 - 50 + 40, 20, 100 };
pongEnemyRec = (Rectangle){ screenWidth - 40, screenHeight/2 - 60, 20, 120 };
// LOGO screen variables Initialization
logoPositionX = screenWidth/2 - 128;
logoPositionY = screenHeight/2 - 128;
// MODULES screen variables Initialization
raylibWindow = LoadTexture("resources/raylib_window.png");
raylibWindow01 = LoadTexture("resources/raylib_window_01.png");
raylibWindow02 = LoadTexture("resources/raylib_window_02.png");
raylibWindow03 = LoadTexture("resources/raylib_window_03.png");
platforms = LoadTexture("resources/platforms.png");
raylibLogoB = LoadTexture("resources/raylib_logo128x128.png");
lena = LoadTexture("resources/lena.png");
mandrill = LoadTexture("resources/mandrill.png");
texAlagard = LoadTexture("resources/fonts/custom_alagard.png");
fontMechaC = LoadSpriteFont("resources/fonts/custom_mecha.png");
fontAlagardC = LoadSpriteFont("resources/fonts/custom_alagard.png");
fontJupiterC = LoadSpriteFont("resources/fonts/custom_jupiter_crash.png");
ballPosition = (Vector2){ 520 + 656/2, 220 + 399/2 };
camera = (Camera){{ 0.0, 12.0, 15.0 }, { 0.0, 3.0, 0.0 }, { 0.0, 1.0, 0.0 }};
catTexture = LoadTexture("resources/catsham.png"); // Load model texture
cat = LoadModel("resources/cat.obj"); // Load OBJ model
cat.material.texDiffuse = catTexture; // Set cat model diffuse texture
fxWav = LoadSound("resources/audio/weird.wav"); // Load WAV audio file
fxOgg = LoadSound("resources/audio/tanatana.ogg"); // Load OGG audio file
music = LoadMusicStream("resources/audio/guitar_noodling.ogg"); // Load music
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;
}
// ENDING screen variables Initialization
raylibLogoA = LoadTexture("resources/raylib_logo.png");
#ifndef PLATFORM_WEB
SetTargetFPS(60);
#endif
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawOneFrame, 0, 1);
#else
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose() && !closeWindow) // Detect window close button or ESC key
{
UpdateDrawOneFrame();
}
#endif
// De-Initialization
//--------------------------------------------------------------------------------------
// Unload all loaded data (textures, fonts, audio)
UnloadSpriteFont(fontAlagard); // SpriteFont unloading
UnloadSpriteFont(fontPixelplay); // SpriteFont unloading
UnloadSpriteFont(fontMecha); // SpriteFont unloading
UnloadSpriteFont(fontSetback); // SpriteFont unloading
UnloadSpriteFont(fontRomulus); // SpriteFont unloading
UnloadTexture(raylibWindow);
UnloadTexture(raylibWindow01);
UnloadTexture(raylibWindow02);
UnloadTexture(raylibWindow03);
UnloadTexture(platforms);
UnloadTexture(raylibLogoA);
UnloadTexture(raylibLogoB);
UnloadTexture(lena);
UnloadTexture(mandrill);
UnloadTexture(texAlagard);
UnloadSpriteFont(fontMechaC);
UnloadSpriteFont(fontAlagardC);
UnloadSpriteFont(fontJupiterC);
UnloadTexture(catTexture);
UnloadModel(cat);
UnloadSound(fxWav);
UnloadSound(fxOgg);
UnloadMusicStream(music);
CloseAudioDevice();
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
void TransitionToScreen(int screen)
{
onTransition = true;
transFromScreen = currentScreen;
transToScreen = screen;
}
void UpdateTransition(void)
{
if (!transFadeOut)
{
transAlpha += 0.02f;
if (transAlpha >= 1.0)
{
transAlpha = 1.0;
currentScreen = transToScreen;
transFadeOut = true;
framesCounter = 0;
}
}
else // Transition fade out logic
{
transAlpha -= 0.02f;
if (transAlpha <= 0)
{
transAlpha = 0;
transFadeOut = false;
onTransition = false;
transFromScreen = -1;
transToScreen = -1;
}
}
}
void DrawTransition(void)
{
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha));
}
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) && !IsMusicPlaying(music)) PlayMusicStream(music); // Play music stream
if (IsKeyPressed('S'))
{
StopMusicStream(music);
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 (IsMusicPlaying(music))
{
UpdateMusicStream(music);
timePlayed = GetMusicTimePlayed(music)/GetMusicTimeLength(music)*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 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Drawing Area", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Inputs", (Vector2){ 48, 290 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Manage Timming", (Vector2){ 48, 320 }, fontRomulus.baseSize*2, 4, GetColor(0x5c5a5aff));
DrawTextEx(fontRomulus, "Auxiliar Functions", (Vector2){ 48, 350 }, fontRomulus.baseSize*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 }, fontMecha.baseSize, 2, BLACK);
DrawTextEx(fontMecha, "[ W A S D ]", (Vector2){ ballPosition.x - 36, ballPosition.y }, fontMecha.baseSize, 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 }, fontRomulus.baseSize*2, 4, GetColor(0xcd5757ff));
DrawTextEx(fontRomulus, "Basic Collision Detection", (Vector2){ 48, 260 }, fontRomulus.baseSize*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 }, fontRomulus.baseSize*2, 4, GetColor(0x60815aff));
DrawTextEx(fontRomulus, "Draw Textures", (Vector2){ 48, 260 }, fontRomulus.baseSize*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 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
DrawTextEx(fontRomulus, "Draw Text", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
DrawTextEx(fontRomulus, "Text Formatting", (Vector2){ 48, 290 }, fontRomulus.baseSize*2, 4, GetColor(0x377764ff));
DrawTexture(texAlagard, 60, 360, WHITE);
DrawTextEx(fontMechaC, msg1, (Vector2){ 540 + 168, 210 }, fontMechaC.baseSize, -3, WHITE);
DrawTextEx(fontAlagardC, msg2, (Vector2){ 460 + 140, 260 }, fontAlagardC.baseSize, -2, WHITE);
DrawTextEx(fontJupiterC, msg3, (Vector2){ 640 + 70, 300 }, fontJupiterC.baseSize, 2, WHITE);
DrawTextEx(fontAlagard, "It also includes some...", (Vector2){ 650 + 70, 400 }, fontAlagard.baseSize*2, 2, MAROON);
DrawTextEx(fontPixelplay, "...free fonts in rBMF format...", (Vector2){ 705 - 26, 450 }, fontPixelplay.baseSize*2, 4, ORANGE);
DrawTextEx(fontMecha, "...to be used even in...", (Vector2){ 700 + 40, 500 }, fontMecha.baseSize*2, 4, DARKGREEN);
DrawTextEx(fontSetback, "...commercial projects...", (Vector2){ 710, 550 }, fontSetback.baseSize*2, 4, DARKBLUE);
DrawTextEx(fontRomulus, "...completely for free!", (Vector2){ 710 + 17, 600 }, fontRomulus.baseSize*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 }, fontRomulus.baseSize*2, 4, GetColor(0x417794ff));
DrawTextEx(fontRomulus, "Load 3D Models", (Vector2){ 48, 260 }, fontRomulus.baseSize*2, 4, GetColor(0x417794ff));
DrawTextEx(fontRomulus, "Draw 3D Models", (Vector2){ 48, 290 }, fontRomulus.baseSize*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, 1.0f, 0.0f }, 0.5f*framesCounter, (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 }, fontRomulus.baseSize*2, 4, GetColor(0x8c7539ff));
DrawTextEx(fontRomulus, "Play Music (streaming)", (Vector2){ 48, 260 }, fontRomulus.baseSize*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 (IsMusicPlaying(music))
{
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", fontAlagard.baseSize*4, 4).x/2, 80 }, fontAlagard.baseSize*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();
//----------------------------------------------------------------------------------
}

BIN
games/raylib_demo/resources/audio/coin.wav View File


BIN
games/raylib_demo/resources/audio/guitar_noodling.ogg View File


BIN
games/raylib_demo/resources/audio/spring.wav View File


BIN
games/raylib_demo/resources/audio/tanatana.ogg View File


BIN
games/raylib_demo/resources/audio/weird.wav View File


+ 0
- 4731
games/raylib_demo/resources/cat.obj
File diff suppressed because it is too large
View File


BIN
games/raylib_demo/resources/catsham.png View File

Before After
Width: 512  |  Height: 512  |  Size: 308 KiB

BIN
games/raylib_demo/resources/catwhite.png View File

Before After
Width: 512  |  Height: 512  |  Size: 302 KiB

BIN
games/raylib_demo/resources/fonts/alagard.rbmf View File


BIN
games/raylib_demo/resources/fonts/alpha_beta.rbmf View File


BIN
games/raylib_demo/resources/fonts/custom_alagard.png View File

Before After
Width: 512  |  Height: 284  |  Size: 37 KiB

BIN
games/raylib_demo/resources/fonts/custom_jupiter_crash.png View File

Before After
Width: 426  |  Height: 284  |  Size: 23 KiB

BIN
games/raylib_demo/resources/fonts/custom_mecha.png View File

Before After
Width: 446  |  Height: 284  |  Size: 26 KiB

BIN
games/raylib_demo/resources/fonts/jupiter_crash.rbmf View File


BIN
games/raylib_demo/resources/fonts/mecha.rbmf View File


BIN
games/raylib_demo/resources/fonts/pixantiqua.rbmf View File


BIN
games/raylib_demo/resources/fonts/pixelplay.rbmf View File


BIN
games/raylib_demo/resources/fonts/romulus.rbmf View File


BIN
games/raylib_demo/resources/fonts/setback.rbmf View File


BIN
games/raylib_demo/resources/lena.png View File

Before After
Width: 512  |  Height: 512  |  Size: 463 KiB

BIN
games/raylib_demo/resources/mandrill.png View File

Before After
Width: 512  |  Height: 512  |  Size: 613 KiB

BIN
games/raylib_demo/resources/platforms.png View File

Before After
Width: 360  |  Height: 300  |  Size: 41 KiB

BIN
games/raylib_demo/resources/raylib_logo.png View File

Before After
Width: 256  |  Height: 256  |  Size: 3.7 KiB

BIN
games/raylib_demo/resources/raylib_logo128x128.png View File

Before After
Width: 128  |  Height: 128  |  Size: 1.8 KiB

BIN
games/raylib_demo/resources/raylib_window.png View File

Before After
Width: 1024  |  Height: 512  |  Size: 4.6 KiB

BIN
games/raylib_demo/resources/raylib_window_01.png View File

Before After
Width: 200  |  Height: 138  |  Size: 2.0 KiB

BIN
games/raylib_demo/resources/raylib_window_02.png View File

Before After
Width: 200  |  Height: 138  |  Size: 3.0 KiB

BIN
games/raylib_demo/resources/raylib_window_03.png View File

Before After
Width: 200  |  Height: 138  |  Size: 3.0 KiB

Loading…
Cancel
Save