Merge pull request #269 from raysan5/develop

Integrate develop branch
This commit is contained in:
Ray 2017-04-24 00:18:53 +02:00 committed by GitHub
commit 71fe3c0b08
46 changed files with 73284 additions and 567 deletions

View File

@ -14,13 +14,12 @@ $(document).ready(function() {
'sample_space_invaders', 'sample_space_invaders',
'sample_floppy', 'sample_floppy',
'sample_tetris', 'sample_tetris',
'sample_gold_fever',
'sample_doom',
'game_drturtle', 'game_drturtle',
'game_just_do', 'game_just_do',
'game_skully_escape', 'game_skully_escape',
'game_koala_seasons', 'game_koala_seasons',
'game_light_my_ritual', 'game_light_my_ritual',
'game_wave_collector',
'user_raymario', 'user_raymario',
'user_crazyball', 'user_crazyball',
'user_tictactoe', 'user_tictactoe',
@ -39,13 +38,12 @@ $(document).ready(function() {
'space invaders', 'space invaders',
'floppy', 'floppy',
'tetris', 'tetris',
'gold fever',
'doom',
'Dr Turtle & Mr Gamera', 'Dr Turtle & Mr Gamera',
'JUST DO', 'JUST DO',
'Skully Escape', 'Skully Escape',
'Koala Seasons', 'Koala Seasons',
'LIGHT MY RITUAL', 'LIGHT MY RITUAL',
'Wave Collector',
'RayMario (Victor Fisac)', 'RayMario (Victor Fisac)',
'CrazyBall (Victor Fisac)', 'CrazyBall (Victor Fisac)',
'Tic-Tac-Toe (LelixSuper)', 'Tic-Tac-Toe (LelixSuper)',

View File

@ -25,7 +25,7 @@ int main()
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
// TTF SpriteFont loading with custom generation parameters // TTF SpriteFont loading with custom generation parameters
SpriteFont font = LoadSpriteFontTTF("resources/KAISG.ttf", 96, 0, 0); SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 96, 0, 0);
// Generate mipmap levels to use trilinear filtering // Generate mipmap levels to use trilinear filtering
// NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR
@ -82,7 +82,7 @@ int main()
if (count == 1) // Only support one ttf file dropped if (count == 1) // Only support one ttf file dropped
{ {
UnloadSpriteFont(font); UnloadSpriteFont(font);
font = LoadSpriteFontTTF(droppedFiles[0], fontSize, 0, 0); font = LoadSpriteFontEx(droppedFiles[0], fontSize, 0, 0);
ClearDroppedFiles(); ClearDroppedFiles();
} }
} }

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

View File

@ -52,7 +52,7 @@ int main()
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
// TTF SpriteFont loading with custom generation parameters // TTF SpriteFont loading with custom generation parameters
font = LoadSpriteFontTTF("resources/KAISG.ttf", 96, 0, 0); font = LoadSpriteFontEx("resources/KAISG.ttf", 96, 0, 0);
// Generate mipmap levels to use trilinear filtering // Generate mipmap levels to use trilinear filtering
// NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR
@ -130,7 +130,7 @@ void UpdateDrawFrame(void)
if (count == 1) // Only support one ttf file dropped if (count == 1) // Only support one ttf file dropped
{ {
UnloadSpriteFont(font); UnloadSpriteFont(font);
font = LoadSpriteFontTTF(droppedFiles[0], fontSize, 0, 0); font = LoadSpriteFontEx(droppedFiles[0], fontSize, 0, 0);
ClearDroppedFiles(); ClearDroppedFiles();
} }
} }

View File

@ -36,7 +36,7 @@
} }
#eximage { width: 802px; height: 452px; text-align: center; } #eximage { width: 802px; height: 452px; text-align: center; }
#eximage img { margin: 0 auto; border: 1px solid; border-color: black; } #eximage img { margin: 0 auto; border: 1px solid; border-color: black; }
#eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; } #eximage canvas { position: relative; top: 1px; left: 1px; border: 1px solid red; background: black; }
pre { width: 802px!important;} pre { width: 802px!important;}
pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; } pre code{ border: 1px solid; border-color:#b0b0b0; height:auto; }
.exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px; .exdownbtn{ margin-right: 20px; width:220px; height:30px; float:left; position: relative; cursor:pointer; font-weight:bold; font-size:10px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -111,7 +111,7 @@ void UpdateDrawFrame(void)
ClearBackground(RAYWHITE); ClearBackground(RAYWHITE);
DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, WHITE); DrawTexture(checked, screenWidth/2 - checked.width/2, screenHeight/2 - checked.height/2, Fade(WHITE, 0.5f));
DrawTexture(fudesumi, 430, -30, WHITE); DrawTexture(fudesumi, 430, -30, WHITE);
DrawText("CHECKED TEXTURE ", 84, 100, 30, BROWN); DrawText("CHECKED TEXTURE ", 84, 100, 30, BROWN);

View File

@ -4,7 +4,7 @@
# #
# NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library # NOTE: By default examples are compiled using raylib static library and OpenAL Soft shared library
# #
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # will the authors be held liable for any damages arising from the use of this software.
@ -23,20 +23,22 @@
# #
#************************************************************************************************** #**************************************************************************************************
.PHONY: all clean
# define raylib platform to compile for # define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB # 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() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default) # define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= YES SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO SHARED_OPENAL = NO
endif endif
# define raylib directory for include and library # define raylib directory for include and library
RAYLIB_PATH = D:\GitHub\raylib RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@ -99,7 +101,7 @@ ifeq ($(PLATFORM),PLATFORM_WEB)
# --memory-init-file 0 # to avoid an external memory initialization code file (.mem) # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
# -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# -preload-file file.res # embbed file.res resource into .data file # --preload-file file.res # embbed file.res resource into .data file
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
@ -174,7 +176,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
@ -202,7 +204,7 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# just adjust the correct path to libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = $(RAYLIB_RELEASE)/libraylib.bc LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
@ -282,8 +284,7 @@ EXAMPLES = \
fix_dylib \ fix_dylib \
# typing 'make' will invoke the default target entry called 'all', # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is raylib
all: examples all: examples
# generic compilation pattern # generic compilation pattern

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 218 KiB

View File

@ -25,7 +25,7 @@ int main()
// NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required) // NOTE: Textures/Fonts MUST be loaded after Window initialization (OpenGL context is required)
// TTF SpriteFont loading with custom generation parameters // TTF SpriteFont loading with custom generation parameters
SpriteFont font = LoadSpriteFontTTF("resources/KAISG.ttf", 96, 0, 0); SpriteFont font = LoadSpriteFontEx("resources/KAISG.ttf", 96, 0, 0);
// Generate mipmap levels to use trilinear filtering // Generate mipmap levels to use trilinear filtering
// NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR // NOTE: On 2D drawing it won't be noticeable, it looks like FILTER_BILINEAR
@ -82,7 +82,7 @@ int main()
if (count == 1) // Only support one ttf file dropped if (count == 1) // Only support one ttf file dropped
{ {
UnloadSpriteFont(font); UnloadSpriteFont(font);
font = LoadSpriteFontTTF(droppedFiles[0], fontSize, 0, 0); font = LoadSpriteFontEx(droppedFiles[0], fontSize, 0, 0);
ClearDroppedFiles(); ClearDroppedFiles();
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

After

Width:  |  Height:  |  Size: 218 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,17 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - makefile to compile Dr.Turtle game # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -21,10 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
# define raylib platform if not defined (by default, compile for RPI) .PHONY: all clean
# Other possible platform: PLATFORM_DESKTOP
# 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 PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -60,48 +73,96 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1 --shell-file ../../templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --profiling --preload-file resources
#-s ASSERTIONS=1 --preload-file resources # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif endif
# define any directories containing required header files # define any directories containing required header files
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else endif
INCLUDES = -I. -I../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries headers ifeq ($(PLATFORM_OS),WINDOWS)
# GLFW3 # external libraries headers
INCLUDES += -I../../external/glfw3/include # GLFW3
# GLEW INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
INCLUDES += -I../../external/glew/include # OpenAL Soft
# OpenAL Soft INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
INCLUDES += -I../../external/openal_soft/include endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
else endif
LFLAGS = -L. -L../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries to link with # add standard directories for GNU/Linux
# GLFW3 ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) # external libraries to link with
ifneq ($(PLATFORM_OS),OSX) # GLFW3
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) # OpenAL Soft
# GLEW LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
LFLAGS += -L../../external/glew/lib/$(LIBPATH)
endif endif
endif endif
@ -111,20 +172,27 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -134,30 +202,31 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../../src/libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources -Wl,--subsystem,windows WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
SCREENS = \ SCREENS = \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is advance_game
default: drturtle default: drturtle
# compile template - advance_game # compile program
drturtle: drturtle_final_web.c $(SCREENS) drturtle: drturtle_final_web.c $(SCREENS)
$(CC) -o $@$(EXT) $< $(SCREENS) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# clean everything # clean everything
clean: clean:
@ -167,10 +236,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o rm -f *.o
else else
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete 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
rm -f *.o
else else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -1,19 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - Advance Game # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # This software is provided "as-is", without any express or implied warranty. In no event
#
# 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -23,11 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
.PHONY: all clean
# define raylib platform to compile for # define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB # 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() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -63,50 +73,96 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --shell-file ../../templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 -s --profiling --preload-file resources
#-s ASSERTIONS=1 --preload-file resources # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files # define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
else endif
INCLUDES = -I. -I../../src -I../../../src
# external libraries headers # define any directories containing required header files
# GLFW3 INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
INCLUDES += -I../../external/glfw3/include
# GLEW ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I../../external/glew/include INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
# OpenAL Soft endif
INCLUDES += -I../../external/openal_soft/include ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers
# GLFW3
INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft
INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
else endif
LFLAGS = -L. -L../../src -L../../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries to link with # add standard directories for GNU/Linux
# GLFW3 ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) # external libraries to link with
ifneq ($(PLATFORM_OS),OSX) # GLFW3
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) # OpenAL Soft
# GLEW LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
LFLAGS += -L../../external/glew/lib/$(LIBPATH)
endif endif
endif endif
@ -116,20 +172,27 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -139,18 +202,20 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../../src/libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources -Wl,--subsystem,windows WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
@ -167,14 +232,13 @@ SCREENS = \
screens/screen_level08.o \ screens/screen_level08.o \
screens/screen_level09.o \ screens/screen_level09.o \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is just_do
default: just_do default: just_do
# compile just_do # compile program
just_do: just_do.c $(SCREENS) just_do: just_do.c $(SCREENS)
$(CC) -o $@$(EXT) $< $(SCREENS) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile screen LOGO # compile screen LOGO
screens/screen_logo.o: screens/screen_logo.c screens/screen_logo.o: screens/screen_logo.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM) $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES) -D$(PLATFORM)
@ -227,10 +291,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o rm -f *.o
else else
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete 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
rm -f *.o
else else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -1,19 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - Koala Seasons
#
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten) # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# Copyright (c) 2013-2016 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -23,11 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
.PHONY: all clean
# define raylib platform to compile for # define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB # 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() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -63,43 +73,84 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1 CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources -s ALLOW_MEMORY_GROWTH=1
#-s ASSERTIONS=1 --preload-file resources # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files # define any directories containing required header files
INCLUDES = -I. -I../src -I../src/external INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux ifeq ($(PLATFORM_OS),WINDOWS)
ifeq ($(PLATFORM_OS),LINUX)
INCLUDES += -I/usr/local/include/raylib/
else ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers # external libraries headers
# GLFW3 # GLFW3
INCLUDES += -I../src/external/glfw3/include INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft # OpenAL Soft
INCLUDES += -I../src/external/openal_soft/include INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L../src -L$(RAYLIB_PATH) LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS += -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
@ -109,9 +160,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries to link with # external libraries to link with
# GLFW3 # GLFW3
LFLAGS += -L../src/external/glfw3/lib/$(LIBPATH) LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
# OpenAL Soft # OpenAL Soft
LFLAGS += -L../src/external/openal_soft/lib/$(LIBPATH) LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
endif endif
endif endif
@ -122,19 +173,26 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
#LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OS X 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -144,19 +202,21 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# just adjust the correct path to libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = ../release/html5/libraylib.bc LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = C:\raylib\raylib_icon WINFLAGS = $(RAYLIB_PATH)/src/resources
#-Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
@ -166,13 +226,12 @@ SCREENS = \
screens/screen_gameplay.o \ screens/screen_gameplay.o \
screens/screen_ending.o \ screens/screen_ending.o \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is koala_seasons
default: koala_seasons default: koala_seasons
# compile template - koala_seasons # compile program
koala_seasons: koala_seasons.c $(SCREENS) koala_seasons: koala_seasons.c $(SCREENS)
$(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile screen LOGO # compile screen LOGO
screens/screen_logo.o: screens/screen_logo.c screens/screen_logo.o: screens/screen_logo.c
@ -204,7 +263,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) 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 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 else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -68,7 +68,7 @@ int main(void)
font = LoadSpriteFont("resources/graphics/mainfont.png"); font = LoadSpriteFont("resources/graphics/mainfont.png");
atlas01 = LoadTexture("resources/graphics/atlas01.png"); atlas01 = LoadTexture("resources/graphics/atlas01.png");
atlas02 = LoadTexture("resources/graphics/atlas02.pvr"); atlas02 = LoadTexture("resources/graphics/atlas02.png");
#if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID) #if defined(PLATFORM_WEB) || defined(PLATFORM_RPI) || defined(PLATFORM_ANDROID)
colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs"); colorBlend = LoadShader("resources/shaders/glsl100/base.vs", "resources/shaders/glsl100/blend_color.fs");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 898 KiB

