Remove trail spaces
This commit is contained in:
parent
f92ee46d86
commit
dcf52c132f
61 changed files with 565 additions and 565 deletions
|
@ -107,7 +107,7 @@ int main(void)
|
|||
InitWindow(screenWidth, screenHeight, "raylib [easings] example - easings testbed");
|
||||
|
||||
Vector2 ballPosition = { 100.0f, 200.0f };
|
||||
|
||||
|
||||
float t = 0.0f; // Current time (in any unit measure, but same unit as duration)
|
||||
float d = 300.0f; // Total time it should take to complete (duration)
|
||||
bool paused = true;
|
||||
|
|
|
@ -28,7 +28,7 @@ int main(void)
|
|||
InitAudioDevice(); // Initialize audio device
|
||||
|
||||
// Loaded in CPU memory (RAM) from header file (audio_data.h)
|
||||
// Same as: Wave wave = LoadWave("sound.wav");
|
||||
// Same as: Wave wave = LoadWave("sound.wav");
|
||||
Wave wave = {
|
||||
.data = AUDIO_DATA,
|
||||
.sampleCount = AUDIO_SAMPLE_COUNT,
|
||||
|
@ -39,14 +39,14 @@ int main(void)
|
|||
|
||||
// Wave converted to Sound to be played
|
||||
Sound sound = LoadSoundFromWave(wave);
|
||||
|
||||
|
||||
// With a Wave loaded from file, after Sound is loaded, we can unload Wave
|
||||
// but in our case, Wave is embedded in executable, in program .data segment
|
||||
// we can not (and should not) try to free that private memory region
|
||||
//UnloadWave(wave); // Do not unload wave data!
|
||||
|
||||
// Loaded in CPU memory (RAM) from header file (image_data.h)
|
||||
// Same as: Image image = LoadImage("raylib_logo.png");
|
||||
// Same as: Image image = LoadImage("raylib_logo.png");
|
||||
Image image = {
|
||||
.data = IMAGE_DATA,
|
||||
.width = IMAGE_WIDTH,
|
||||
|
@ -54,15 +54,15 @@ int main(void)
|
|||
.format = IMAGE_FORMAT,
|
||||
.mipmaps = 1
|
||||
};
|
||||
|
||||
|
||||
// Image converted to Texture (VRAM) to be drawn
|
||||
Texture2D texture = LoadTextureFromImage(image);
|
||||
|
||||
Texture2D texture = LoadTextureFromImage(image);
|
||||
|
||||
// With an Image loaded from file, after Texture is loaded, we can unload Image
|
||||
// but in our case, Image is embedded in executable, in program .data segment
|
||||
// we can not (and should not) try to free that private memory region
|
||||
//UnloadImage(image); // Do not unload image data!
|
||||
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* This example has been created using raylib 2ad3eb1 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Stephan Soller (@arkanis - http://arkanis.de/)
|
||||
* Example contributed by Stephan Soller (@arkanis - http://arkanis.de/)
|
||||
* and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2021 Stephan Soller (@arkanis) and Ramon Santamaria (@raysan5)
|
||||
|
@ -14,10 +14,10 @@
|
|||
*
|
||||
* Mixes raylib and plain OpenGL code to draw a GL_POINTS based particle system. The
|
||||
* primary point is to demonstrate raylib and OpenGL interop.
|
||||
*
|
||||
*
|
||||
* rlgl batched draw operations internally so we have to flush the current batch before
|
||||
* doing our own OpenGL work (rlDrawRenderBatchActive()).
|
||||
*
|
||||
*
|
||||
* The example also demonstrates how to get the current model view projection matrix of
|
||||
* raylib. That way raylib cameras and so on work as expected.
|
||||
*
|
||||
|
@ -39,15 +39,15 @@ int main()
|
|||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib - point particles");
|
||||
|
||||
|
||||
Shader shader = LoadShader(
|
||||
TextFormat("resources/shaders/glsl%i/point_particle.vs", GLSL_VERSION),
|
||||
TextFormat("resources/shaders/glsl%i/point_particle.fs", GLSL_VERSION));
|
||||
int currentTimeLoc = GetShaderLocation(shader, "currentTime");
|
||||
int colorLoc = GetShaderLocation(shader, "color");
|
||||
|
||||
|
||||
// Initialize the vertex buffer for the particles and assign each particle random values
|
||||
struct { float x, y, period; } particles[10000];
|
||||
const size_t particleCount = sizeof(particles) / sizeof(particles[0]);
|
||||
|
@ -59,7 +59,7 @@ int main()
|
|||
// every so often and you get a glimps of what is going on.
|
||||
particles[i].period = GetRandomValue(10, 30) / 10.0f;
|
||||
}
|
||||
|
||||
|
||||
// Create a plain OpenGL vertex buffer with the data and an vertex array object that feeds the data from the buffer
|
||||
// into the vertexPosition shader attribute.
|
||||
GLuint vao = 0, vbo = 0;
|
||||
|
@ -73,13 +73,13 @@ int main()
|
|||
glEnableVertexAttribArray(0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
|
||||
// Allows the vertex shader to set the point size of each particle individually
|
||||
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose()) // Detect window close button or ESC key
|
||||
{
|
||||
|
@ -87,46 +87,46 @@ int main()
|
|||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
|
||||
|
||||
DrawRectangle(10, 10, 210, 30, MAROON);
|
||||
DrawText(TextFormat("%zu particles in one vertex buffer", particleCount), 20, 20, 10, RAYWHITE);
|
||||
|
||||
|
||||
// Switch to plain OpenGL
|
||||
//------------------------------------------------------------------------------
|
||||
// rlglDraw() in raylib 3.5
|
||||
rlDrawRenderBatchActive();
|
||||
glUseProgram(shader.id);
|
||||
glUniform1f(currentTimeLoc, GetTime());
|
||||
|
||||
|
||||
Vector4 color = ColorNormalize((Color){ 255, 0, 0, 128 });
|
||||
glUniform4fv(colorLoc, 1, (float*)&color);
|
||||
|
||||
|
||||
// The the current model view projection matrix so the particle system is displayed and transformed
|
||||
// (e.g. by cameras) just like everything else.
|
||||
// GetMatrixModelview() and GetMatrixProjection() in raylib 3.5
|
||||
Matrix modelViewProjection = MatrixMultiply(rlGetMatrixModelview(), rlGetMatrixProjection());
|
||||
glUniformMatrix4fv(shader.locs[SHADER_LOC_MATRIX_MVP], 1, false, MatrixToFloat(modelViewProjection));
|
||||
|
||||
|
||||
glBindVertexArray(vao);
|
||||
glDrawArrays(GL_POINTS, 0, particleCount);
|
||||
glBindVertexArray(0);
|
||||
glUseProgram(0);
|
||||
|
||||
|
||||
// And back to raylib again
|
||||
//------------------------------------------------------------------------------
|
||||
DrawFPS(screenWidth - 100, 10);
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
glDeleteBuffers(1, &vbo);
|
||||
glDeleteVertexArrays(1, &vao);
|
||||
|
||||
|
||||
UnloadShader(shader);
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* COMPILATION:
|
||||
* gcc -o raudio_standalone.exe raudio_standalone.c ..\..\src\raudio.c /
|
||||
* -I..\..\src -I..\..\src\external -L. -Wall -std=c99 -DRAUDIO_STANDALONE /
|
||||
* -I..\..\src -I..\..\src\external -L. -Wall -std=c99 -DRAUDIO_STANDALONE /
|
||||
* -DSUPPORT_FILEFORMAT_WAV -DSUPPORT_FILEFORMAT_OGG -DSUPPORT_FILEFORMAT_MP3
|
||||
*
|
||||
* LICENSE: zlib/libpng
|
||||
|
@ -96,7 +96,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if ((key == 's') || (key == 'S')) PlaySound(fxWav);
|
||||
if ((key == 'd') || (key == 'D')) PlaySound(fxOgg);
|
||||
|
||||
|
||||
key = 0;
|
||||
|
||||
UpdateMusicStream(music);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* rlgl.h - OpenGL 1.1 immediate-mode style coding translation layer
|
||||
* glad.h - OpenGL extensions initialization library (required by rlgl)
|
||||
* raymath.h - 3D math library (required by rlgl)
|
||||
* glfw3 - Windows and context initialization library
|
||||
* glfw3 - Windows and context initialization library
|
||||
*
|
||||
* rlgl library is provided as a single-file header-only library, this library
|
||||
* allows coding in a pseudo-OpenGL 1.1 style while translating calls to multiple
|
||||
|
@ -95,18 +95,18 @@ int main(void)
|
|||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
|
||||
// GLFW3 Initialization + OpenGL 3.3 Context + Extensions
|
||||
//--------------------------------------------------------
|
||||
glfwSetErrorCallback(ErrorCallback);
|
||||
|
||||
|
||||
if (!glfwInit())
|
||||
{
|
||||
printf("GLFW3: Can not initialize GLFW\n");
|
||||
return 1;
|
||||
}
|
||||
else printf("GLFW3: GLFW initialized successfully\n");
|
||||
|
||||
|
||||
glfwWindowHint(GLFW_SAMPLES, 4);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
|
@ -117,27 +117,27 @@ int main(void)
|
|||
glfwWindowHint( GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
GLFWwindow *window = glfwCreateWindow(screenWidth, screenHeight, "rlgl standalone", NULL, NULL);
|
||||
|
||||
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
return 2;
|
||||
}
|
||||
else printf("GLFW3: Window created successfully\n");
|
||||
|
||||
|
||||
glfwSetWindowPos(window, 200, 200);
|
||||
|
||||
|
||||
glfwSetKeyCallback(window, KeyCallback);
|
||||
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
glfwSwapInterval(0);
|
||||
|
||||
|
||||
// Load OpenGL 3.3 supported extensions
|
||||
rlLoadExtensions(glfwGetProcAddress);
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
||||
// Initialize OpenGL context (states and resources)
|
||||
rlglInit(screenWidth, screenHeight);
|
||||
|
||||
|
@ -151,18 +151,18 @@ int main(void)
|
|||
|
||||
rlClearColor(245, 245, 245, 255); // Define clear color
|
||||
rlEnableDepthTest(); // Enable DEPTH_TEST for 3D
|
||||
|
||||
|
||||
Camera camera = { 0 };
|
||||
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
|
||||
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
|
||||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
|
||||
camera.fovy = 45.0f; // Camera field-of-view Y
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; // Cube default position (center)
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!glfwWindowShouldClose(window))
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; // Cube default position (center)
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -189,14 +189,14 @@ int main(void)
|
|||
// Draw internal render batch buffers (3D data)
|
||||
rlDrawRenderBatchActive();
|
||||
//-----------------------------------------------
|
||||
|
||||
|
||||
// Draw '2D' elements in the scene (GUI)
|
||||
//-----------------------------------------------
|
||||
#define RLGL_CREATE_MATRIX_MANUALLY
|
||||
#if defined(RLGL_CREATE_MATRIX_MANUALLY)
|
||||
matProj = MatrixOrtho(0.0, screenWidth, screenHeight, 0.0, 0.0, 1.0);
|
||||
matView = MatrixIdentity();
|
||||
|
||||
|
||||
rlSetMatrixModelview(matView); // Set internal modelview matrix (default shader)
|
||||
rlSetMatrixProjection(matProj); // Set internal projection matrix (default shader)
|
||||
|
||||
|
@ -213,7 +213,7 @@ int main(void)
|
|||
// Draw internal render batch buffers (3D data)
|
||||
rlDrawRenderBatchActive();
|
||||
//-----------------------------------------------
|
||||
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwPollEvents();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -222,11 +222,11 @@ int main(void)
|
|||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
rlglClose(); // Unload rlgl internal buffers and default shader/texture
|
||||
|
||||
|
||||
glfwDestroyWindow(window); // Close window
|
||||
glfwTerminate(); // Free GLFW3 resources
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue