summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2022-01-21 20:50:55 -0500
committerrealtradam <[email protected]>2022-01-21 20:50:55 -0500
commit253d04b86952b021370eec7957784719900cb3ef (patch)
treeafcf9ec96bcf6aac297ff58a7d97126c49f42e6a
parent7e10d9b61c9341acc63e4bd135db05f0cafccc00 (diff)
downloadFelFlameEngine-253d04b86952b021370eec7957784719900cb3ef.tar.gz
FelFlameEngine-253d04b86952b021370eec7957784719900cb3ef.zip
added blend mode
-rw-r--r--game/assets/hollow.pngbin0 -> 1977 bytes
-rw-r--r--game/main.rb42
m---------raylib0
-rw-r--r--vendor/include/raylib/raudio.h3
-rw-r--r--vendor/include/raylib/raylib.h7
-rw-r--r--vendor/include/raylib/raymath.h15
-rw-r--r--vendor/include/raylib/rlgl.h87
-rw-r--r--vendor/lib/tux/mruby/libmruby.abin8576116 -> 8577692 bytes
-rw-r--r--vendor/lib/tux/raylib/libraylib.abin2519508 -> 2520054 bytes
-rw-r--r--vendor/lib/web/mruby/libmruby.abin1448662 -> 1449104 bytes
-rw-r--r--vendor/lib/web/raylib/libraylib.abin1035342 -> 1034962 bytes
11 files changed, 102 insertions, 52 deletions
diff --git a/game/assets/hollow.png b/game/assets/hollow.png
new file mode 100644
index 0000000..d488010
--- /dev/null
+++ b/game/assets/hollow.png
Binary files differ
diff --git a/game/main.rb b/game/main.rb
index 709a91a..f8731fd 100644
--- a/game/main.rb
+++ b/game/main.rb
@@ -2,13 +2,13 @@ text = "Our poggies game engine :^)"
Rl.init_window(600, 600, text)
puts 'init audio device'
-Rl.init_audio_device
+#Rl.init_audio_device
puts 'it was init\'ed'
Rl.target_fps = 60
color = Rl::Color.new(200,50,50,255)
white = Rl::Color.new(255,255,255,255)
-color2 = Rl::Color.new(200,15,15,255)
+black = Rl::Color.new(0,0,0,255)
rect1 = Rl::Rectangle.new(50,50,10,10)
rect2 = Rl::Rectangle.new(100,50,10,10)
@@ -30,6 +30,7 @@ puts "false: #{circ1.collide_with_circle? circ2}" # no
puts "true: #{circ1.collide_with_circle? circ1}" # ya
pause_champ = Rl::Texture.new("./assets/PauseChamp.png")
+hollow = Rl::Texture.new("./assets/hollow.png")
puts "#{pause_champ.w} #{pause_champ.h}"
collect_this_texture = Rl::Texture.new("./assets/PauseChamp.png")
@@ -45,6 +46,7 @@ puts "A: #{a.x}"
y = 10
spaceing = 25
font_size = 30
+blend_mode = 0
Rl.while_window_open do
result_x = (Math.cos(Rl.time*2) * 100) + 250
@@ -54,18 +56,32 @@ Rl.while_window_open do
puts Rl.keys_pressed.to_s
end
- Rl.draw(clear_color: white) do
-
- Rl.scissor_mode(x: Rl.mouse_x - 50, y: Rl.mouse_y - 50, width: 100, height: 100) do
- if Rl.mouse_button_up? 0
- # Draw moving pausechamp face
- Rl.draw_texture(
- texture: pause_champ,
- x: result_x - 100,
- y: result_y + 200 - 140
- )
- end
+ if Rl.mouse_button_pressed? 0
+ puts "Blend Mode: #{blend_mode += 1}"
+ end
+
+ Rl.draw(clear_color: black) do
+
+ #Rl.scissor_mode(x: Rl.mouse_x - 50, y: Rl.mouse_y - 50, width: 100, height: 100) do
+ if Rl.mouse_button_up? 0
+ # Draw moving pausechamp face
+ Rl.draw_texture(
+ texture: pause_champ,
+ x: result_x - 100,
+ y: result_y + 200 - 140
+ )
end
+ # end
+
+ Rl.begin_blend_mode(blend_mode)
+ Rl.draw_texture(
+ texture: hollow,
+ x: Rl.mouse_x - 50,
+ y: Rl.mouse_y - 50,
+ tint: white
+ )
+
+ Rl.end_blend_mode
if Rl.key_down? 72
pause_champ.w += 10
diff --git a/raylib b/raylib
-Subproject a134b8bc6dd7e2d819609e3b1cd75a23db0ae12
+Subproject 40af6543d73ec7246eff61de0832b7f4dcd6836
diff --git a/vendor/include/raylib/raudio.h b/vendor/include/raylib/raudio.h
index dbcfbd6..35c850b 100644
--- a/vendor/include/raylib/raudio.h
+++ b/vendor/include/raylib/raudio.h
@@ -155,6 +155,7 @@ int GetSoundsPlaying(void); // Get number of
bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
+void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.0 to 1.0, 0.5=center)
void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
Wave WaveCopy(Wave wave); // Copy a wave to a new wave
void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
@@ -173,6 +174,7 @@ void PauseMusicStream(Music music); // Pause music p
void ResumeMusicStream(Music music); // Resume playing paused music
void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
+void SetMusicPan(Music sound, float pan); // Set pan for a music (0.0 to 1.0, 0.5=center)
void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
float GetMusicTimeLength(Music music); // Get music time length (in seconds)
float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
@@ -189,6 +191,7 @@ bool IsAudioStreamPlaying(AudioStream stream); // Check if audi
void StopAudioStream(AudioStream stream); // Stop audio stream
void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
+void SetAudioStreamPan(AudioStream strean, float pan); // Set pan for audio stream (0.0 to 1.0, 0.5=center)
void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
#ifdef __cplusplus
diff --git a/vendor/include/raylib/raylib.h b/vendor/include/raylib/raylib.h
index a2e3ea9..6c6baa7 100644
--- a/vendor/include/raylib/raylib.h
+++ b/vendor/include/raylib/raylib.h
@@ -1499,10 +1499,11 @@ RLAPI int GetSoundsPlaying(void); // Get num
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
-RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
+RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
RLAPI void WaveCrop(Wave *wave, int initSample, int finalSample); // Crop a wave to defined samples range
-RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a floats array
+RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
+RLAPI float *LoadWaveSamples(Wave wave); // Load samples data from wave as a 32bit float data array
RLAPI void UnloadWaveSamples(float *samples); // Unload samples data loaded with LoadWaveSamples()
// Music management functions
@@ -1518,6 +1519,7 @@ RLAPI void ResumeMusicStream(Music music); // Resume
RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
+RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
@@ -1533,6 +1535,7 @@ RLAPI bool IsAudioStreamPlaying(AudioStream stream); // Check i
RLAPI void StopAudioStream(AudioStream stream); // Stop audio stream
RLAPI void SetAudioStreamVolume(AudioStream stream, float volume); // Set volume for audio stream (1.0 is max level)
RLAPI void SetAudioStreamPitch(AudioStream stream, float pitch); // Set pitch for audio stream (1.0 is base level)
+RLAPI void SetAudioStreamPan(AudioStream stream, float pan); // Set pan for audio stream (0.5 is centered)
RLAPI void SetAudioStreamBufferSizeDefault(int size); // Default size for new audio streams
#if defined(__cplusplus)
diff --git a/vendor/include/raylib/raymath.h b/vendor/include/raylib/raymath.h
index 9b86b29..8a54bbc 100644
--- a/vendor/include/raylib/raymath.h
+++ b/vendor/include/raylib/raymath.h
@@ -334,6 +334,21 @@ RMAPI Vector2 Vector2Normalize(Vector2 v)
return result;
}
+// Transforms a Vector2 by a given Matrix
+RMAPI Vector2 Vector2Transform(Vector2 v, Matrix mat)
+{
+ Vector2 result = { 0 };
+
+ float x = v.x;
+ float y = v.y;
+ float z = 0;
+
+ result.x = mat.m0*x + mat.m4*y + mat.m8*z + mat.m12;
+ result.y = mat.m1*x + mat.m5*y + mat.m9*z + mat.m13;
+
+ return result;
+}
+
// Calculate linear interpolation between two vectors
RMAPI Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount)
{
diff --git a/vendor/include/raylib/rlgl.h b/vendor/include/raylib/rlgl.h
index 37af998..16f4190 100644
--- a/vendor/include/raylib/rlgl.h
+++ b/vendor/include/raylib/rlgl.h
@@ -3544,53 +3544,66 @@ unsigned int rlLoadShaderCode(const char *vsCode, const char *fsCode)
unsigned int vertexShaderId = 0;
unsigned int fragmentShaderId = 0;
+ // Compile vertex shader (if provided)
if (vsCode != NULL) vertexShaderId = rlCompileShader(vsCode, GL_VERTEX_SHADER);
- if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
-
- // Load shader program if provided vertex/fragment shaders compile successfully
- if ((vertexShaderId != 0) && (fragmentShaderId != 0)) id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);
+ // In case no vertex shader was provided or compilation failed, we use default vertex shader
+ if (vertexShaderId == 0) vertexShaderId = RLGL.State.defaultVShaderId;
- // Once shader program is compiled, we can detach and delete vertex/fragment shaders
- // NOTE: Vertex
- if (vertexShaderId != 0)
- {
- // Detach shader before deletion to make sure memory is freed
- glDetachShader(id, vertexShaderId);
- glDeleteShader(vertexShaderId);
- }
- if (fragmentShaderId != 0)
- {
- // Detach shader before deletion to make sure memory is freed
- glDetachShader(id, fragmentShaderId);
- glDeleteShader(fragmentShaderId);
- }
+ // Compile fragment shader (if provided)
+ if (fsCode != NULL) fragmentShaderId = rlCompileShader(fsCode, GL_FRAGMENT_SHADER);
+ // In case no fragment shader was provided or compilation failed, we use default fragment shader
+ if (fragmentShaderId == 0) fragmentShaderId = RLGL.State.defaultFShaderId;
- if (id == 0)
- {
- // In case shader loading fails, we return the default shader
- TRACELOG(RL_LOG_WARNING, "SHADER: Failed to load custom shader code, using default shader");
- id = RLGL.State.defaultShaderId;
- }
+ // In case vertex and fragment shader are the default ones, no need to recompile, we can just assign the default shader program id
+ if ((vertexShaderId == RLGL.State.defaultVShaderId) && (fragmentShaderId == RLGL.State.defaultFShaderId)) id = RLGL.State.defaultShaderId;
else
{
- // Get available shader uniforms
- // NOTE: This information is useful for debug...
- int uniformCount = -1;
- glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &uniformCount);
+ // One of or both shader are new, we need to compile a new shader program
+ id = rlLoadShaderProgram(vertexShaderId, fragmentShaderId);
- for (int i = 0; i < uniformCount; i++)
+ // We can detach and delete vertex/fragment shaders (if not default ones)
+ // NOTE: We detach shader before deletion to make sure memory is freed
+ if (vertexShaderId != RLGL.State.defaultVShaderId)
{
- int namelen = -1;
- int num = -1;
- char name[256] = { 0 }; // Assume no variable names longer than 256
- GLenum type = GL_ZERO;
+ glDetachShader(id, vertexShaderId);
+ glDeleteShader(vertexShaderId);
+ }
+ if (fragmentShaderId != RLGL.State.defaultFShaderId)
+ {
+ glDetachShader(id, fragmentShaderId);
+ glDeleteShader(fragmentShaderId);
+ }
+
+ // In case shader program loading failed, we assign default shader
+ if (id == 0)
+ {
+ // In case shader loading fails, we return the default shader
+ TRACELOG(RL_LOG_WARNING, "SHADER: Failed to load custom shader code, using default shader");
+ id = RLGL.State.defaultShaderId;
+ }
+ /*
+ else
+ {
+ // Get available shader uniforms
+ // NOTE: This information is useful for debug...
+ int uniformCount = -1;
+ glGetProgramiv(id, GL_ACTIVE_UNIFORMS, &uniformCount);
- // Get the name of the uniforms
- glGetActiveUniform(id, i, sizeof(name) - 1, &namelen, &num, &type, name);
+ for (int i = 0; i < uniformCount; i++)
+ {
+ int namelen = -1;
+ int num = -1;
+ char name[256] = { 0 }; // Assume no variable names longer than 256
+ GLenum type = GL_ZERO;
- name[namelen] = 0;
- TRACELOGD("SHADER: [ID %i] Active uniform (%s) set at location: %i", id, name, glGetUniformLocation(id, name));
+ // Get the name of the uniforms
+ glGetActiveUniform(id, i, sizeof(name) - 1, &namelen, &num, &type, name);
+
+ name[namelen] = 0;
+ TRACELOGD("SHADER: [ID %i] Active uniform (%s) set at location: %i", id, name, glGetUniformLocation(id, name));
+ }
}
+ */
}
#endif
diff --git a/vendor/lib/tux/mruby/libmruby.a b/vendor/lib/tux/mruby/libmruby.a
index 88f14d9..ed0414b 100644
--- a/vendor/lib/tux/mruby/libmruby.a
+++ b/vendor/lib/tux/mruby/libmruby.a
Binary files differ
diff --git a/vendor/lib/tux/raylib/libraylib.a b/vendor/lib/tux/raylib/libraylib.a
index 546e4ad..b86a37f 100644
--- a/vendor/lib/tux/raylib/libraylib.a
+++ b/vendor/lib/tux/raylib/libraylib.a
Binary files differ
diff --git a/vendor/lib/web/mruby/libmruby.a b/vendor/lib/web/mruby/libmruby.a
index c491465..2680589 100644
--- a/vendor/lib/web/mruby/libmruby.a
+++ b/vendor/lib/web/mruby/libmruby.a
Binary files differ
diff --git a/vendor/lib/web/raylib/libraylib.a b/vendor/lib/web/raylib/libraylib.a
index 975cf28..03e18dd 100644
--- a/vendor/lib/web/raylib/libraylib.a
+++ b/vendor/lib/web/raylib/libraylib.a
Binary files differ