After

Width:  |  Height:  |  Size: 899 KiB

View File

@ -465,11 +465,11 @@ void DrawEndingScreen(void)
DrawTexturePro(atlas01, ending_button_trophy, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.513, ending_button_trophy.width, ending_button_trophy.height}, (Vector2){ 0, 0}, 0, buttonTrophyColor); DrawTexturePro(atlas01, ending_button_trophy, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.513, ending_button_trophy.width, ending_button_trophy.height}, (Vector2){ 0, 0}, 0, buttonTrophyColor);
DrawTexturePro(atlas01, ending_button_share, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.719, ending_button_share.width, ending_button_share.height}, (Vector2){ 0, 0}, 0, buttonShareColor); DrawTexturePro(atlas01, ending_button_share, (Rectangle){GetScreenWidth()*0.871, GetScreenHeight()*0.719, ending_button_share.width, ending_button_share.height}, (Vector2){ 0, 0}, 0, buttonShareColor);
DrawTextEx(font, FormatText("%03i", seasonsCounter), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.14f }, font.size, 1, WHITE); DrawTextEx(font, FormatText("%03i", seasonsCounter), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.14f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%03i", currentLeavesEnding), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.29f }, font.size, 1, WHITE); DrawTextEx(font, FormatText("%03i", currentLeavesEnding), (Vector2){ GetScreenWidth()*0.73f, GetScreenHeight()*0.29f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%04i", currentScore), (Vector2){ GetScreenWidth()*0.715f, GetScreenHeight()*0.426f }, font.size, 1, WHITE); DrawTextEx(font, FormatText("%04i", currentScore), (Vector2){ GetScreenWidth()*0.715f, GetScreenHeight()*0.426f }, font.baseSize, 1, WHITE);
DrawTextEx(font, FormatText("%s %i - %s %i", initMonthText, initYears, finalMonthText, finalYears), (Vector2){ GetScreenWidth()*0.1f, GetScreenHeight()*0.7f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, FormatText("%s %i - %s %i", initMonthText, initYears, finalMonthText, finalYears), (Vector2){ GetScreenWidth()*0.1f, GetScreenHeight()*0.7f }, font.baseSize/2.0f, 1, WHITE);
for (int i = 0; i < MAX_KILLS; i++) for (int i = 0; i < MAX_KILLS; i++)
{ {
@ -495,26 +495,26 @@ void DrawEndingScreen(void)
//DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, 0.5)); //DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), Fade(BLACK, 0.5));
*/ */
//DrawTextEx(font, FormatText("%02s", killer), (Vector2){ GetScreenWidth()*0.08, GetScreenHeight()*0.78 }, font.size/2, 1, WHITE); //DrawTextEx(font, FormatText("%02s", killer), (Vector2){ GetScreenWidth()*0.08, GetScreenHeight()*0.78 }, font.baseSize/2, 1, WHITE);
if (killer == 0) DrawTextEx(font, textFire01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); if (killer == 0) DrawTextEx(font, textFire01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 2) DrawTextEx(font, textDingo01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); else if (killer == 2) DrawTextEx(font, textDingo01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 1) else if (killer == 1)
{ {
DrawTextEx(font, textSnake01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textSnake01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textSnake02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textSnake02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
} }
else if (killer == 3) else if (killer == 3)
{ {
DrawTextEx(font, textOwl01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textOwl01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textOwl02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textOwl02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
} }
else if (killer == 4) DrawTextEx(font, textNaturalDeath01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); else if (killer == 4) DrawTextEx(font, textNaturalDeath01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
else if (killer == 5) else if (killer == 5)
{ {
DrawTextEx(font, textBee01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textBee01, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
DrawTextEx(font, textBee02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.size/2.0f, 1, WHITE); DrawTextEx(font, textBee02, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.83f }, font.baseSize/2.0f, 1, WHITE);
} }
else if (killer == 6) DrawTextEx(font, textEagle, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.size/2.0f, 1, WHITE); else if (killer == 6) DrawTextEx(font, textEagle, (Vector2){ GetScreenWidth()*0.13f, GetScreenHeight()*0.78f }, font.baseSize/2.0f, 1, WHITE);
} }
// Ending Screen Unload logic // Ending Screen Unload logic

View File

@ -475,7 +475,7 @@ void UpdateGameplayScreen(void)
if (numberAlpha <= 0) numberAlpha = 1; if (numberAlpha <= 0) numberAlpha = 1;
if (numberScale <= 0) numberScale = 2.5f; if (numberScale <= 0) numberScale = 2.5f;
textSize = MeasureTextEx(font, FormatText("%01i", startNum), font.size*numberScale, 2); textSize = MeasureTextEx(font, FormatText("%01i", startNum), font.baseSize*numberScale, 2);
} }
if (playerActive) finishScreen = 0; if (playerActive) finishScreen = 0;
@ -2914,42 +2914,42 @@ void DrawGameplayScreen(void)
{ {
if (popupScore[i].active) if (popupScore[i].active)
{ {
DrawTextEx(font, FormatText("%i", popupScore[i].score), popupScore[i].position, font.size/4*popupScore[i].scale, -5, Fade((Color){255, 73, 73, 255}, popupScore[i].alpha)); DrawTextEx(font, FormatText("%i", popupScore[i].score), popupScore[i].position, font.baseSize/4*popupScore[i].scale, -5, Fade((Color){255, 73, 73, 255}, popupScore[i].alpha));
} }
} }
if (popupBee.active) DrawTextEx(font, FormatText("%i", popupBee.score), popupBee.position, font.size/4*popupBee.scale, -5, Fade((Color){255, 73, 73, 255}, popupBee.alpha)); if (popupBee.active) DrawTextEx(font, FormatText("%i", popupBee.score), popupBee.position, font.baseSize/4*popupBee.scale, -5, Fade((Color){255, 73, 73, 255}, popupBee.alpha));
if (popupEagle.active) DrawTextEx(font, FormatText("%i", popupEagle.score), popupEagle.position, font.size/4*popupEagle.scale, -5, Fade((Color){255, 73, 73, 255}, popupEagle.alpha)); if (popupEagle.active) DrawTextEx(font, FormatText("%i", popupEagle.score), popupEagle.position, font.baseSize/4*popupEagle.scale, -5, Fade((Color){255, 73, 73, 255}, popupEagle.alpha));
for (int i = 0; i < MAX_LEAVES; i++) for (int i = 0; i < MAX_LEAVES; i++)
{ {
if (popupLeaves[i].active) DrawTextEx(font, FormatText("+ %i", popupLeaves[i].score), popupLeaves[i].position, font.size/4*popupLeaves[i].scale, -5, Fade((Color){139, 179, 0, 255}, popupLeaves[i].alpha)); if (popupLeaves[i].active) DrawTextEx(font, FormatText("+ %i", popupLeaves[i].score), popupLeaves[i].position, font.baseSize/4*popupLeaves[i].scale, -5, Fade((Color){139, 179, 0, 255}, popupLeaves[i].alpha));
} }
DrawTextEx(font, FormatText("%03i", currentLeaves), (Vector2){ 47, 50 }, font.size, -8, counterColor); DrawTextEx(font, FormatText("%03i", currentLeaves), (Vector2){ 47, 50 }, font.baseSize, -8, counterColor);
if (transforming) DrawTextEx(font, textFinalForm, (Vector2){ GetScreenWidth()/2 - MeasureText(textFinalForm, 40)/2, GetScreenHeight()/4}, font.size, -5, (Color){246, 133, 133, 255}); if (transforming) DrawTextEx(font, textFinalForm, (Vector2){ GetScreenWidth()/2 - MeasureText(textFinalForm, 40)/2, GetScreenHeight()/4}, font.baseSize, -5, (Color){246, 133, 133, 255});
if ((currentMonth == 7) && (transitionFramesCounter >= SEASONTRANSITION/2)) if ((currentMonth == 7) && (transitionFramesCounter >= SEASONTRANSITION/2))
{ {
if (randomMessage <= 4) DrawTextEx(font, textSpring1, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255}); if (randomMessage <= 4) DrawTextEx(font, textSpring1, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){185, 222, 105, 255});
else DrawTextEx(font, textSpring2, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){185, 222, 105, 255}); else DrawTextEx(font, textSpring2, (Vector2){GetScreenWidth()/2 - MeasureText(textSpring2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){185, 222, 105, 255});
} }
else if ((currentMonth == 10) && (transitionFramesCounter >= SEASONTRANSITION/2)) else if ((currentMonth == 10) && (transitionFramesCounter >= SEASONTRANSITION/2))
{ {
if (randomMessage <= 4) DrawTextEx(font, textSummer1, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255}); if (randomMessage <= 4) DrawTextEx(font, textSummer1, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){253, 200, 108, 255});
else DrawTextEx(font, textSummer2, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){253, 200, 108, 255}); else DrawTextEx(font, textSummer2, (Vector2){GetScreenWidth()/2 - MeasureText(textSummer2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){253, 200, 108, 255});
} }
else if ((currentMonth == 1) && (transitionFramesCounter >= SEASONTRANSITION/2)) else if ((currentMonth == 1) && (transitionFramesCounter >= SEASONTRANSITION/2))
{ {
if (randomMessage <= 4) DrawTextEx(font, textFall1, (Vector2){GetScreenWidth()/2 - MeasureText(textFall1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255}); if (randomMessage <= 4) DrawTextEx(font, textFall1, (Vector2){GetScreenWidth()/2 - MeasureText(textFall1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){255, 149, 107, 255});
else DrawTextEx(font, textFall2, (Vector2){GetScreenWidth()/2 - MeasureText(textFall2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){255, 149, 107, 255}); else DrawTextEx(font, textFall2, (Vector2){GetScreenWidth()/2 - MeasureText(textFall2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){255, 149, 107, 255});
} }
else if (currentMonth == 4 && transitionFramesCounter >= SEASONTRANSITION/2) else if (currentMonth == 4 && transitionFramesCounter >= SEASONTRANSITION/2)
{ {
if (randomMessage <= 4) DrawTextEx(font, textWinter1, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter1, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255}); if (randomMessage <= 4) DrawTextEx(font, textWinter1, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter1, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){133, 249, 253, 255});
else DrawTextEx(font, textWinter2, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter2, 40)/2, GetScreenHeight()/3}, font.size, -5, (Color){133, 249, 253, 255}); else DrawTextEx(font, textWinter2, (Vector2){GetScreenWidth()/2 - MeasureText(textWinter2, 40)/2, GetScreenHeight()/3}, font.baseSize, -5, (Color){133, 249, 253, 255});
} }
#if defined(DEBUG) #if defined(DEBUG)
@ -3933,5 +3933,5 @@ static void Reset(void)
firePos.x = -200; firePos.x = -200;
firePos.y = 0; firePos.y = 0;
textSize = MeasureTextEx(font, "3", font.size*5, 2); textSize = MeasureTextEx(font, "3", font.baseSize*5, 2);
} }

