Unverified Commit 268d940d authored by Rob Loach's avatar Rob Loach Committed by GitHub
Browse files

Merge pull request #311 from libretro/dev

0.26.0
parents d87e919f 20b6a69a
......@@ -4,6 +4,11 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## 0.26.0 - 2018-09-13
### Features
- Added a global `require()` function to load modules ([#308](https://github.com/libretro/libretro-chailove/pull/308))
- Added OEM-102 key support (sometimes `\` on EUR keyboard) ([#309](https://github.com/libretro/libretro-chailove/pull/309))
## 0.25.1 - 2018-09-11
### Fixes
- Fix Windows build
......
......@@ -3,10 +3,10 @@ SOURCES_CXX := $(wildcard \
$(CORE_DIR)/src/*.cpp \
$(CORE_DIR)/src/love/*.cpp \
$(CORE_DIR)/src/love/Types/Audio/*.cpp \
$(CORE_DIR)/src/love/Types/Config/*.cpp \
$(CORE_DIR)/src/love/Types/FileSystem/*.cpp \
$(CORE_DIR)/src/love/Types/Graphics/*.cpp \
$(CORE_DIR)/src/love/Types/Input/*.cpp \
$(CORE_DIR)/src/love/Types/Config/*.cpp \
)
# semver
......@@ -26,25 +26,25 @@ FLAGS += -I$(CORE_DIR)/vendor/libretro-common/include
SOURCES_C += $(wildcard \
$(CORE_DIR)/vendor/libretro-common/audio/audio_mix.c \
$(CORE_DIR)/vendor/libretro-common/audio/audio_mixer.c \
$(CORE_DIR)/vendor/libretro-common/formats/wav/rwav.c \
$(CORE_DIR)/vendor/libretro-common/memmap/memalign.c \
$(CORE_DIR)/vendor/libretro-common/audio/conversion/*.c \
$(CORE_DIR)/vendor/libretro-common/streams/file_stream.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/audio_resampler.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/drivers/sinc_resampler.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/drivers/null_resampler.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/drivers/nearest_resampler.c \
$(CORE_DIR)/vendor/libretro-common/vfs/*.c \
$(CORE_DIR)/vendor/libretro-common/features/features_cpu.c \
$(CORE_DIR)/vendor/libretro-common/file/config_file_userdata.c \
$(CORE_DIR)/vendor/libretro-common/file/file_path.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/drivers/null_resampler.c \
$(CORE_DIR)/vendor/libretro-common/audio/resampler/drivers/sinc_resampler.c \
$(CORE_DIR)/vendor/libretro-common/compat/compat_posix_string.c \
$(CORE_DIR)/vendor/libretro-common/compat/compat_strcasestr.c \
$(CORE_DIR)/vendor/libretro-common/compat/compat_strl.c \
$(CORE_DIR)/vendor/libretro-common/compat/fopen_utf8.c \
$(CORE_DIR)/vendor/libretro-common/compat/compat_posix_string.c \
$(CORE_DIR)/vendor/libretro-common/encodings/encoding_utf.c \
$(CORE_DIR)/vendor/libretro-common/features/features_cpu.c \
$(CORE_DIR)/vendor/libretro-common/file/config_file.c \
$(CORE_DIR)/vendor/libretro-common/file/config_file_userdata.c \
$(CORE_DIR)/vendor/libretro-common/file/file_path.c \
$(CORE_DIR)/vendor/libretro-common/formats/wav/rwav.c \
$(CORE_DIR)/vendor/libretro-common/lists/string_list.c \
$(CORE_DIR)/vendor/libretro-common/compat/compat_strcasestr.c \
$(CORE_DIR)/vendor/libretro-common/memmap/memalign.c \
$(CORE_DIR)/vendor/libretro-common/streams/file_stream.c \
$(CORE_DIR)/vendor/libretro-common/vfs/*.c \
)
# stb_vorbis
......@@ -54,10 +54,9 @@ FLAGS += -I$(CORE_DIR)/vendor/libretro-deps
# zlib
SOURCES_C += \
$(CORE_DIR)/vendor/libretro-deps/libz/zutil.c \
$(CORE_DIR)/vendor/libretro-deps/libz/adler32.c \
$(CORE_DIR)/vendor/libretro-deps/libz/crc32.c \
$(CORE_DIR)/vendor/libretro-deps/libz/compress.c \
$(CORE_DIR)/vendor/libretro-deps/libz/crc32.c \
$(CORE_DIR)/vendor/libretro-deps/libz/deflate.c \
$(CORE_DIR)/vendor/libretro-deps/libz/gzclose.c \
$(CORE_DIR)/vendor/libretro-deps/libz/gzlib.c \
......@@ -65,9 +64,10 @@ SOURCES_C += \
$(CORE_DIR)/vendor/libretro-deps/libz/gzwrite.c \
$(CORE_DIR)/vendor/libretro-deps/libz/infback.c \
$(CORE_DIR)/vendor/libretro-deps/libz/inffast.c \
$(CORE_DIR)/vendor/libretro-deps/libz/inftrees.c \
$(CORE_DIR)/vendor/libretro-deps/libz/inflate.c \
$(CORE_DIR)/vendor/libretro-deps/libz/trees.c
$(CORE_DIR)/vendor/libretro-deps/libz/inftrees.c \
$(CORE_DIR)/vendor/libretro-deps/libz/trees.c \
$(CORE_DIR)/vendor/libretro-deps/libz/zutil.c
FLAGS += -I$(CORE_DIR)/vendor/libretro-deps/libz
FLAGS += -I$(CORE_DIR)/vendor/libretro-common/compat
FLAGS += -DWANT_ZLIB
......@@ -91,8 +91,8 @@ endif
# SDL_tty
FLAGS += -I$(CORE_DIR)/vendor/SDL_tty/include
SOURCES_C += $(wildcard \
$(CORE_DIR)/vendor/SDL_tty/src/SDL_tty.c \
$(CORE_DIR)/vendor/SDL_tty/src/SDL_fnt.c \
$(CORE_DIR)/vendor/SDL_tty/src/SDL_tty.c \
)
# SDL_gfx
......@@ -117,48 +117,48 @@ FLAGS += -DFT2_BUILD_LIBRARY \
-DFT_USE_GXV
SOURCES_C += \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/autofit/autofit.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftbase.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftinit.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftsystem.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftdebug.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftbbox.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftbdf.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftstroke.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftbitmap.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftcid.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftdebug.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftfntfmt.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftfstype.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftgasp.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftglyph.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftgxval.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftinit.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftlcdfil.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftmm.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftotval.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftpatent.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftpfr.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftstroke.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftsynth.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftsystem.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/fttype1.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/base/ftwinfnt.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/autofit/autofit.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/pshinter/pshinter.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/psaux/psaux.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/psnames/psnames.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/raster/raster.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/smooth/smooth.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/cache/ftcache.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/bdf/bdf.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/bzip2/ftbzip2.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/cache/ftcache.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/cff/cff.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/cid/type1cid.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/gzip/ftgzip.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/lzw/ftlzw.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/pcf/pcf.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/winfonts/winfnt.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/sfnt/sfnt.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/pfr/pfr.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/psaux/psaux.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/pshinter/pshinter.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/psnames/psnames.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/raster/raster.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/sfnt/sfnt.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/smooth/smooth.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/truetype/truetype.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/type1/type1.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/type42/type42.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/cid/type1cid.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/gzip/ftgzip.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/bzip2/ftbzip2.c \
$(CORE_DIR)/vendor/libretro-deps/freetype/src/lzw/ftlzw.c
$(CORE_DIR)/vendor/libretro-deps/freetype/src/winfonts/winfnt.c
# SDL_ttf
FLAGS += -I$(CORE_DIR)/vendor/sdl-libretro/tests/SDL_ttf-2.0.11/VisualC/external/include
......
......@@ -105,13 +105,14 @@ ChaiLove uses modified [Gitflow](https://www.atlassian.com/git/tutorials/compari
## Contributors
The following individuals contributed to ChaiLove:
The following individuals contributed to ChaiLove in some way:
- [@RobLoach](http://github.com/robloach)
- [webgeek1234](http://github.com/webgeek1234) for the Android support
- [twinaphex](http://github.com/twinaphex)
- [orbea](http://github.com/orbea)
- [fetzerch](http://github.com/fetzerch)
- [bparker06](https://github.com/bparker06)
- [sdl-libretro](https://github.com/r-type/sdl-libretro) by [@r-type](https://github.com/r-type)
- [Logo](docs/chailove.png) by [@baxysquare](https://github.com/baxysquare)
- [@webgeek1234](http://github.com/webgeek1234) for the Android support
- [@r-type](https://github.com/r-type) for his work on [sdl-libretro](https://github.com/r-type/sdl-libretro)
- [@mudlord](https://github.com/mudlord) for his work on the [libretro-common](https://github.com/libretro/libretro-common) audio system
- [@orbea](http://github.com/orbea)
- [@fetzerch](http://github.com/fetzerch)
- [@bparker06](https://github.com/bparker06)
- [@twinaphex](http://github.com/twinaphex)
- [@baxysquare](https://github.com/baxysquare) for the [Logo](docs/chailove.png)
......@@ -43,3 +43,10 @@ build_script:
#
#test_script:
# - make unittest
# Disable email notifications
notifications:
- provider: Email
on_build_success: false
on_build_failure: false
on_build_status_changed: false
......@@ -23,7 +23,7 @@ PROJECT_NAME = "ChaiLove API"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = "0.25.1"
PROJECT_NUMBER = "0.26.0"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......
......@@ -28,7 +28,7 @@ def load() {
sprites.push_back(Sprite())
// Load the music.
music = love.audio.newSource("music.wav")
music = love.audio.newSource("music.ogg")
music.setLooping(true)
music.play()
}
......
......@@ -47,7 +47,7 @@ global T
def conf(t) {
t.window.width = WIDTH * gridScale
t.window.height = HEIGHT * gridScale
t.version = "0.19.1"
t.version = "0.26.0"
}
/**
......
......@@ -47,9 +47,9 @@
#define SRC_CHAILOVE_H_
#define CHAILOVE_VERSION_MAJOR 0
#define CHAILOVE_VERSION_MINOR 25
#define CHAILOVE_VERSION_PATCH 1
#define CHAILOVE_VERSION_STRING "0.25.1"
#define CHAILOVE_VERSION_MINOR 26
#define CHAILOVE_VERSION_PATCH 0
#define CHAILOVE_VERSION_STRING "0.26.0"
#include "SDL.h"
#include "libretro.h"
......
#ifndef SRC_CHAILOVEDOCS_H_
#define SRC_CHAILOVEDOCS_H_
#include <string>
/**
* Provides a Linked List data structure.
*
......@@ -50,4 +52,25 @@ class List {
void pop_back();
};
/**
* Loads the given module, only once.
*
* While love.filesystem.load will load and execute a module any number of times, the `require()` function will only load and execute any given module just one.
*
* @param module The name of the module to load. "." will be replaced by "/".
*
* @return True if the module was loaded.
*
* @see love.filesystem.load
*
* @code
* // The following will load lib/player.chai.
* require("lib.player")
*
* // Calling require("lib.player") again will not re-load it.
* require("lib.player")
* @endcode
*/
bool require(const std::string& module);
#endif // SRC_CHAILOVEDOCS_H_
......@@ -41,6 +41,8 @@ class audio {
* Returns the master volume.
*
* @return The current master volume between 0.0f and 1.0f.
*
* @see setVolume
*/
float getVolume();
......@@ -50,6 +52,8 @@ class audio {
* @param volume 1.0f is max and 0.0f is off.
*
* @return The audio module, to allow method chaining.
*
* @see getVolume
*/
audio& setVolume(float volume);
......
......@@ -19,7 +19,7 @@ namespace love {
*
* @code
* def conf(t) {
* t.version = "0.25.1" // Version of ChaiLove
* t.version = "0.26.0" // Version of ChaiLove
* t.identity = "mygame" // Machine name of your game
* t.window.title = "My Game" // Human-readable name
* t.window.width = 1024 // Game width
......
......@@ -30,11 +30,15 @@ class console {
/**
* Checks to see if the console is enabled.
*
* @see setEnabled
*/
bool isEnabled();
/**
* Enable or disable the console.
*
* @see isEnabled
*/
bool setEnabled(bool enabled);
......
......@@ -68,6 +68,8 @@ class graphics {
/**
* Draws a point.
*
* @param p The point to draw on the screen.
*/
graphics& point(Point* p);
......@@ -131,12 +133,16 @@ class graphics {
* Set an already-loaded Font as the current font.
*
* @param (font) The font to set as the active font. When not provided will set the default font.
*
* @see getFont
*/
graphics& setFont(Font* font);
graphics& setFont();
/**
* Retrieve th currently active font.
*
* @see setFont
*/
Font* getFont();
......@@ -161,6 +167,8 @@ class graphics {
* @param green The amount of green.
* @param blue The amount of blue.
* @param alpha (255) The amount of alpha.
*
* @see getColor
*/
graphics& setColor(int red, int green, int blue, int alpha);
graphics& setColor(int red, int green, int blue);
......
......@@ -172,6 +172,7 @@ bool keyboard::load() {
scancodeToKey[RETROK_POWER] = "power";
scancodeToKey[RETROK_EURO] = "currencyunit";
scancodeToKey[RETROK_UNDO] = "undo";
scancodeToKey[RETROK_OEM_102] = "oem102";
// Initialize the key to scancode mappings.
for (i = 0; i < RETROK_LAST; i++) {
......
#include "script.h"
#include "../ChaiLove.h"
#include <filesystem/path.h>
#include <algorithm>
#ifdef __HAVE_CHAISCRIPT__
#include "chaiscript/extras/math.hpp"
......@@ -55,6 +56,21 @@ bool script::loadModule(const std::string& moduleName) {
return false;
}
bool script::loadModuleRequire(const std::string& moduleName) {
// Check if the module has already been loaded.
std::string filename = replaceString(moduleName, ".", "/");
if (std::find(m_requiremodules.begin(), m_requiremodules.end(), filename) != m_requiremodules.end()) {
return true;
}
// Attempt to load the module.
bool loaded = loadModule(filename);
if (loaded) {
m_requiremodules.push_back(filename);
}
return loaded;
}
chaiscript::Boxed_Value script::eval(const std::string& code, const std::string& filename) {
// Replace possible problematic tabs, and evaluate the script.
std::string contents = replaceString(code, "\t", " ");
......@@ -284,6 +300,7 @@ script::script(const std::string& file) {
chai.add(fun<std::vector<std::string>, filesystem, const std::string&>(&filesystem::lines), "lines");
chai.add(fun<std::vector<std::string>, filesystem, const std::string&, const std::string&>(&filesystem::lines), "lines");
chai.add(fun(&filesystem::load), "load");
chai.add(fun(&script::loadModuleRequire, this), "require");
// System
chai.add(fun(&system::getOS), "getOS");
......
......@@ -2,6 +2,7 @@
#define SRC_LOVE_SCRIPT_H_
#include <string>
#include <list>
#include "config.h"
#ifdef __HAVE_CHAISCRIPT__
......@@ -52,7 +53,7 @@ class script {
* t.console = false
*
* // The ChaiLove version this game was made for.
* t.version = "0.25.1"
* t.version = "0.26.0"
*
* // The width and height of the game.
* t.window.width = 1024
......@@ -469,6 +470,8 @@ class script {
#endif
std::string replaceString(std::string subject, const std::string& search, const std::string& replace);
bool loadModuleRequire(const std::string& moduleName);
std::list<std::string> m_requiremodules;
};
} // namespace love
......
......@@ -15,7 +15,7 @@ def conf(t) {
t.window.width = 460
t.window.height = 320
t.console = true
t.version = "0.24.0"
t.version = "0.26.0"
}
def load() {
......
requiretestFileLoaded = true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment