Unverified Commit bcbe88c6 authored by RobLoach's avatar RobLoach Committed by GitHub
Browse files

Merge pull request #328 from libretro/dev

0.28.0
parents 95918963 f9d414fb
...@@ -4,6 +4,22 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be ...@@ -4,6 +4,22 @@ 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/) 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). and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## 0.28.0 - 2018-10-07
### Features
- `love.timer.step()` now returns `dt`
- Adds `string::replace(search, replace)` to replace all instances of a string
### Fixes
- Fixes undefined reference to `process_sinc_neon_asm()`
- [#322](https://github.com/libretro/libretro-chailove/issues/322) found by [@ToKe79](https://github.com/ToKe79)
- Fixes `love.graphics.draw(image)` with no x and y parameter
### Chores
- Update libretro-common
- Update PhysFS
- Rework the testing framework
- Fix Doxygen warnings
## 0.27.0 - 2018-09-25 ## 0.27.0 - 2018-09-25
### Features ### Features
- Live updating of core options - Live updating of core options
......
...@@ -115,4 +115,5 @@ The following individuals contributed to ChaiLove in some way: ...@@ -115,4 +115,5 @@ The following individuals contributed to ChaiLove in some way:
- [@fetzerch](http://github.com/fetzerch) - [@fetzerch](http://github.com/fetzerch)
- [@bparker06](https://github.com/bparker06) - [@bparker06](https://github.com/bparker06)
- [@twinaphex](http://github.com/twinaphex) - [@twinaphex](http://github.com/twinaphex)
- [@ToKe79](https://github.com/ToKe79)
- [@baxysquare](https://github.com/baxysquare) for the [Logo](docs/chailove.png) - [@baxysquare](https://github.com/baxysquare) for the [Logo](docs/chailove.png)
...@@ -23,7 +23,7 @@ PROJECT_NAME = "ChaiLove API" ...@@ -23,7 +23,7 @@ PROJECT_NAME = "ChaiLove API"
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = "0.27.0" PROJECT_NUMBER = "0.28.0"
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put. # base path where the generated documentation will be put.
...@@ -51,7 +51,7 @@ OUTPUT_LANGUAGE = English ...@@ -51,7 +51,7 @@ OUTPUT_LANGUAGE = English
# whereas setting the tag to NO uses a Unix-style encoding (the default for # whereas setting the tag to NO uses a Unix-style encoding (the default for
# all platforms other than Windows). # all platforms other than Windows).
USE_WINDOWS_ENCODING = NO # USE_WINDOWS_ENCODING = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in # include brief member descriptions after the members that are listed in
...@@ -120,7 +120,7 @@ MULTILINE_CPP_IS_BRIEF = NO ...@@ -120,7 +120,7 @@ MULTILINE_CPP_IS_BRIEF = NO
# If set to NO, the detailed description appears after the member # If set to NO, the detailed description appears after the member
# documentation. # documentation.
DETAILS_AT_TOP = NO # DETAILS_AT_TOP = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it # member inherits the documentation from any documented member that it
...@@ -270,7 +270,7 @@ SORT_MEMBER_DOCS = YES ...@@ -270,7 +270,7 @@ SORT_MEMBER_DOCS = YES
# disable (NO) the todo list. This list is created by putting \todo # disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation. # commands in the documentation.
GENERATE_TODOLIST = YES GENERATE_TODOLIST = NO
# The GENERATE_TESTLIST tag can be used to enable (YES) or # The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test # disable (NO) the test list. This list is created by putting \test
...@@ -288,7 +288,7 @@ GENERATE_BUGLIST = YES ...@@ -288,7 +288,7 @@ GENERATE_BUGLIST = YES
# disable (NO) the deprecated list. This list is created by putting # disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation. # \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES GENERATE_DEPRECATEDLIST= NO
# The ENABLED_SECTIONS tag can be used to enable conditional # The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif. # documentation sections, marked by \if sectionname ... \endif.
...@@ -483,7 +483,7 @@ VERBATIM_HEADERS = YES ...@@ -483,7 +483,7 @@ VERBATIM_HEADERS = YES
# of all compounds will be generated. Enable this if the project # of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces. # contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO ALPHABETICAL_INDEX = YES
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
...@@ -542,7 +542,7 @@ HTML_STYLESHEET = ...@@ -542,7 +542,7 @@ HTML_STYLESHEET =
# files or namespaces will be aligned in HTML using tables. If set to # files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used. # NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES # HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files # If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the # will be generated that can be used as input for tools like the
...@@ -776,13 +776,13 @@ XML_OUTPUT = xml ...@@ -776,13 +776,13 @@ XML_OUTPUT = xml
# which can be used by a validating XML parser to check the # which can be used by a validating XML parser to check the
# syntax of the XML files. # syntax of the XML files.
XML_SCHEMA = # XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD, # The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the # which can be used by a validating XML parser to check the
# syntax of the XML files. # syntax of the XML files.
XML_DTD = # XML_DTD =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output # configuration options for the AutoGen Definitions output
...@@ -1036,7 +1036,7 @@ DOTFILE_DIRS = ...@@ -1036,7 +1036,7 @@ DOTFILE_DIRS =
# the specified constraint. Beware that most browsers cannot cope with very # the specified constraint. Beware that most browsers cannot cope with very
# large images. # large images.
MAX_DOT_GRAPH_WIDTH = 1024 # MAX_DOT_GRAPH_WIDTH = 1024
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
# (in pixels) of the graphs generated by dot. If a graph becomes larger than # (in pixels) of the graphs generated by dot. If a graph becomes larger than
...@@ -1044,7 +1044,7 @@ MAX_DOT_GRAPH_WIDTH = 1024 ...@@ -1044,7 +1044,7 @@ MAX_DOT_GRAPH_WIDTH = 1024
# the specified constraint. Beware that most browsers cannot cope with very # the specified constraint. Beware that most browsers cannot cope with very
# large images. # large images.
MAX_DOT_GRAPH_HEIGHT = 1024 # MAX_DOT_GRAPH_HEIGHT = 1024
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable # graphs generated by dot. A depth value of 3 means that only nodes reachable
......
...@@ -47,7 +47,7 @@ global T ...@@ -47,7 +47,7 @@ global T
def conf(t) { def conf(t) {
t.window.width = WIDTH * gridScale t.window.width = WIDTH * gridScale
t.window.height = HEIGHT * gridScale t.window.height = HEIGHT * gridScale
t.version = "0.27.0" t.version = "0.28.0"
} }
/** /**
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
#define SRC_CHAILOVE_H_ #define SRC_CHAILOVE_H_
#define CHAILOVE_VERSION_MAJOR 0 #define CHAILOVE_VERSION_MAJOR 0
#define CHAILOVE_VERSION_MINOR 27 #define CHAILOVE_VERSION_MINOR 28
#define CHAILOVE_VERSION_PATCH 0 #define CHAILOVE_VERSION_PATCH 0
#define CHAILOVE_VERSION_STRING "0.27.0" #define CHAILOVE_VERSION_STRING "0.28.0"
#include "SDL.h" #include "SDL.h"
#include "libretro.h" #include "libretro.h"
......
#ifndef SRC_CHAILOVEDOCS_H_ #ifndef SRC_CHAILOVEDOCS_H_
#define SRC_CHAILOVEDOCS_H_ #define SRC_CHAILOVEDOCS_H_
/**
* @file Globals.h
* @page globals Globals
*
* This provides documentation about globals available through ChaiLove.
*/
#include <string> #include <string>
/** /**
...@@ -73,4 +80,26 @@ class List { ...@@ -73,4 +80,26 @@ class List {
*/ */
bool require(const std::string& module); bool require(const std::string& module);
/**
* Provides some additional functionality to the basic string object.
*/
class String {
public:
/**
* Replaces all instances of the search string with the given replace string.
*
* @param search The string to search for that should be replaced.
* @param replace The string that will replace the found string.
*
* @return The new string with the replaced strings.
*
* @code
* var hello = "Hello World!"
* var goodbye = hello.replace("Hello", "Goodbye")
* // => "Goodbye World!"
* @endcode
*/
std::string replace(const std::string& search, const std::string& replace);
};
#endif // SRC_CHAILOVEDOCS_H_ #endif // SRC_CHAILOVEDOCS_H_
...@@ -43,7 +43,7 @@ class filesystem { ...@@ -43,7 +43,7 @@ class filesystem {
/** /**
* Read the contents of a file. * Read the contents of a file.
* *
* @param file The name (and path) of the file. * @param filename The name (and path) of the file.
* *
* @return The contents of the file. * @return The contents of the file.
* *
...@@ -72,7 +72,7 @@ class filesystem { ...@@ -72,7 +72,7 @@ class filesystem {
/** /**
* Get the size in bytes of a file. * Get the size in bytes of a file.
* *
* @param The file to get the size of. * @param file The file to get the size of.
* *
* @return The size of the given file. * @return The size of the given file.
*/ */
...@@ -105,7 +105,7 @@ class filesystem { ...@@ -105,7 +105,7 @@ class filesystem {
/** /**
* Creates a new FileData from a file on the storage device. * Creates a new FileData from a file on the storage device.
* *
* @param path Path to the file. * @param filepath Path to the file.
* *
* @return The new FileData, or nil if an error occurred. * @return The new FileData, or nil if an error occurred.
* *
......
...@@ -97,7 +97,7 @@ graphics& graphics::line(int x1, int y1, int x2, int y2) { ...@@ -97,7 +97,7 @@ graphics& graphics::line(int x1, int y1, int x2, int y2) {
} }
graphics& graphics::draw(Image* image) { graphics& graphics::draw(Image* image) {
return draw(image); return draw(image, 0, 0);
} }
graphics& graphics::draw(Image* image, int x, int y) { graphics& graphics::draw(Image* image, int x, int y) {
......
...@@ -295,6 +295,9 @@ class graphics { ...@@ -295,6 +295,9 @@ class graphics {
* @param drawmode How to draw the arc. Can be "fill" or "line". * @param drawmode How to draw the arc. Can be "fill" or "line".
* @param x The position to draw the object (x-axis). * @param x The position to draw the object (x-axis).
* @param y The position to draw the object (y-axis). * @param y The position to draw the object (y-axis).
* @param radius The radius of the arc.
* @param angle1 The angle of the first
* @param angle2 The angle of the second.
*/ */
graphics& arc(const std::string& drawmode, int x, int y, int radius, int angle1, int angle2); graphics& arc(const std::string& drawmode, int x, int y, int radius, int angle1, int angle2);
......
...@@ -37,7 +37,7 @@ class math { ...@@ -37,7 +37,7 @@ class math {
* Sets the random seed to a random seed between the given min and max values. * Sets the random seed to a random seed between the given min and max values.
* *
* @param min The lower 32 bits of the seed value. * @param min The lower 32 bits of the seed value.
* @param high The higher 32 bits of the seed value. * @param max The higher 32 bits of the seed value.
* *
* @return The math module, to allow for method chaining. * @return The math module, to allow for method chaining.
* *
......
...@@ -91,6 +91,24 @@ script::script(const std::string& file) { ...@@ -91,6 +91,24 @@ script::script(const std::string& file) {
chai.add(bootstrap::standard_library::vector_type<std::vector<std::string>>("StringVector")); chai.add(bootstrap::standard_library::vector_type<std::vector<std::string>>("StringVector"));
chai.add(bootstrap::standard_library::map_type<std::map<std::string, bool>>("StringBoolMap")); chai.add(bootstrap::standard_library::map_type<std::map<std::string, bool>>("StringBoolMap"));
// Global Helpers
// string::replace(std::string search, std::string replace)
chai.add(fun([](const std::string& subject, const std::string& search, const std::string& replace) {
std::string newSubject(subject);
size_t pos = 0;
while ((pos = newSubject.find(search, pos)) != std::string::npos) {
newSubject.replace(pos, search.length(), replace);
pos += replace.length();
}
return newSubject;
}), "replace");
// string::replace(char search, char replace)
chai.add(fun([](const std::string& subject, char search, char replace) {
std::string newSubject(subject);
std::replace(newSubject.begin(), newSubject.end(), search, replace);
return newSubject;
}), "replace");
// List // List
auto listModule = std::make_shared<chaiscript::Module>(); auto listModule = std::make_shared<chaiscript::Module>();
chaiscript::bootstrap::standard_library::list_type<std::list<chaiscript::Boxed_Value> >("List", *listModule); chaiscript::bootstrap::standard_library::list_type<std::list<chaiscript::Boxed_Value> >("List", *listModule);
......
...@@ -10,7 +10,7 @@ float timer::getDelta() { ...@@ -10,7 +10,7 @@ float timer::getDelta() {
return m_delta; return m_delta;
} }
void timer::step(float delta) { float timer::step(float delta) {
m_delta = delta; m_delta = delta;
m_deltaCounter += delta; m_deltaCounter += delta;
m_frameCounter++; m_frameCounter++;
...@@ -20,6 +20,8 @@ void timer::step(float delta) { ...@@ -20,6 +20,8 @@ void timer::step(float delta) {
m_frameCounter = 0; m_frameCounter = 0;
m_deltaCounter = 0; m_deltaCounter = 0;
} }
return m_delta;
} }
int timer::getFPS() { int timer::getFPS() {
......
...@@ -9,7 +9,7 @@ namespace love { ...@@ -9,7 +9,7 @@ namespace love {
class timer { class timer {
public: public:
timer(); timer();
void step(float delta); float step(float delta);
/** /**
* Returns the time between the last two frames. * Returns the time between the last two frames.
......
...@@ -93,7 +93,7 @@ window& window::showMessageBox(const std::string& msg, int frames) { ...@@ -93,7 +93,7 @@ window& window::showMessageBox(const std::string& msg, int frames) {
} }
window& window::showMessageBox(const std::string& msg) { window& window::showMessageBox(const std::string& msg) {
showMessageBox(msg, 2800); showMessageBox(msg, 1000);
return *this; return *this;
} }
......
/** /**
* Cheat Test * Cheat Test
* *
* retroarch -L chailove_libretro.so test/sound.chai * retroarch -L chailove_libretro.so test/cheats.chai
*/ */
global lastcheatcode global lastcheatcode
......
class graphics_draw {
var name;
var x;
var y;
var image;
def graphics_draw() {
this.name = "graphics.draw()";
}
def load() {
this.image = love.graphics.newImage("assets/graphics_draw.png");
this.x = love.graphics.getWidth() / 2.0f - this.image.getWidth() / 2.0f;
this.y = love.graphics.getHeight() / 2.0f - this.image.getHeight() / 2.0f;
}
def draw() {
love.graphics.draw(this.image, this.x, this.y);
}
def update(delta) {
}
};
class love_audio_play {
def love_audio_play() {
// Nothing.
}
def load() {
this.chailovesound = love.audio.newSource("unittests/assets/chailove.ogg")
}
def draw() {
love.graphics.print("Press the X key", 100, 200)
}
def update(delta) {
if (love.keyboard.isDown("x")) {
love.audio.play(this.chailovesound)
}
}
};
/** class love_graphics_draw {
* love.graphics.draw testing
*
* An alternative test with a different file name.
*
* retroarch -L chailove_libretro.so test/love.graphics.draw.chai
*/
global keyPressed = "a"; def love_graphics_draw() {
global keyReleased = "b"; // Nothing.
global logo
global angle = 0.0f
global scale = 1.0f
def load() {
logo = love.image.newImageData("assets/graphics_draw.png")
love.graphics.setBackgroundColor(50, 50, 100)
}
def update(dt) {
angle = angle - dt * 180.0f
if (keyPressed == "up") {
scale = scale + dt * 1.0f
}
else if (keyPressed == "down") {
scale = scale - dt * 1.0f
} }
}
def draw() { def load() {
love.graphics.print("Key Pressed: " + keyPressed, 5, 20) this.image = love.graphics.newImage("assets/graphics_draw.png");
love.graphics.print("Key Released: " + keyReleased, 5, 100) this.x = love.graphics.getWidth() / 2.0f - this.image.getWidth() / 2.0f;
this.y = love.graphics.getHeight() / 2.0f - this.image.getHeight() / 2.0f;
love.graphics.setColor(255, 0, 0) }
//love.graphics.draw(logo, graphics.getWidth() / 2, graphics.getHeight() / 2, math.rad(angle), 2, 2, 64/2, 64/2)
love.graphics.point(love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f)
love.graphics.draw(logo, love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f, love.math.rad(angle), scale, scale, logo.getWidth() / 2.0f, logo.getHeight() / 2.0f)
love.graphics.point(love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f)
//love.graphics.point(graphics.getWidth() / 2
}
def keypressed(key, scancode) { def draw() {
keyPressed = key love.graphics.draw(this.image, this.x, this.y);
} }
def keyreleased(key, scancode) { def update(delta) {
keyReleased = key // Nothing.
} }
};
class love_graphics_draw_scaling {
def love_graphics_draw_scaling() {
// Nothing.
}
def load() {
this.logo = love.image.newImageData("assets/graphics_draw.png")
this.angle = 0.0f
this.scale = 1.0f
}
def draw() {
love.graphics.setColor(255, 0, 0)
//love.graphics.draw(logo, graphics.getWidth() / 2, graphics.getHeight() / 2, math.rad(angle), 2, 2, 64/2, 64/2)
love.graphics.point(love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f)
love.graphics.draw(this.logo, love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f, love.math.rad(this.angle), this.scale, this.scale, this.logo.getWidth() / 2.0f, this.logo.getHeight() / 2.0f)
love.graphics.point(love.graphics.getWidth() / 2.0f, love.graphics.getHeight() / 2.0f)
//love.graphics.point(graphics.getWidth() / 2
love.graphics.print("Press x/z", 100, 100)
}
def update(dt) {
this.angle = this.angle - dt * 180.0f
if (love.keyboard.isDown("x")) {
this.scale = this.scale + dt * 1.0f
}
else if (love.keyboard.isDown("z")) {
this.scale = this.scale - dt * 1.0f
}
}
};
class graphics_point { class love_graphics_point {
var name; def love_graphics_point() {}
def graphics_point() {
this.name = "graphics.point()";
}
def load() { def load() {
//graphics.setBackgroundColor(255,200,100) // Nothing.
} }
def draw() { def draw() {
//graphics.setColor(0, 255, 0) // graphics.setColor(0, 255, 0)
love.graphics.point(100, 200).point(200, 300) love.graphics.point(100, 200).point(200, 300)
} }
def update(delta) { def update(delta) {
// Nothing.
} }
}; };
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