View File

@ -326,7 +326,7 @@ void InitTitleScreen(void)
koalaMenu.width = gameplay_koala_menu.width/2; koalaMenu.width = gameplay_koala_menu.width/2;
koalaMenu.height = gameplay_koala_menu.height; koalaMenu.height = gameplay_koala_menu.height;
fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.size, 2); fontSize = MeasureTextEx(font, "PRESS TO PLAY", font.baseSize, 2);
} }
// Title Screen Update logic // Title Screen Update logic
@ -918,7 +918,7 @@ void DrawTitleScreen(void)
DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y, title_titletext.width, 230}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue1, title_titletext.width, 235}, (Vector2){0, 0}, 0, WHITE); DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y, title_titletext.width, 230}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue1, title_titletext.width, 235}, (Vector2){0, 0}, 0, WHITE);
DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y + 232, title_titletext.width, 116}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue2, title_titletext.width, 116}, (Vector2){0, 0}, 0, WHITE); DrawTexturePro(atlas01, (Rectangle){title_titletext.x, title_titletext.y + 232, title_titletext.width, 116}, (Rectangle){GetScreenWidth()*0.49F - title_titletext.width/2, currentValue2, title_titletext.width, 116}, (Vector2){0, 0}, 0, WHITE);
if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.size, 2, (Color){247, 239, 209, 255}); if ((framesCounter/60)%2 && framesCounter >= duration) DrawTextEx(font, pressToPlay, (Vector2){ GetScreenWidth()/2 - fontSize.x/2, GetScreenHeight()/2 + fontSize.y*2 }, font.baseSize, 2, (Color){247, 239, 209, 255});
for (int i = 0; i < MAX_particle; i++) for (int i = 0; i < MAX_particle; i++)
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 MiB

View File

