-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change replaces physfs with miniphysfs to reduce the dependency tree and simplify the build.
- Loading branch information
Showing
17 changed files
with
26,011 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
Test: | ||
|
||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install Dependencies | ||
run: sudo apt-get install xorg-dev libglu1-mesa-dev | ||
|
||
- name: Configure | ||
run: cmake -B build . | ||
|
||
- name: Build | ||
run: cmake --build build | ||
|
||
- name: Test | ||
run: ./build/test/raylib-physfs-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
project (raylib-physfs | ||
VERSION 4.0.0 | ||
VERSION 4.0.1 | ||
DESCRIPTION "raylib-physfs" | ||
HOMEPAGE_URL "https://github.com/robloach/raylib-physfs" | ||
LANGUAGES C) | ||
LANGUAGES C | ||
) | ||
|
||
# Include Directory | ||
add_subdirectory(include) | ||
|
||
# Static Library | ||
option(BUILD_RAYLIB_PHYSFS_LIB "Library" ON) | ||
if(BUILD_RAYLIB_PHYSFS_LIB) | ||
add_subdirectory(lib) | ||
endif() | ||
|
||
# Examples | ||
option(BUILD_RAYLIB_PHYSFS_EXAMPLES "Examples" ON) | ||
if(BUILD_RAYLIB_PHYSFS_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
# Testing | ||
include(CTest) | ||
enable_testing() | ||
if(BUILD_TESTING AND BUILD_RAYLIB_PHYSFS_EXAMPLES) | ||
set(CTEST_CUSTOM_TESTS_IGNORE | ||
pkg-config--static | ||
) | ||
add_subdirectory(test) | ||
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) | ||
include(CTest) | ||
enable_testing() | ||
if(BUILD_TESTING AND BUILD_RAYLIB_PHYSFS_LIB) | ||
add_subdirectory(test) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#version 100 | ||
|
||
precision mediump float; | ||
|
||
// Input vertex attributes (from vertex shader) | ||
varying vec2 fragTexCoord; | ||
varying vec4 fragColor; | ||
|
||
// Input uniform values | ||
uniform sampler2D texture0; | ||
uniform vec4 colDiffuse; | ||
|
||
uniform float secondes; | ||
|
||
uniform vec2 size; | ||
|
||
uniform float freqX; | ||
uniform float freqY; | ||
uniform float ampX; | ||
uniform float ampY; | ||
uniform float speedX; | ||
uniform float speedY; | ||
|
||
void main() { | ||
float pixelWidth = 1.0 / size.x; | ||
float pixelHeight = 1.0 / size.y; | ||
float aspect = pixelHeight / pixelWidth; | ||
float boxLeft = 0.0; | ||
float boxTop = 0.0; | ||
|
||
vec2 p = fragTexCoord; | ||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth; | ||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight; | ||
|
||
gl_FragColor = texture2D(texture0, p)*colDiffuse*fragColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#version 330 | ||
|
||
// Input vertex attributes (from vertex shader) | ||
in vec2 fragTexCoord; | ||
in vec4 fragColor; | ||
|
||
// Input uniform values | ||
uniform sampler2D texture0; | ||
uniform vec4 colDiffuse; | ||
|
||
// Output fragment color | ||
out vec4 finalColor; | ||
|
||
uniform float secondes; | ||
|
||
uniform vec2 size; | ||
|
||
uniform float freqX; | ||
uniform float freqY; | ||
uniform float ampX; | ||
uniform float ampY; | ||
uniform float speedX; | ||
uniform float speedY; | ||
|
||
void main() { | ||
float pixelWidth = 1.0 / size.x; | ||
float pixelHeight = 1.0 / size.y; | ||
float aspect = pixelHeight / pixelWidth; | ||
float boxLeft = 0.0; | ||
float boxTop = 0.0; | ||
|
||
vec2 p = fragTexCoord; | ||
p.x += cos((fragTexCoord.y - boxTop) * freqX / ( pixelWidth * 750.0) + (secondes * speedX)) * ampX * pixelWidth; | ||
p.y += sin((fragTexCoord.x - boxLeft) * freqY * aspect / ( pixelHeight * 750.0) + (secondes * speedY)) * ampY * pixelHeight; | ||
|
||
finalColor = texture(texture0, p)*colDiffuse*fragColor; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
/******************************************************************************************* | ||
* | ||
* raylib [shaders] example - Texture Waves | ||
* | ||
* NOTE: This example requires raylib OpenGL 3.3 or ES2 versions for shaders support, | ||
* OpenGL 1.1 does not support shaders, recompile raylib to OpenGL 3.3 version. | ||
* | ||
* NOTE: Shaders used in this example are #version 330 (OpenGL 3.3), to test this example | ||
* on OpenGL ES 2.0 platforms (Android, Raspberry Pi, HTML5), use #version 100 shaders | ||
* raylib comes with shaders ready for both versions, check raylib/shaders install folder | ||
* | ||
* This example has been created using raylib 2.5 (www.raylib.com) | ||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) | ||
* | ||
* Example contributed by Anata (@anatagawa) and reviewed by Ramon Santamaria (@raysan5) | ||
* | ||
* Copyright (c) 2019 Anata (@anatagawa) and Ramon Santamaria (@raysan5) | ||
* | ||
********************************************************************************************/ | ||
|
||
#include "raylib.h" | ||
|
||
#define RAYLIB_PHYSFS_IMPLEMENTATION | ||
#include "raylib-physfs.h" | ||
|
||
#if defined(PLATFORM_DESKTOP) | ||
#define GLSL_VERSION 330 | ||
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB | ||
#define GLSL_VERSION 100 | ||
#endif | ||
|
||
int main(void) | ||
{ | ||
// Initialization | ||
//-------------------------------------------------------------------------------------- | ||
const int screenWidth = 800; | ||
const int screenHeight = 450; | ||
|
||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture waves"); | ||
|
||
// Initialize the file system, and mount a directory. | ||
InitPhysFS(); | ||
MountPhysFS("resources", "res"); | ||
|
||
// Load texture texture to apply shaders | ||
Texture2D texture = LoadTextureFromPhysFS("res/space.png"); | ||
|
||
// Load shader and setup location points and values | ||
Shader shader = LoadShaderFromPhysFS(0, TextFormat("res/shaders/glsl%i/wave.fs", GLSL_VERSION)); | ||
|
||
int secondsLoc = GetShaderLocation(shader, "secondes"); | ||
int freqXLoc = GetShaderLocation(shader, "freqX"); | ||
int freqYLoc = GetShaderLocation(shader, "freqY"); | ||
int ampXLoc = GetShaderLocation(shader, "ampX"); | ||
int ampYLoc = GetShaderLocation(shader, "ampY"); | ||
int speedXLoc = GetShaderLocation(shader, "speedX"); | ||
int speedYLoc = GetShaderLocation(shader, "speedY"); | ||
|
||
// Shader uniform values that can be updated at any time | ||
float freqX = 25.0f; | ||
float freqY = 25.0f; | ||
float ampX = 5.0f; | ||
float ampY = 5.0f; | ||
float speedX = 8.0f; | ||
float speedY = 8.0f; | ||
|
||
float screenSize[2] = { (float)GetScreenWidth(), (float)GetScreenHeight() }; | ||
SetShaderValue(shader, GetShaderLocation(shader, "size"), &screenSize, SHADER_UNIFORM_VEC2); | ||
SetShaderValue(shader, freqXLoc, &freqX, SHADER_UNIFORM_FLOAT); | ||
SetShaderValue(shader, freqYLoc, &freqY, SHADER_UNIFORM_FLOAT); | ||
SetShaderValue(shader, ampXLoc, &X, SHADER_UNIFORM_FLOAT); | ||
SetShaderValue(shader, ampYLoc, &Y, SHADER_UNIFORM_FLOAT); | ||
SetShaderValue(shader, speedXLoc, &speedX, SHADER_UNIFORM_FLOAT); | ||
SetShaderValue(shader, speedYLoc, &speedY, SHADER_UNIFORM_FLOAT); | ||
|
||
float seconds = 0.0f; | ||
|
||
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 | ||
//---------------------------------------------------------------------------------- | ||
seconds += GetFrameTime(); | ||
|
||
SetShaderValue(shader, secondsLoc, &seconds, SHADER_UNIFORM_FLOAT); | ||
//---------------------------------------------------------------------------------- | ||
|
||
// Draw | ||
//---------------------------------------------------------------------------------- | ||
BeginDrawing(); | ||
|
||
ClearBackground(RAYWHITE); | ||
|
||
BeginShaderMode(shader); | ||
|
||
DrawTexture(texture, 0, 0, WHITE); | ||
DrawTexture(texture, texture.width, 0, WHITE); | ||
|
||
EndShaderMode(); | ||
|
||
EndDrawing(); | ||
//---------------------------------------------------------------------------------- | ||
} | ||
|
||
// De-Initialization | ||
//-------------------------------------------------------------------------------------- | ||
UnloadShader(shader); // Unload shader | ||
UnloadTexture(texture); // Unload texture | ||
|
||
CloseWindow(); // Close window and OpenGL context | ||
//-------------------------------------------------------------------------------------- | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.