Working in random crash...
Related to UpdateMusicStream(), in stb_vorbis
This commit is contained in:
parent
c3b8a41f95
commit
5a230659ef
@ -94,9 +94,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
INCLUDES = -I. -I../../src -IC:/raylib/raylib/src
|
INCLUDES = -I. -I../../src -IC:/raylib/raylib/src
|
||||||
# external libraries headers
|
# external libraries headers
|
||||||
# GLFW3
|
# GLFW3
|
||||||
INCLUDES += -I../../external/glfw3/include
|
INCLUDES += -I../../external/glfw3/include
|
||||||
# OpenAL Soft
|
# OpenAL Soft
|
||||||
INCLUDES += -I../../external/openal_soft/include
|
INCLUDES += -I../../external/openal_soft/include
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -115,9 +115,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
|
|||||||
endif
|
endif
|
||||||
# external libraries to link with
|
# external libraries to link with
|
||||||
# GLFW3
|
# GLFW3
|
||||||
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH)
|
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH)
|
||||||
ifneq ($(PLATFORM_OS),OSX)
|
ifneq ($(PLATFORM_OS),OSX)
|
||||||
# OpenAL Soft
|
# OpenAL Soft
|
||||||
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH)
|
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -210,6 +210,7 @@ void InitGameplayScreen(void)
|
|||||||
|
|
||||||
// Load and start playing music
|
// Load and start playing music
|
||||||
// NOTE: Music is loaded in main code base
|
// NOTE: Music is loaded in main code base
|
||||||
|
StopMusicStream(music);
|
||||||
PlayMusicStream(music);
|
PlayMusicStream(music);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,14 +42,13 @@ static int transToScreen = -1;
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Local Functions Declaration
|
// Local Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
static void ChangeToScreen(int screen); // No transition effect
|
||||||
|
|
||||||
static void TransitionToScreen(int screen);
|
static void TransitionToScreen(int screen);
|
||||||
static void ChangeToScreen(int screen); // No transition effect
|
|
||||||
static void UpdateTransition(void);
|
static void UpdateTransition(void);
|
||||||
static void DrawTransition(void);
|
static void DrawTransition(void);
|
||||||
|
|
||||||
static void UpdateDrawFrame(void); // Update and Draw one frame
|
static void UpdateDrawFrame(void); // Update and Draw one frame
|
||||||
|
|
||||||
//static const char *GetExtension(const char *fileName);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Main entry point
|
// Main entry point
|
||||||
@ -64,8 +63,8 @@ int main(int argc, char *argv[])
|
|||||||
sampleFilename = (char *)malloc(256);
|
sampleFilename = (char *)malloc(256);
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
if ((strcmp(GetExtension(argv[1]), "ogg") == 0) ||
|
if ((IsFileExtension(argv[1], ".ogg")) ||
|
||||||
(strcmp(GetExtension(argv[1]), "wav") == 0))
|
(IsFileExtension(argv[1], ".wav")))
|
||||||
{
|
{
|
||||||
strcpy(sampleFilename, argv[1]);
|
strcpy(sampleFilename, argv[1]);
|
||||||
}
|
}
|
||||||
@ -105,6 +104,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// De-Initialization
|
// De-Initialization
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
|
StopMusicStream(music);
|
||||||
|
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
{
|
{
|
||||||
case LOGO: UnloadLogoScreen(); break;
|
case LOGO: UnloadLogoScreen(); break;
|
||||||
@ -130,18 +131,8 @@ int main(int argc, char *argv[])
|
|||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Define transition to next screen
|
|
||||||
static void TransitionToScreen(int screen)
|
|
||||||
{
|
|
||||||
onTransition = true;
|
|
||||||
transFadeOut = false;
|
|
||||||
transFromScreen = currentScreen;
|
|
||||||
transToScreen = screen;
|
|
||||||
transAlpha = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change to next screen, no transition
|
// Change to next screen, no transition
|
||||||
void ChangeToScreen(int screen)
|
static void ChangeToScreen(int screen)
|
||||||
{
|
{
|
||||||
// Unload current screen
|
// Unload current screen
|
||||||
switch (currentScreen)
|
switch (currentScreen)
|
||||||
@ -166,8 +157,18 @@ void ChangeToScreen(int screen)
|
|||||||
currentScreen = screen;
|
currentScreen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Define transition to next screen
|
||||||
|
static void TransitionToScreen(int screen)
|
||||||
|
{
|
||||||
|
onTransition = true;
|
||||||
|
transFadeOut = false;
|
||||||
|
transFromScreen = currentScreen;
|
||||||
|
transToScreen = screen;
|
||||||
|
transAlpha = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// Update transition effect
|
// Update transition effect
|
||||||
void UpdateTransition(void)
|
static void UpdateTransition(void)
|
||||||
{
|
{
|
||||||
if (!transFadeOut)
|
if (!transFadeOut)
|
||||||
{
|
{
|
||||||
@ -175,7 +176,7 @@ void UpdateTransition(void)
|
|||||||
|
|
||||||
// NOTE: Due to float internal representation, condition jumps on 1.0f instead of 1.05f
|
// NOTE: Due to float internal representation, condition jumps on 1.0f instead of 1.05f
|
||||||
// For that reason we compare against 1.01f, to avoid last frame loading stop
|
// For that reason we compare against 1.01f, to avoid last frame loading stop
|
||||||
if (transAlpha > 1.01f)
|
if ((int)transAlpha >= 1)
|
||||||
{
|
{
|
||||||
transAlpha = 1.0f;
|
transAlpha = 1.0f;
|
||||||
|
|
||||||
@ -209,7 +210,7 @@ void UpdateTransition(void)
|
|||||||
{
|
{
|
||||||
transAlpha -= 0.05f;
|
transAlpha -= 0.05f;
|
||||||
|
|
||||||
if (transAlpha <= 0.0f)
|
if ((int)transAlpha <= 0)
|
||||||
{
|
{
|
||||||
transAlpha = 0.0f;
|
transAlpha = 0.0f;
|
||||||
transFadeOut = false;
|
transFadeOut = false;
|
||||||
@ -221,13 +222,13 @@ void UpdateTransition(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw transition effect (full-screen rectangle)
|
// Draw transition effect (full-screen rectangle)
|
||||||
void DrawTransition(void)
|
static void DrawTransition(void)
|
||||||
{
|
{
|
||||||
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha));
|
DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(RAYWHITE, transAlpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update and draw game frame
|
// Update and draw game frame
|
||||||
void UpdateDrawFrame(void)
|
static void UpdateDrawFrame(void)
|
||||||
{
|
{
|
||||||
// Update
|
// Update
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
@ -291,20 +292,6 @@ void UpdateDrawFrame(void)
|
|||||||
// Draw full screen rectangle in front of everything
|
// Draw full screen rectangle in front of everything
|
||||||
if (onTransition) DrawTransition();
|
if (onTransition) DrawTransition();
|
||||||
|
|
||||||
//DrawFPS(10, 10);
|
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
#if !defined(PLATFORM_WEB)
|
|
||||||
// Get the extension for a filename
|
|
||||||
static const char *GetExtension(const char *fileName)
|
|
||||||
{
|
|
||||||
const char *dot = strrchr(fileName, '.');
|
|
||||||
if (!dot || dot == fileName) return "";
|
|
||||||
return (dot + 1);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*/
|
|
Loading…
Reference in New Issue
Block a user