@ -0,0 +1,239 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>raylib HTML5 GAME</title>
<meta name="title" content="raylib HTML5 GAME">
<meta name="description" content="New HTML5 videogame, developed using raylib videogames library">
<meta name="keywords" content="raylib, games, html5, programming, C, C++, library, learn, videogames">
<meta name="viewport" content="width=device-width">
<!-- Facebook metatags for sharing -->
<meta property="og:title" content="raylib HTML5 GAME">
<meta property="og:image:type" content="image/png">
<meta property="og:image" content="http://www.raylib.com/img/raylib_logo.png">
<meta property="og:image" content="http://www.raylib.com/img/raylib_logo.png">
<meta property="og:url" content="http://www.raylib.com/games">
<meta property="og:site_name" content="raylib.com">
<meta property="og:description" content="New hmtl5 videogame, developed using raylib videogames library">
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@emegemegames">
<meta name="twitter:title" content="raylib HTML5 GAME">
<meta name="twitter:description" content="New HTML5 videogame, developed using raylib videogames library">
<meta name="twitter:image" content="http://www.raylib.com/img/raylib_logo.png">
<meta name="twitter:url" content="http://www.raylib.com/img/raylib_logo.png">
<!--<link rel="stylesheet" href="./Koala Seasons by emegeme_files/main.css">-->
<link rel="shortcut icon" href="http://www.raylib.com/favicon.ico">
<style>
body {
font-family: arial;
margin: 0;
padding: none;
}
#header_part {
width: 100%;
height: 80px;
background-color: #888888;
}
#logo {
width:64px;
height:64px;
float:left;
position:relative;
margin:10px;
background-image:url(http://www.raylib.com/common/img/raylib_logo_64x64.png);
}
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten { text-align: center; }
div.emscripten_border { border: 1px solid black; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; background: black; }
#emscripten_logo {
display: inline-block;
margin: 0;
}
.spinner {
height: 30px;
width: 30px;
margin: 0;
margin-top: 20px;
margin-left: 20px;
display: inline-block;
vertical-align: top;
-webkit-animation: rotation .8s linear infinite;
-moz-animation: rotation .8s linear infinite;
-o-animation: rotation .8s linear infinite;
animation: rotation 0.8s linear infinite;
border-left: 5px solid black;
border-right: 5px solid black;
border-bottom: 5px solid black;
border-top: 5px solid red;
border-radius: 100%;
background-color: rgb(245, 245, 245);
}
@-webkit-keyframes rotation {
from {-webkit-transform: rotate(0deg);}
to {-webkit-transform: rotate(360deg);}
}
@-moz-keyframes rotation {
from {-moz-transform: rotate(0deg);}
to {-moz-transform: rotate(360deg);}
}
@-o-keyframes rotation {
from {-o-transform: rotate(0deg);}
to {-o-transform: rotate(360deg);}
}
@keyframes rotation {
from {transform: rotate(0deg);}
to {transform: rotate(360deg);}
}
#status {
display: inline-block;
vertical-align: top;
margin-top: 30px;
margin-left: 20px;
font-weight: bold;
color: rgb(40, 40, 40);
}
#progress {
height: 20px;
width: 30px;
}
#controls {
display: inline-block;
float: right;
vertical-align: top;
margin-top: 30px;
margin-right: 20px;
}
#output {
width: 100%;
height: 140px;
margin: 0 auto;
margin-top: 10px;
display: block;
background-color: black;
color: rgb(37, 174, 38);
font-family: 'Lucida Console', Monaco, monospace;
outline: none;
}
</style>
</head>
<body>
<div id="header_part">
<a id="logo" href="http://www.raylib.com"></a>
<div class="spinner" id='spinner'></div>
<div class="emscripten" id="status">Downloading...</div>
<span id='controls'>
<span><input type="button" value="Fullscreen" onclick="Module.requestFullScreen(false, false)"></span>
</span>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<textarea id="output" rows="8"></textarea>
<script type='text/javascript'>
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
var spinnerElement = document.getElementById('spinner');
var Module = {
preRun: [],
postRun: [],
print: (function() {
var element = document.getElementById('output');
if (element) element.value = ''; // clear browser cache
return function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
console.log(text);
if (element) {
element.value += text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}
};
})(),
printErr: function(text) {
if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.error(text);
}
},
canvas: (function() {
var canvas = document.getElementById('canvas');
// As a default initial behavior, pop up an alert when webgl context is lost. To make your
// application robust, you may want to override this behavior before shipping!
// See http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.15.2
canvas.addEventListener("webglcontextlost", function(e) { alert('WebGL context lost. You will need to reload the page.'); e.preventDefault(); }, false);
return canvas;
})(),
setStatus: function(text) {
if (!Module.setStatus.last) Module.setStatus.last = { time: Date.now(), text: '' };
if (text === Module.setStatus.text) return;
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var now = Date.now();
if (m && now - Date.now() < 30) return; // if this is a progress update, skip it if too soon
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
spinnerElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
if (!text) spinnerElement.style.display = 'none';
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
window.onerror = function(event) {
// TODO: do not warn on ok events like simulating an infinite loop or exitStatus
Module.setStatus('Exception thrown, see JavaScript console');
spinnerElement.style.display = 'none';
Module.setStatus = function(text) {
if (text) Module.printErr('[post-exception status] ' + text);
};
};
</script>
<script async type="text/javascript" src="light_my_ritual.js"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -1,19 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - Advance Game # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # This software is provided "as-is", without any express or implied warranty. In no event
#
# 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -23,10 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
# define raylib platform if not defined (by default, compile for RPI) .PHONY: all clean
# Other possible platform: PLATFORM_DESKTOP
# 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 PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -62,48 +73,96 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1 --shell-file ../../templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources -s ALLOW_MEMORY_GROWTH=1
#-s ASSERTIONS=1 --preload-file resources # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif endif
# define any directories containing required header files # define any directories containing required header files
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else endif
INCLUDES = -I. -I../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries headers ifeq ($(PLATFORM_OS),WINDOWS)
# GLFW3 # external libraries headers
INCLUDES += -I../../external/glfw3/include # GLFW3
# GLEW INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
INCLUDES += -I../../external/glew/include # OpenAL Soft
# OpenAL Soft INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
INCLUDES += -I../../external/openal_soft/include endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
else endif
LFLAGS = -L. -L../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries to link with # add standard directories for GNU/Linux
# GLFW3 ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) # external libraries to link with
ifneq ($(PLATFORM_OS),OSX) # GLFW3
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) # OpenAL Soft
# GLEW LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
LFLAGS += -L../../external/glew/lib/$(LIBPATH)
endif endif
endif endif
@ -113,21 +172,28 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -lpthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
endif else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
endif else
ifeq ($(PLATFORM_OS),WINDOWS)
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
@ -136,18 +202,20 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../../src/libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources -Wl,--subsystem,windows WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
@ -156,13 +224,12 @@ SCREENS = \
screens/screen_title.o \ screens/screen_title.o \
screens/screen_gameplay.o \ screens/screen_gameplay.o \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is advance_game
default: light_my_ritual default: light_my_ritual
# compile template - advance_game # compile program
light_my_ritual: light_my_ritual.c $(SCREENS) light_my_ritual: light_my_ritual.c $(SCREENS)
$(CC) -o $@$(EXT) $< $(SCREENS) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile screen LOGO raylib # compile screen LOGO raylib
screens/screen_logo_raylib.o: screens/screen_logo_raylib.c screens/screen_logo_raylib.o: screens/screen_logo_raylib.c
@ -184,10 +251,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o rm -f *.o
else else
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete 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
rm -f *.o
else else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -2,16 +2,16 @@
# #
# raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten) # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# Copyright (c) 2015 Ramon Santamaria (@raysan5) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# This software is provided "as-is", without any express or implied warranty. In no event # 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -21,11 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
.PHONY: all clean
# define raylib platform to compile for # define raylib platform to compile for
# possible platforms: PLATFORM_DESKTOP PLATFORM_RPI PLATFORM_WEB # 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() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -61,46 +73,96 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --shell-file ../../templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 -s --profiling
#-s ASSERTIONS=1 # to check for memory allocation errors (-O1 disables it) # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files # define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
else endif
INCLUDES = -I. -I../src
# external libraries headers # define any directories containing required header files
# GLFW3 INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
INCLUDES += -I../external/glfw3/include
# OpenAL Soft ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I../external/openal_soft/include INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
# external libraries headers
# GLFW3
INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft
INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
else endif
LFLAGS = -L. -L../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries to link with # add standard directories for GNU/Linux
# GLFW3 ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -L../external/glfw3/lib/$(LIBPATH) # external libraries to link with
ifneq ($(PLATFORM_OS),OSX) # GLFW3
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
LFLAGS += -L../external/openal_soft/lib/$(LIBPATH) # OpenAL Soft
LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
endif endif
endif endif
@ -110,20 +172,27 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -lpthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries: # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -134,18 +203,19 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# NOTE: Set the correct path to libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = ../src/libraylib.bc LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = ../src/resources -Wl,--subsystem,windows WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all object files required # define all object files required
@ -164,8 +234,7 @@ SAMPLES = \
fix_dylib \ fix_dylib \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is raylib
default: samples default: samples
# compile all game samples # compile all game samples
@ -173,47 +242,47 @@ samples: $(SAMPLES)
# compile game sample - arkanoid # compile game sample - arkanoid
arkanoid: arkanoid.c arkanoid: arkanoid.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - steroids # compile game sample - steroids
asteroids: asteroids.c asteroids: asteroids.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - asteroids_survival # compile game sample - asteroids_survival
asteroids_survival: asteroids_survival.c asteroids_survival: asteroids_survival.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - floppy # compile game sample - floppy
floppy: floppy.c floppy: floppy.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - gold_fever # compile game sample - gold_fever
gold_fever: gold_fever.c gold_fever: gold_fever.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - gorilas # compile game sample - gorilas
gorilas: gorilas.c gorilas: gorilas.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - missile_commander # compile game sample - missile_commander
missile_commander: missile_commander.c missile_commander: missile_commander.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - pang # compile game sample - pang
pang: pang.c pang: pang.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - snake # compile game sample - snake
snake: snake.c snake: snake.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - space_invaders # compile game sample - space_invaders
space_invaders: space_invaders.c space_invaders: space_invaders.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile game sample - tetris # compile game sample - tetris
tetris: tetris.c tetris: tetris.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# fix dylib install path name for each executable (MAC) # fix dylib install path name for each executable (MAC)
fix_dylib: fix_dylib:
@ -231,7 +300,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) 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 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 else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -1,19 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - Advance Game # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# makefile to compile advance game # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # This software is provided "as-is", without any express or implied warranty. In no event
#
# 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -23,10 +21,23 @@
# #
#************************************************************************************************** #**************************************************************************************************
# define raylib platform if not defined (by default, compile for RPI) .PHONY: all clean
# Other possible platform: PLATFORM_DESKTOP
# 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 PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -62,48 +73,96 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 --preload-file resources -s ALLOW_MEMORY_GROWTH=1 --shell-file ../../templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 --profiling --preload-file resources -s ALLOW_MEMORY_GROWTH=1
#-s ASSERTIONS=1 --preload-file resources # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif endif
# define any directories containing required header files # define any directories containing required header files
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
else endif
INCLUDES = -I. -I../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries headers ifeq ($(PLATFORM_OS),WINDOWS)
# GLFW3 # external libraries headers
INCLUDES += -I../../external/glfw3/include # GLFW3
# GLEW INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
INCLUDES += -I../../external/glew/include # OpenAL Soft
# OpenAL Soft INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
INCLUDES += -I../../external/openal_soft/include endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
else endif
LFLAGS = -L. -L../../src -L../../../src ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# external libraries to link with # add standard directories for GNU/Linux
# GLFW3 ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) # external libraries to link with
ifneq ($(PLATFORM_OS),OSX) # GLFW3
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH) # OpenAL Soft
# GLEW LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
LFLAGS += -L../../external/glew/lib/$(LIBPATH)
endif endif
endif endif
@ -113,20 +172,27 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGLEW -lGL -lopenal -lm -pthread -ldl LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
# on XWindow could require also below libraries, just uncomment # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libglew-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -136,19 +202,20 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal LIBS = -lraylib -lGLESv2 -lEGL -lpthread -lrt -lm -lbcm_host -lopenal
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
LIBS = ../../src/libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = ../../src/resources WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
#-Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
@ -167,13 +234,12 @@ SCREENS = \
player.o \ player.o \
monster.o \ monster.o \
# typing 'make' will invoke the first target entry in the file, # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is advance_game
default: skully_escape default: skully_escape
# compile template - advance_game # compile program
skully_escape: skully_escape.c $(SCREENS) skully_escape: skully_escape.c $(SCREENS)
$(CC) -o $@$(EXT) $< $(SCREENS) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile screen LOGO # compile screen LOGO
screens/screen_logo.o: screens/screen_logo.c screens/screen_logo.o: screens/screen_logo.c
@ -235,10 +301,9 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
rm -f *.o rm -f *.o
else else
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete 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
rm -f *.o
else else
del *.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif

View File

@ -1,19 +1,17 @@
#************************************************************************************************** #**************************************************************************************************
# #
# raylib - Advance Game # raylib makefile for desktop platforms, Raspberry Pi and HTML5 (emscripten)
# #
# makefile to compile advance game for desktop platforms, Raspberry Pi and HTML5 (emscripten) # Copyright (c) 2013-2017 Ramon Santamaria (@raysan5)
# #
# Copyright (c) 2014 Ramon Santamaria (@raysan5) # This software is provided "as-is", without any express or implied warranty. In no event
#
# 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. # 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 # 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: # 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 # 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 # 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. # 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 # 2. Altered source versions must be plainly marked as such, and must not be misrepresented
@ -30,6 +28,16 @@
# WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop() # WARNING: To compile to HTML5, code must be redesigned to use emscripten.h and emscripten_set_main_loop()
PLATFORM ?= PLATFORM_DESKTOP PLATFORM ?= PLATFORM_DESKTOP
# define NO to use OpenAL Soft as static library (shared by default)
SHARED_OPENAL ?= NO
ifeq ($(PLATFORM),PLATFORM_WEB)
SHARED_OPENAL = NO
endif
# define raylib directory for include and library
RAYLIB_PATH ?= C:\raylib\raylib
# determine PLATFORM_OS in case PLATFORM_DESKTOP selected # determine PLATFORM_OS in case PLATFORM_DESKTOP selected
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows # No uname.exe on MinGW!, but OS=Windows_NT on Windows! ifeq ($(UNAME),Msys) -> Windows
@ -65,69 +73,99 @@ endif
endif endif
# define compiler flags: # define compiler flags:
# -O2 defines optimization level # -O2 defines optimization level
# -Wall turns on most, but not all, compiler warnings # -Og enable debugging
# -std=c99 use standard C from 1999 revision # -s strip unnecessary data from build
ifeq ($(PLATFORM),PLATFORM_RPI) # -Wall turns on most, but not all, compiler warnings
CFLAGS = -O2 -Wall -std=gnu99 -fgnu89-inline # -std=c99 defines C language mode (standard C from 1999 revision)
else # -std=gnu99 defines C language mode (GNU C from 1999 revision)
CFLAGS = -O2 -Wall -std=c99 # -fgnu89-inline declaring inline functions support (GCC optimized)
# -Wno-missing-braces ignore invalid warning (GCC bug 53119)
# -D_DEFAULT_SOURCE use with -std=c99 on Linux and PLATFORM_WEB, required for timespec
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
CFLAGS = -O2 -s -Wall -std=c99
endif
ifeq ($(PLATFORM_OS),LINUX)
CFLAGS = -O2 -s -Wall -std=c99 -D_DEFAULT_SOURCE
endif
ifeq ($(PLATFORM_OS),OSX)
CFLAGS = -O2 -s -Wall -std=c99
endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
CFLAGS = -O1 -Wall -std=c99 -s USE_GLFW=3 -s ALLOW_MEMORY_GROWTH=1 --preload-file resources --shell-file C:/raylib/raylib/templates/web_shell/shell.html CFLAGS = -O1 -Wall -std=c99 -D_DEFAULT_SOURCE -s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 --profiling --preload-file resources
#-s ASSERTIONS=1 # to check for memory allocation errors (-O1 disables it) # -O2 # if used, also set --memory-init-file 0
#-s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing # --memory-init-file 0 # to avoid an external memory initialization code file (.mem)
#-s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB) # -s ALLOW_MEMORY_GROWTH=1 # to allow memory resizing
# -s TOTAL_MEMORY=16777216 # to specify heap memory size (default = 16MB)
# --preload-file file.res # embbed file.res resource into .data file
endif
ifeq ($(PLATFORM),PLATFORM_RPI)
CFLAGS = -O2 -s -Wall -std=gnu99 -fgnu89-inline
endif endif
#CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes #CFLAGSEXTRA = -Wextra -Wmissing-prototypes -Wstrict-prototypes
# define any directories containing required header files # define raylib release directory for compiled library
ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),WINDOWS)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/win32/mingw32
endif
ifeq ($(PLATFORM_OS),LINUX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/linux
endif
ifeq ($(PLATFORM_OS),OSX)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/osx
endif
endif
ifeq ($(PLATFORM),PLATFORM_WEB)
RAYLIB_RELEASE = $(RAYLIB_PATH)/release/html5
endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES = -I. -I../../src -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads RAYLIB_RELEASE = $(RAYLIB_PATH)/release/rpi
endif
# define any directories containing required header files
INCLUDES = -I. -I$(RAYLIB_RELEASE) -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external
ifeq ($(PLATFORM),PLATFORM_RPI)
INCLUDES += -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux ifeq ($(PLATFORM_OS),WINDOWS)
ifeq ($(PLATFORM_OS),LINUX)
INCLUDES = -I. -I../src -I/usr/local/include/raylib/
else
INCLUDES = -I. -I../../src -IC:/raylib/raylib/src
# external libraries headers # external libraries headers
# GLFW3 # GLFW3
INCLUDES += -I../../external/glfw3/include INCLUDES += -I$(RAYLIB_PATH)/src/external/glfw3/include
# OpenAL Soft # OpenAL Soft
INCLUDES += -I../../external/openal_soft/include INCLUDES += -I$(RAYLIB_PATH)/src/external/openal_soft/include
endif
ifeq ($(PLATFORM_OS),LINUX)
# you may optionally create this directory and install raylib
# and related headers there. Edit ../src/Makefile appropriately.
INCLUDES += -I/usr/local/include/raylib
endif
ifeq ($(PLATFORM_OS),OSX)
# additional directories for MacOS
endif endif
endif endif
# define library paths containing required libs # define library paths containing required libs
LFLAGS = -L. -L$(RAYLIB_RELEASE) -L$(RAYLIB_PATH)/src
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
LFLAGS = -L. -L../../src -L/opt/vc/lib LFLAGS += -L/opt/vc/lib
endif endif
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# add standard directories for GNU/Linux # add standard directories for GNU/Linux
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS = -L. -L../../src
else
LFLAGS = -L. -L../../src
ifeq ($(PLATFORM_OS),WINDOWS)
LFLAGS += -LC:/GitHub/raylib/src
endif
# external libraries to link with # external libraries to link with
# GLFW3 # GLFW3
LFLAGS += -L../../external/glfw3/lib/$(LIBPATH) LFLAGS += -L$(RAYLIB_PATH)/src/external/glfw3/lib/$(LIBPATH)
ifneq ($(PLATFORM_OS),OSX) # OpenAL Soft
# OpenAL Soft LFLAGS += -L$(RAYLIB_PATH)/src/external/openal_soft/lib/$(LIBPATH)
LFLAGS += -L../../external/openal_soft/lib/$(LIBPATH)
endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB)
INCLUDES = -I. -I..
LFLAGS = -L. -L..
endif
# define any libraries to link into executable # define any libraries to link into executable
# if you want to link libraries (libname.so or libname.a), use the -lname # if you want to link libraries (libname.so or libname.a), use the -lname
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
@ -135,18 +173,26 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
# libraries for Debian GNU/Linux desktop compiling # libraries for Debian GNU/Linux desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -pthread -ldl -lX11 \ LIBS = -lraylib -lglfw3 -lGL -lopenal -lm -lpthread -ldl
-lXrandr -lXinerama -lXi -lXxf86vm -lXcursor # on XWindow requires also below libraries
LIBS += -lX11 -lXrandr -lXinerama -lXi -lXxf86vm -lXcursor
else else
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
# libraries for OS X 10.9 desktop compiling # libraries for OSX 10.9 desktop compiling
# requires the following packages: # requires the following packages:
# libglfw3-dev libopenal-dev libegl1-mesa-dev # libglfw3-dev libopenal-dev libegl1-mesa-dev
LIBS = -lraylib -lglfw3 -framework OpenGL -framework OpenAl -framework Cocoa LIBS = -lraylib -lglfw -framework OpenGL -framework OpenAL -framework Cocoa
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lwinmm -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lgdi32
# if static OpenAL Soft required, define the corresponding libs
ifeq ($(SHARED_OPENAL),NO)
LIBS += -lopenal32 -lwinmm
CFLAGS += -Wl,-allow-multiple-definition
else
LIBS += -lopenal32dll
endif
endif endif
endif endif
endif endif
@ -157,19 +203,19 @@ ifeq ($(PLATFORM),PLATFORM_RPI)
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
# NOTE: Set the correct path to libraylib.bc # NOTE: Set the correct path to libraylib.bc
LIBS = libraylib.bc LIBS = $(RAYLIB_RELEASE)/libraylib.bc
endif endif
# define additional parameters and flags for windows # define additional parameters and flags for windows
ifeq ($(PLATFORM_OS),WINDOWS) ifeq ($(PLATFORM_OS),WINDOWS)
# resources file contains windows exe icon # resources file contains windows exe icon
# -Wl,--subsystem,windows hides the console window # -Wl,--subsystem,windows hides the console window
WINFLAGS = C:/raylib/raylib/src/resources -Wl,-allow-multiple-definition WINFLAGS = $(RAYLIB_PATH)/src/resources -Wl,--subsystem,windows
# -Wl,--subsystem,windows
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
EXT = .html EXT = .html
WEB_SHELL = --shell-file $(RAYLIB_PATH)\templates\web_shell\shell.html
endif endif
# define all screen object files required # define all screen object files required
@ -179,13 +225,12 @@ SCREENS = \
screens/screen_gameplay.o \ screens/screen_gameplay.o \
screens/screen_ending.o \ screens/screen_ending.o \
# typing 'make' will invoke the default target entry called 'all', # typing 'make' will invoke the default target entry
# in this case, the 'default' target entry is advance_game
default: wave_collector default: wave_collector
# compile template - advance_game # compile program
wave_collector: wave_collector.c $(SCREENS) wave_collector: wave_collector.c $(SCREENS)
$(CC) -o $@$(EXT) $< $(SCREENS) $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(CC) -o $@$(EXT) $^ $(CFLAGS) $(INCLUDES) $(LFLAGS) $(LIBS) -D$(PLATFORM) $(WINFLAGS) $(WEB_SHELL)
# compile screen LOGO # compile screen LOGO
screens/screen_logo.o: screens/screen_logo.c screens/screen_logo.o: screens/screen_logo.c
@ -208,22 +253,21 @@ clean:
ifeq ($(PLATFORM),PLATFORM_DESKTOP) ifeq ($(PLATFORM),PLATFORM_DESKTOP)
ifeq ($(PLATFORM_OS),OSX) ifeq ($(PLATFORM_OS),OSX)
find . -type f -perm +ugo+x -delete find . -type f -perm +ugo+x -delete
rm -f screens/*.o rm -f *.o
else else
ifeq ($(PLATFORM_OS),LINUX) ifeq ($(PLATFORM_OS),LINUX)
find . -type f -executable -delete 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
rm -f screens/*.o
else else
del screens\*.o *.exe del *.o *.exe /s
endif endif
endif endif
endif endif
ifeq ($(PLATFORM),PLATFORM_RPI) ifeq ($(PLATFORM),PLATFORM_RPI)
find . -type f -executable -delete find . -type f -executable -delete
rm -f screens/*.o rm -f *.o
endif endif
ifeq ($(PLATFORM),PLATFORM_WEB) ifeq ($(PLATFORM),PLATFORM_WEB)
del screens/*.o *.html *.js del *.o *.html *.js
endif endif
@echo Cleaning done @echo Cleaning done

View File

@ -68,6 +68,7 @@
//------------------------------------------------- //-------------------------------------------------
#define SUPPORT_FILEFORMAT_WAV #define SUPPORT_FILEFORMAT_WAV
#define SUPPORT_FILEFORMAT_OGG #define SUPPORT_FILEFORMAT_OGG
#define SUPPORT_FILEFORMAT_XM
//------------------------------------------------- //-------------------------------------------------
#if defined(AUDIO_STANDALONE) #if defined(AUDIO_STANDALONE)
@ -75,7 +76,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#else #else
#include "raylib.h" #include "raylib.h"
#include "utils.h" // Required for: fopen() Android mapping, TraceLog() #include "utils.h" // Required for: fopen() Android mapping
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__

View File

@ -81,7 +81,7 @@
#include "raylib.h" #include "raylib.h"
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2 #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
#include "utils.h" // Required for: fopen() Android mapping, TraceLog() #include "utils.h" // Required for: fopen() Android mapping
#define RAYMATH_IMPLEMENTATION // Use raymath as a header-only library (includes implementation) #define RAYMATH_IMPLEMENTATION // Use raymath as a header-only library (includes implementation)
#define RAYMATH_EXTERN_INLINE // Compile raymath functions as static inline (remember, it's a compiler hint) #define RAYMATH_EXTERN_INLINE // Compile raymath functions as static inline (remember, it's a compiler hint)

View File

@ -168,7 +168,7 @@
#include <math.h> #include <math.h>
// find definition of alloca if it's not in stdlib.h: // find definition of alloca if it's not in stdlib.h:
#ifdef _MSC_VER #if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h> #include <malloc.h>
#endif #endif
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__) #if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__)

View File

@ -607,13 +607,13 @@ Mesh LoadMesh(const char *fileName)
} }
// Load mesh from vertex data // Load mesh from vertex data
// NOTE: All vertex data arrays must be same size: numVertex // NOTE: All vertex data arrays must be same size: vertexCount
Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData) Mesh LoadMeshEx(int vertexCount, float *vData, float *vtData, float *vnData, Color *cData)
{ {
Mesh mesh = { 0 }; Mesh mesh = { 0 };
mesh.vertexCount = numVertex; mesh.vertexCount = vertexCount;
mesh.triangleCount = numVertex/3; mesh.triangleCount = vertexCount/3;
mesh.vertices = vData; mesh.vertices = vData;
mesh.texcoords = vtData; mesh.texcoords = vtData;
mesh.texcoords2 = NULL; mesh.texcoords2 = NULL;
@ -754,9 +754,9 @@ static Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
Color *pixels = GetImageData(heightmap); Color *pixels = GetImageData(heightmap);
// NOTE: One vertex per pixel // NOTE: One vertex per pixel
int numTriangles = (mapX-1)*(mapZ-1)*2; // One quad every four pixels int triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
mesh.vertexCount = numTriangles*3; mesh.vertexCount = triangleCount*3;
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float)); mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float)); mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float));
@ -1615,10 +1615,10 @@ static Mesh LoadOBJ(const char *fileName)
char dataType; char dataType;
char comments[200]; char comments[200];
int numVertex = 0; int vertexCount = 0;
int numNormals = 0; int normalCount = 0;
int numTexCoords = 0; int texcoordCount = 0;
int numTriangles = 0; int triangleCount = 0;
FILE *objFile; FILE *objFile;
@ -1630,7 +1630,7 @@ static Mesh LoadOBJ(const char *fileName)
return mesh; return mesh;
} }
// First reading pass: Get numVertex, numNormals, numTexCoords, numTriangles // First reading pass: Get vertexCount, normalCount, texcoordCount, triangleCount
// NOTE: vertex, texcoords and normals could be optimized (to be used indexed on faces definition) // NOTE: vertex, texcoords and normals could be optimized (to be used indexed on faces definition)
// NOTE: faces MUST be defined as TRIANGLES (3 vertex per face) // NOTE: faces MUST be defined as TRIANGLES (3 vertex per face)
while (!feof(objFile)) while (!feof(objFile))
@ -1654,40 +1654,40 @@ static Mesh LoadOBJ(const char *fileName)
if (dataType == 't') // Read texCoord if (dataType == 't') // Read texCoord
{ {
numTexCoords++; texcoordCount++;
fgets(comments, 200, objFile); fgets(comments, 200, objFile);
} }
else if (dataType == 'n') // Read normals else if (dataType == 'n') // Read normals
{ {
numNormals++; normalCount++;
fgets(comments, 200, objFile); fgets(comments, 200, objFile);
} }
else // Read vertex else // Read vertex
{ {
numVertex++; vertexCount++;
fgets(comments, 200, objFile); fgets(comments, 200, objFile);
} }
} break; } break;
case 'f': case 'f':
{ {
numTriangles++; triangleCount++;
fgets(comments, 200, objFile); fgets(comments, 200, objFile);
} break; } break;
default: break; default: break;
} }
} }
TraceLog(DEBUG, "[%s] Model num vertices: %i", fileName, numVertex); TraceLog(DEBUG, "[%s] Model vertices: %i", fileName, vertexCount);
TraceLog(DEBUG, "[%s] Model num texcoords: %i", fileName, numTexCoords); TraceLog(DEBUG, "[%s] Model texcoords: %i", fileName, texcoordCount);
TraceLog(DEBUG, "[%s] Model num normals: %i", fileName, numNormals); TraceLog(DEBUG, "[%s] Model normals: %i", fileName, normalCount);
TraceLog(DEBUG, "[%s] Model num triangles: %i", fileName, numTriangles); TraceLog(DEBUG, "[%s] Model triangles: %i", fileName, triangleCount);
// Once we know the number of vertices to store, we create required arrays // Once we know the number of vertices to store, we create required arrays
Vector3 *midVertices = (Vector3 *)malloc(numVertex*sizeof(Vector3)); Vector3 *midVertices = (Vector3 *)malloc(vertexCount*sizeof(Vector3));
Vector3 *midNormals = NULL; Vector3 *midNormals = NULL;
if (numNormals > 0) midNormals = (Vector3 *)malloc(numNormals*sizeof(Vector3)); if (normalCount > 0) midNormals = (Vector3 *)malloc(normalCount*sizeof(Vector3));
Vector2 *midTexCoords = NULL; Vector2 *midTexCoords = NULL;
if (numTexCoords > 0) midTexCoords = (Vector2 *)malloc(numTexCoords*sizeof(Vector2)); if (texcoordCount > 0) midTexCoords = (Vector2 *)malloc(texcoordCount*sizeof(Vector2));
int countVertex = 0; int countVertex = 0;
int countNormals = 0; int countNormals = 0;
@ -1738,7 +1738,7 @@ static Mesh LoadOBJ(const char *fileName)
// At this point all vertex data (v, vt, vn) has been gathered on midVertices, midTexCoords, midNormals // At this point all vertex data (v, vt, vn) has been gathered on midVertices, midTexCoords, midNormals
// Now we can organize that data into our Mesh struct // Now we can organize that data into our Mesh struct
mesh.vertexCount = numTriangles*3; mesh.vertexCount = triangleCount*3;
// Additional arrays to store vertex data as floats // Additional arrays to store vertex data as floats
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float)); mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
@ -1750,11 +1750,11 @@ static Mesh LoadOBJ(const char *fileName)
int tcCounter = 0; // Used to count texcoords float by float int tcCounter = 0; // Used to count texcoords float by float
int nCounter = 0; // Used to count normals float by float int nCounter = 0; // Used to count normals float by float
int vNum[3], vtNum[3], vnNum[3]; // Used to store triangle indices for v, vt, vn int vCount[3], vtCount[3], vnCount[3]; // Used to store triangle indices for v, vt, vn
rewind(objFile); // Return to the beginning of the file, to read again rewind(objFile); // Return to the beginning of the file, to read again
if (numNormals == 0) TraceLog(INFO, "[%s] No normals data on OBJ, normals will be generated from faces data", fileName); if (normalCount == 0) TraceLog(INFO, "[%s] No normals data on OBJ, normals will be generated from faces data", fileName);
// Third reading pass: Get faces (triangles) data and fill VertexArray // Third reading pass: Get faces (triangles) data and fill VertexArray
while (!feof(objFile)) while (!feof(objFile))
@ -1768,43 +1768,43 @@ static Mesh LoadOBJ(const char *fileName)
{ {
// NOTE: It could be that OBJ does not have normals or texcoords defined! // NOTE: It could be that OBJ does not have normals or texcoords defined!
if ((numNormals == 0) && (numTexCoords == 0)) fscanf(objFile, "%i %i %i", &vNum[0], &vNum[1], &vNum[2]); if ((normalCount == 0) && (texcoordCount == 0)) fscanf(objFile, "%i %i %i", &vCount[0], &vCount[1], &vCount[2]);
else if (numNormals == 0) fscanf(objFile, "%i/%i %i/%i %i/%i", &vNum[0], &vtNum[0], &vNum[1], &vtNum[1], &vNum[2], &vtNum[2]); else if (normalCount == 0) fscanf(objFile, "%i/%i %i/%i %i/%i", &vCount[0], &vtCount[0], &vCount[1], &vtCount[1], &vCount[2], &vtCount[2]);
else if (numTexCoords == 0) fscanf(objFile, "%i//%i %i//%i %i//%i", &vNum[0], &vnNum[0], &vNum[1], &vnNum[1], &vNum[2], &vnNum[2]); else if (texcoordCount == 0) fscanf(objFile, "%i//%i %i//%i %i//%i", &vCount[0], &vnCount[0], &vCount[1], &vnCount[1], &vCount[2], &vnCount[2]);
else fscanf(objFile, "%i/%i/%i %i/%i/%i %i/%i/%i", &vNum[0], &vtNum[0], &vnNum[0], &vNum[1], &vtNum[1], &vnNum[1], &vNum[2], &vtNum[2], &vnNum[2]); else fscanf(objFile, "%i/%i/%i %i/%i/%i %i/%i/%i", &vCount[0], &vtCount[0], &vnCount[0], &vCount[1], &vtCount[1], &vnCount[1], &vCount[2], &vtCount[2], &vnCount[2]);
mesh.vertices[vCounter] = midVertices[vNum[0]-1].x; mesh.vertices[vCounter] = midVertices[vCount[0]-1].x;
mesh.vertices[vCounter + 1] = midVertices[vNum[0]-1].y; mesh.vertices[vCounter + 1] = midVertices[vCount[0]-1].y;
mesh.vertices[vCounter + 2] = midVertices[vNum[0]-1].z; mesh.vertices[vCounter + 2] = midVertices[vCount[0]-1].z;
vCounter += 3; vCounter += 3;
mesh.vertices[vCounter] = midVertices[vNum[1]-1].x; mesh.vertices[vCounter] = midVertices[vCount[1]-1].x;
mesh.vertices[vCounter + 1] = midVertices[vNum[1]-1].y; mesh.vertices[vCounter + 1] = midVertices[vCount[1]-1].y;
mesh.vertices[vCounter + 2] = midVertices[vNum[1]-1].z; mesh.vertices[vCounter + 2] = midVertices[vCount[1]-1].z;
vCounter += 3; vCounter += 3;
mesh.vertices[vCounter] = midVertices[vNum[2]-1].x; mesh.vertices[vCounter] = midVertices[vCount[2]-1].x;
mesh.vertices[vCounter + 1] = midVertices[vNum[2]-1].y; mesh.vertices[vCounter + 1] = midVertices[vCount[2]-1].y;
mesh.vertices[vCounter + 2] = midVertices[vNum[2]-1].z; mesh.vertices[vCounter + 2] = midVertices[vCount[2]-1].z;
vCounter += 3; vCounter += 3;
if (numNormals > 0) if (normalCount > 0)
{ {
mesh.normals[nCounter] = midNormals[vnNum[0]-1].x; mesh.normals[nCounter] = midNormals[vnCount[0]-1].x;
mesh.normals[nCounter + 1] = midNormals[vnNum[0]-1].y; mesh.normals[nCounter + 1] = midNormals[vnCount[0]-1].y;
mesh.normals[nCounter + 2] = midNormals[vnNum[0]-1].z; mesh.normals[nCounter + 2] = midNormals[vnCount[0]-1].z;
nCounter += 3; nCounter += 3;
mesh.normals[nCounter] = midNormals[vnNum[1]-1].x; mesh.normals[nCounter] = midNormals[vnCount[1]-1].x;
mesh.normals[nCounter + 1] = midNormals[vnNum[1]-1].y; mesh.normals[nCounter + 1] = midNormals[vnCount[1]-1].y;
mesh.normals[nCounter + 2] = midNormals[vnNum[1]-1].z; mesh.normals[nCounter + 2] = midNormals[vnCount[1]-1].z;
nCounter += 3; nCounter += 3;
mesh.normals[nCounter] = midNormals[vnNum[2]-1].x; mesh.normals[nCounter] = midNormals[vnCount[2]-1].x;
mesh.normals[nCounter + 1] = midNormals[vnNum[2]-1].y; mesh.normals[nCounter + 1] = midNormals[vnCount[2]-1].y;
mesh.normals[nCounter + 2] = midNormals[vnNum[2]-1].z; mesh.normals[nCounter + 2] = midNormals[vnCount[2]-1].z;
nCounter += 3; nCounter += 3;
} }
else else
{ {
// If normals not defined, they are calculated from the 3 vertices [N = (V2 - V1) x (V3 - V1)] // If normals not defined, they are calculated from the 3 vertices [N = (V2 - V1) x (V3 - V1)]
Vector3 norm = VectorCrossProduct(VectorSubtract(midVertices[vNum[1]-1], midVertices[vNum[0]-1]), VectorSubtract(midVertices[vNum[2]-1], midVertices[vNum[0]-1])); Vector3 norm = VectorCrossProduct(VectorSubtract(midVertices[vCount[1]-1], midVertices[vCount[0]-1]), VectorSubtract(midVertices[vCount[2]-1], midVertices[vCount[0]-1]));
VectorNormalize(&norm); VectorNormalize(&norm);
mesh.normals[nCounter] = norm.x; mesh.normals[nCounter] = norm.x;
@ -1821,18 +1821,18 @@ static Mesh LoadOBJ(const char *fileName)
nCounter += 3; nCounter += 3;
} }
if (numTexCoords > 0) if (texcoordCount > 0)
{ {
// NOTE: If using negative texture coordinates with a texture filter of GL_CLAMP_TO_EDGE doesn't work! // NOTE: If using negative texture coordinates with a texture filter of GL_CLAMP_TO_EDGE doesn't work!
// NOTE: Texture coordinates are Y flipped upside-down // NOTE: Texture coordinates are Y flipped upside-down
mesh.texcoords[tcCounter] = midTexCoords[vtNum[0]-1].x; mesh.texcoords[tcCounter] = midTexCoords[vtCount[0]-1].x;
mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[0]-1].y; mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[0]-1].y;
tcCounter += 2; tcCounter += 2;
mesh.texcoords[tcCounter] = midTexCoords[vtNum[1]-1].x; mesh.texcoords[tcCounter] = midTexCoords[vtCount[1]-1].x;
mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[1]-1].y; mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[1]-1].y;
tcCounter += 2; tcCounter += 2;
mesh.texcoords[tcCounter] = midTexCoords[vtNum[2]-1].x; mesh.texcoords[tcCounter] = midTexCoords[vtCount[2]-1].x;
mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[2]-1].y; mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[2]-1].y;
tcCounter += 2; tcCounter += 2;
} }
} break; } break;
@ -1843,7 +1843,7 @@ static Mesh LoadOBJ(const char *fileName)
fclose(objFile); fclose(objFile);
// Security check, just in case no normals or no texcoords defined in OBJ // Security check, just in case no normals or no texcoords defined in OBJ
if (numTexCoords == 0) for (int i = 0; i < (2*mesh.vertexCount); i++) mesh.texcoords[i] = 0.0f; if (texcoordCount == 0) for (int i = 0; i < (2*mesh.vertexCount); i++) mesh.texcoords[i] = 0.0f;
else else
{ {
// Attempt to calculate mesh tangents and binormals using positions and texture coordinates // Attempt to calculate mesh tangents and binormals using positions and texture coordinates

View File

@ -74,7 +74,6 @@
//#define PLATFORM_ANDROID // Android device //#define PLATFORM_ANDROID // Android device
//#define PLATFORM_RPI // Raspberry Pi //#define PLATFORM_RPI // Raspberry Pi
//#define PLATFORM_WEB // HTML5 (emscripten, asm.js) //#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
//#define RLGL_OCULUS_SUPPORT // Oculus Rift CV1 (complementary to PLATFORM_DESKTOP)
// Security check in case no PLATFORM_* defined // Security check in case no PLATFORM_* defined
#if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB) #if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB)
@ -295,7 +294,7 @@
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo) #define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#ifndef __cplusplus #ifndef __cplusplus
// Boolean type // Boolean type
@ -516,6 +515,34 @@ typedef struct AudioStream {
unsigned int buffers[2]; // OpenAL audio buffers (double buffering) unsigned int buffers[2]; // OpenAL audio buffers (double buffering)
} AudioStream; } AudioStream;
// rRES data returned when reading a resource,
// it contains all required data for user (24 byte)
typedef struct RRESData {
unsigned int type; // Resource type (4 byte)
unsigned int param1; // Resouce parameter 1 (4 byte)
unsigned int param2; // Resouce parameter 2 (4 byte)
unsigned int param3; // Resouce parameter 3 (4 byte)
unsigned int param4; // Resouce parameter 4 (4 byte)
void *data; // Resource data pointer (4 byte)
} RRESData;
// RRES type (pointer to RRESData array)
typedef struct RRESData *RRES;
//----------------------------------------------------------------------------------
// Enumerators Definition
//----------------------------------------------------------------------------------
// Trace log type
typedef enum {
INFO = 0,
WARNING,
ERROR,
DEBUG,
OTHER
} LogType;
// Texture formats // Texture formats
// NOTE: Support depends on OpenGL version and platform // NOTE: Support depends on OpenGL version and platform
typedef enum { typedef enum {
@ -552,10 +579,18 @@ typedef enum {
} TextureFilterMode; } TextureFilterMode;
// Texture parameters: wrap mode // Texture parameters: wrap mode
typedef enum { WRAP_REPEAT = 0, WRAP_CLAMP, WRAP_MIRROR } TextureWrapMode; typedef enum {
WRAP_REPEAT = 0,
WRAP_CLAMP,
WRAP_MIRROR
} TextureWrapMode;
// Color blending modes (pre-defined) // Color blending modes (pre-defined)
typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode; typedef enum {
BLEND_ALPHA = 0,
BLEND_ADDITIVE,
BLEND_MULTIPLIED
} BlendMode;
// Gestures type // Gestures type
// NOTE: It could be used as flags to enable only some gestures // NOTE: It could be used as flags to enable only some gestures
@ -595,19 +630,6 @@ typedef enum {
HMD_FOVE_VR, HMD_FOVE_VR,
} VrDevice; } VrDevice;
// rRES data returned when reading a resource,
// it contains all required data for user (24 byte)
typedef struct RRESData {
unsigned int type; // Resource type (4 byte)
unsigned int param1; // Resouce parameter 1 (4 byte)
unsigned int param2; // Resouce parameter 2 (4 byte)
unsigned int param3; // Resouce parameter 3 (4 byte)
unsigned int param4; // Resouce parameter 4 (4 byte)
void *data; // Resource data pointer (4 byte)
} RRESData;
// RRESData type // RRESData type
typedef enum { typedef enum {
RRES_TYPE_RAW = 0, RRES_TYPE_RAW = 0,
@ -620,9 +642,6 @@ typedef enum {
RRES_TYPE_DIRECTORY RRES_TYPE_DIRECTORY
} RRESDataType; } RRESDataType;
// RRES type (pointer to RRESData array)
typedef struct RRESData *RRES;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { // Prevents name mangling of functions extern "C" { // Prevents name mangling of functions
#endif #endif
@ -689,7 +708,7 @@ RLAPI Color Fade(Color color, float alpha); // Color fade-
RLAPI void ShowLogo(void); // Activates raylib logo at startup (can be done with flags) RLAPI void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
RLAPI void SetConfigFlags(char flags); // Setup some window configuration flags RLAPI void SetConfigFlags(char flags); // Setup some window configuration flags
//RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG) RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG)
RLAPI void TakeScreenshot(void); // Takes a screenshot and saves it in the same folder as executable RLAPI void TakeScreenshot(void); // Takes a screenshot and saves it in the same folder as executable
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
@ -847,7 +866,7 @@ RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle dest
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
RLAPI SpriteFont GetDefaultFont(void); // Get the default SpriteFont RLAPI SpriteFont GetDefaultFont(void); // Get the default SpriteFont
RLAPI SpriteFont LoadSpriteFont(const char *fileName); // Load SpriteFont from file into GPU memory (VRAM) RLAPI SpriteFont LoadSpriteFont(const char *fileName); // Load SpriteFont from file into GPU memory (VRAM)
RLAPI SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load SpriteFont from TTF font file with generation parameters RLAPI SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load SpriteFont from file with extended parameters
RLAPI void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory (VRAM) RLAPI void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory (VRAM)
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)

View File

@ -1331,7 +1331,7 @@ Vector3 rlglUnproject(Vector3 source, Matrix proj, Matrix view)
} }
// Convert image data to OpenGL texture (returns OpenGL valid Id) // Convert image data to OpenGL texture (returns OpenGL valid Id)
unsigned int rlglLoadTexture(void *data, int width, int height, int textureFormat, int mipmapCount) unsigned int rlglLoadTexture(void *data, int width, int height, int format, int mipmapCount)
{ {
glBindTexture(GL_TEXTURE_2D, 0); // Free any old binding glBindTexture(GL_TEXTURE_2D, 0); // Free any old binding
@ -1339,39 +1339,39 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
// Check texture format support by OpenGL 1.1 (compressed textures not supported) // Check texture format support by OpenGL 1.1 (compressed textures not supported)
#if defined(GRAPHICS_API_OPENGL_11) #if defined(GRAPHICS_API_OPENGL_11)
if (textureFormat >= 8) if (format >= COMPRESSED_DXT1_RGB)
{ {
TraceLog(WARNING, "OpenGL 1.1 does not support GPU compressed texture formats"); TraceLog(WARNING, "OpenGL 1.1 does not support GPU compressed texture formats");
return id; return id;
} }
#endif #endif
if ((!texCompDXTSupported) && ((textureFormat == COMPRESSED_DXT1_RGB) || (textureFormat == COMPRESSED_DXT1_RGBA) || if ((!texCompDXTSupported) && ((format == COMPRESSED_DXT1_RGB) || (format == COMPRESSED_DXT1_RGBA) ||
(textureFormat == COMPRESSED_DXT3_RGBA) || (textureFormat == COMPRESSED_DXT5_RGBA))) (format == COMPRESSED_DXT3_RGBA) || (format == COMPRESSED_DXT5_RGBA)))
{ {
TraceLog(WARNING, "DXT compressed texture format not supported"); TraceLog(WARNING, "DXT compressed texture format not supported");
return id; return id;
} }
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2) #if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if ((!texCompETC1Supported) && (textureFormat == COMPRESSED_ETC1_RGB)) if ((!texCompETC1Supported) && (format == COMPRESSED_ETC1_RGB))
{ {
TraceLog(WARNING, "ETC1 compressed texture format not supported"); TraceLog(WARNING, "ETC1 compressed texture format not supported");
return id; return id;
} }
if ((!texCompETC2Supported) && ((textureFormat == COMPRESSED_ETC2_RGB) || (textureFormat == COMPRESSED_ETC2_EAC_RGBA))) if ((!texCompETC2Supported) && ((format == COMPRESSED_ETC2_RGB) || (format == COMPRESSED_ETC2_EAC_RGBA)))
{ {
TraceLog(WARNING, "ETC2 compressed texture format not supported"); TraceLog(WARNING, "ETC2 compressed texture format not supported");
return id; return id;
} }
if ((!texCompPVRTSupported) && ((textureFormat == COMPRESSED_PVRT_RGB) || (textureFormat == COMPRESSED_PVRT_RGBA))) if ((!texCompPVRTSupported) && ((format == COMPRESSED_PVRT_RGB) || (format == COMPRESSED_PVRT_RGBA)))
{ {
TraceLog(WARNING, "PVRT compressed texture format not supported"); TraceLog(WARNING, "PVRT compressed texture format not supported");
return id; return id;
} }
if ((!texCompASTCSupported) && ((textureFormat == COMPRESSED_ASTC_4x4_RGBA) || (textureFormat == COMPRESSED_ASTC_8x8_RGBA))) if ((!texCompASTCSupported) && ((format == COMPRESSED_ASTC_4x4_RGBA) || (format == COMPRESSED_ASTC_8x8_RGBA)))
{ {
TraceLog(WARNING, "ASTC compressed texture format not supported"); TraceLog(WARNING, "ASTC compressed texture format not supported");
return id; return id;
@ -1399,7 +1399,7 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
// GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE // GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE
// GL_RGB8 GL_RGB GL_UNSIGNED_BYTE // GL_RGB8 GL_RGB GL_UNSIGNED_BYTE
switch (textureFormat) switch (format)
{ {
case UNCOMPRESSED_GRAYSCALE: case UNCOMPRESSED_GRAYSCALE:
{ {
@ -1440,7 +1440,7 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
} }
#elif defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_ES2) #elif defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_ES2)
// NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA // NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA
switch (textureFormat) switch (format)
{ {
case UNCOMPRESSED_GRAYSCALE: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (unsigned char *)data); break; case UNCOMPRESSED_GRAYSCALE: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
case UNCOMPRESSED_GRAY_ALPHA: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (unsigned char *)data); break; case UNCOMPRESSED_GRAY_ALPHA: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;

View File

@ -366,7 +366,7 @@ void rlglClose(void); // De-init rlgl
void rlglDraw(void); // Draw VAO/VBO void rlglDraw(void); // Draw VAO/VBO
void rlglLoadExtensions(void *loader); // Load OpenGL extensions void rlglLoadExtensions(void *loader); // Load OpenGL extensions
unsigned int rlglLoadTexture(void *data, int width, int height, int textureFormat, int mipmapCount); // Load texture in GPU unsigned int rlglLoadTexture(void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU
RenderTexture2D rlglLoadRenderTexture(int width, int height); // Load a texture to be used for rendering (fbo with color and depth attachments) RenderTexture2D rlglLoadRenderTexture(int width, int height); // Load a texture to be used for rendering (fbo with color and depth attachments)
void rlglUpdateTexture(unsigned int id, int width, int height, int format, const void *data); // Update GPU texture with new data void rlglUpdateTexture(unsigned int id, int width, int height, int format, const void *data); // Update GPU texture with new data
void rlglGenerateMipmaps(Texture2D *texture); // Generate mipmap data for selected texture void rlglGenerateMipmaps(Texture2D *texture); // Generate mipmap data for selected texture

View File

@ -50,7 +50,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() #include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets() #include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets()
#include "utils.h" // Required for: IsFileExtension() #include "utils.h" // Required for: fopen() Android mapping
#if defined(SUPPORT_FILEFORMAT_TTF) #if defined(SUPPORT_FILEFORMAT_TTF)
// Following libs are used on LoadTTF() // Following libs are used on LoadTTF()
@ -316,7 +316,7 @@ SpriteFont LoadSpriteFont(const char *fileName)
//UnloadResource(rres[0]); //UnloadResource(rres[0]);
} }
#if defined(SUPPORT_FILEFORMAT_TTF) #if defined(SUPPORT_FILEFORMAT_TTF)
else if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontTTF(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL); else if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL);
#endif #endif
#if defined(SUPPORT_FILEFORMAT_FNT) #if defined(SUPPORT_FILEFORMAT_FNT)
else if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName); else if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName);
@ -341,7 +341,7 @@ SpriteFont LoadSpriteFont(const char *fileName)
// Load SpriteFont from TTF font file with generation parameters // Load SpriteFont from TTF font file with generation parameters
// NOTE: You can pass an array with desired characters, those characters should be available in the font // NOTE: You can pass an array with desired characters, those characters should be available in the font
// if array is NULL, default char set is selected 32..126 // if array is NULL, default char set is selected 32..126
SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount, int *fontChars) SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars)
{ {
SpriteFont spriteFont = { 0 }; SpriteFont spriteFont = { 0 };

View File

@ -65,7 +65,7 @@
// Required for: rlglLoadTexture() rlDeleteTextures(), // Required for: rlglLoadTexture() rlDeleteTextures(),
// rlglGenerateMipmaps(), some funcs for DrawTexturePro() // rlglGenerateMipmaps(), some funcs for DrawTexturePro()
#include "utils.h" // Required for: fopen() Android mapping, TraceLog() #include "utils.h" // Required for: fopen() Android mapping
// Support only desired texture formats on stb_image // Support only desired texture formats on stb_image
#if !defined(SUPPORT_FILEFORMAT_BMP) #if !defined(SUPPORT_FILEFORMAT_BMP)
@ -379,6 +379,8 @@ Texture2D LoadTextureFromImage(Image image)
texture.height = image.height; texture.height = image.height;
texture.mipmaps = image.mipmaps; texture.mipmaps = image.mipmaps;
texture.format = image.format; texture.format = image.format;
TraceLog(INFO, "[TEX %i] Parameters: %ix%i, %i mips, format %i", texture.id, texture.width, texture.height, texture.mipmaps, texture.format);
return texture; return texture;
} }

View File

@ -46,8 +46,6 @@
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { // Prevents name mangling of functions extern "C" { // Prevents name mangling of functions
#endif #endif
@ -60,8 +58,6 @@ extern "C" { // Prevents name mangling of functions
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Module Functions Declaration // Module Functions Declaration
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
void TraceLog(int msgType, const char *text, ...); // Outputs a trace log message
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI) #if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
#if defined(SUPPORT_SAVE_BMP) #if defined(SUPPORT_SAVE_BMP)
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize); void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);

View File

@ -141,7 +141,7 @@ ifeq ($(PLATFORM),PLATFORM_DESKTOP)
else else
# libraries for Windows desktop compiling # libraries for Windows desktop compiling
# NOTE: GLFW3 and OpenAL Soft libraries should be installed # NOTE: GLFW3 and OpenAL Soft libraries should be installed
LIBS = -lraylib -lglfw3 -lglew32 -lopengl32 -lopenal32 -lgdi32 LIBS = -lraylib -lglfw3 -lopengl32 -lopenal32 -lgdi32
endif endif
endif endif
endif endif

View File

@ -57,7 +57,7 @@
div.emscripten_border { border: 1px solid black; } div.emscripten_border { border: 1px solid black; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */ /* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; } canvas.emscripten { border: 0px none; background: black; }
#emscripten_logo { #emscripten_logo {
display: inline-block; display: inline-block;