Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
libretro-chailove
Commits
a5d23725
Verified
Commit
a5d23725
authored
Nov 30, 2017
by
RobLoach
Browse files
Update build process
parent
434e09b9
Changes
11
Hide whitespace changes
Inline
Side-by-side
.travis.yml
View file @
a5d23725
...
...
@@ -33,16 +33,10 @@ addons:
-
python
script
:
# Check versions of gcc and g++
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then gcc --version ; fi
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then g++ --version ; fi
# Run through the make commands
-
./configure
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then make ; fi
-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make platform=osx -j2 ; fi
-
make test
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then make cpplint ; fi
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then make unit ; fi
-
if [[ "$TRAVIS_OS_NAME" != "osx" ]]; then make test ; fi
cache
:
apt
:
true
...
...
CHANGELOG.md
View file @
a5d23725
...
...
@@ -4,7 +4,7 @@ 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
)
.
##
Unreleased
##
0.10.0 - 2017-11-30
### Added
-
Mac support
-
Unit testing
...
...
CPPLINT.cfg
deleted
100644 → 0
View file @
434e09b9
set noparent
filter=-build/include
filter=-legal/copyright
filter=-runtime/int
filter=-readability/braces
filter=-runtime/threadsafe_fn
filter=-build/namespaces
filter=-runtime/explicit
filter=-whitespace/tab
filter=-readability/casting
filter=-whitespace/line_length
Makefile
View file @
a5d23725
...
...
@@ -24,22 +24,22 @@ clean:
rm
-f
$(TARGET)
$(OBJECTS)
dependencies
:
git submodule update
--init
--recursive
@
git submodule update
--init
--recursive
test
:
all
@
echo
"
Execute the following to run tests
:
\n\n
retroarch -L
$(TARGET)
test/main.chai
\n
make unit
\n
\n
"
test
:
unittest cpplint
@
echo
"
Run the testing suite by using
:
\n\n
retroarch -L
$(TARGET)
test/main.chai
\n\n
"
vendor/noarch/noarch
:
dependencies
$(MAKE)
-C
vendor/noarch
@
$(MAKE)
-C
vendor/noarch
unit
:
vendor/noarch/noarch all
vendor/noarch/noarch
$(CORE_DIR)
/
chailove_libretro.so
test
/unittests/main.chai
unit
test
:
vendor/noarch/noarch all
@
vendor/noarch/noarch
$(CORE_DIR)
/
$(TARGET)
test
/unittests/main.chai
examples
:
all
retroarch
-L
$(TARGET)
examples/benchmark/main.chai
@
retroarch
-L
$(TARGET)
examples/benchmark/main.chai
test-script
:
all
retroarch
-L
$(TARGET)
test
/main.chai
@
retroarch
-L
$(TARGET)
test
/main.chai
docs
:
dependencies
doxygen docs/Doxyfile
...
...
@@ -48,7 +48,14 @@ docs-deploy: docs
npm
install
push-dir
&&
node_modules/.bin/push-dir
--dir
=
docs/html
--branch
=
gh-pages
cpplint
:
dependencies
vendor/styleguide/cpplint/cpplint.py
--linelength
=
120
--counting
=
detailed src/
*
.h src/
*
.cpp src/
*
/
*
.h src/
*
/
*
.cpp src/
*
/
*
/
*
.h src/
*
/
*
/
*
.cpp
@
vendor/styleguide/cpplint/cpplint.py
\
--linelength
=
120
\
--quiet
\
--counting
=
detailed
\
--filter
=
-build
/include,-legal/copyright,-runtime/int,-runtime-readability/braces,
\
-runtime
/threadsafe_fn,-build/namespaces,-runtime/explicit,-whitespace/tab,
\
-readability
/casting,-whitespace/line_length,-runtime/references
\
src/
*
.h src/
*
.cpp src/
*
/
*
.h src/
*
/
*
.cpp src/
*
/
*
/
*
.h src/
*
/
*
/
*
.cpp
noscript
:
dependencies
$(MAKE)
HAVE_CHAISCRIPT
=
0
HAVE_TESTS
=
1
...
...
README.md
View file @
a5d23725
...
...
@@ -82,5 +82,5 @@ retroarch -L chailove_libretro.so test/main.chai
You can run the unit tests, by executing:
```
make unit
make unit
test
```
src/Modules/script.cpp
View file @
a5d23725
...
...
@@ -294,7 +294,7 @@ script::script(const std::string& file) {
hasUpdate
=
false
;
}
try
{
chaiconf
=
chai
.
eval
<
std
::
function
<
void
(
const
Config
&
)
>
>
(
"conf"
);
chaiconf
=
chai
.
eval
<
std
::
function
<
void
(
Config
&
)
>
>
(
"conf"
);
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cout
<<
"[ChaiLove] [script] conf(t) "
<<
e
.
what
()
<<
std
::
endl
;
...
...
@@ -373,7 +373,7 @@ script::script(const std::string& file) {
#endif
}
void
script
::
conf
(
const
Config
&
t
)
{
void
script
::
conf
(
Config
&
t
)
{
#ifdef __HAVE_CHAISCRIPT__
if
(
hasconf
)
{
try
{
...
...
src/Modules/script.h
View file @
a5d23725
...
...
@@ -19,6 +19,7 @@ namespace Modules {
class
script
{
public:
script
(
const
std
::
string
&
file
);
/**
* @brief Modify some configuration options.
*
...
...
@@ -33,7 +34,8 @@ class script {
* }
* @endcode
*/
void
conf
(
const
::
Types
::
System
::
Config
&
t
);
void
conf
(
::
Types
::
System
::
Config
&
t
);
/**
* @brief This function is called exactly once at the beginning of the game.
*
...
...
@@ -54,6 +56,7 @@ class script {
* @endcode
*/
void
load
();
/**
* @brief Callback function used to update the state of the game every frame.
*
...
...
@@ -78,6 +81,7 @@ class script {
* @endcode
*/
void
update
(
float
delta
);
/**
* @brief Callback function used to draw on the screen every frame.
*
...
...
@@ -98,27 +102,33 @@ class script {
* @endcode
*/
void
draw
();
/**
* @brief Called when the game is requested to be reset.
*/
void
reset
();
bool
loadModule
(
const
std
::
string
&
moduleName
);
/**
* @brief Called when a joystick button is pressed.
*/
void
joystickpressed
(
int
joystick
,
const
std
::
string
&
button
);
/**
* @brief Called when a joystick button is released.
*/
void
joystickreleased
(
int
joystick
,
const
std
::
string
&
button
);
/**
* @brief Called when a mouse button is pressed.
*/
void
mousepressed
(
int
x
,
int
y
,
int
button
);
/**
* @brief Called when a mouse button is released.
*/
void
mousereleased
(
int
x
,
int
y
,
int
button
);
/**
* @brief Called when the mouse is moved.
*/
...
...
@@ -140,6 +150,7 @@ class script {
* @return A JSON array representing the current state.
*/
std
::
string
savestate
();
/**
* @brief Called when requested to load a state.
*
...
...
@@ -150,7 +161,7 @@ class script {
#ifdef __HAVE_CHAISCRIPT__
chaiscript
::
ChaiScript
chai
;
std
::
function
<
void
()
>
chaiload
;
std
::
function
<
void
(
const
::
Types
::
System
::
Config
&
)
>
chaiconf
;
std
::
function
<
void
(
::
Types
::
System
::
Config
&
)
>
chaiconf
;
std
::
function
<
void
(
float
)
>
chaiupdate
;
std
::
function
<
void
()
>
chaidraw
;
std
::
function
<
void
()
>
chaireset
;
...
...
test/unittests/filesystem.chai
View file @
a5d23725
...
...
@@ -8,3 +8,19 @@ for (file : files) {
}
assert(foundUnitChai, "filesystem.getDirectoryItems()")
var contents = filesystem.read("main.chai")
var needle = "Unit Testing Framework"
var found = contents.find(needle)
assert(found > 50, "filesystem.read()")
assert(filesystem.exists("math.chai"), "filesystem.exists('math.chai')")
assert(!filesystem.exists("notexist.chai"), "filesystem.exists('notexist.chai')")
assert(filesystem.getSize("filesystem.chai") > 10, "filesystem.getSize()")
assert_equal(filesystem.getSize("notexist.chai"), -1, "filesystem.getSize('notexist.chai')")
assert(filesystem.isFile("filesystem.chai"), "filesystem.isFile()")
assert(!filesystem.isFile("notexist.chai"), "filesystem.isFile('notexist.chai')")
test/unittests/keyboard.chai
0 → 100644
View file @
a5d23725
var scancode = keyboard.getScancodeFromKey("a")
assert_equal(scancode, 97, "keyboard.getScancodeFromKey()")
var key = keyboard.getKeyFromScancode(97)
assert_equal(key, "a", "keyboard.getKeyFromScancode()")
test/unittests/main.chai
View file @
a5d23725
...
...
@@ -7,6 +7,8 @@ def load() {
filesystem.load("assert.chai")
filesystem.load("filesystem.chai")
filesystem.load("math.chai")
filesystem.load("keyboard.chai")
filesystem.load("timer.chai")
print("\n================================\n")
...
...
test/unittests/timer.chai
0 → 100644
View file @
a5d23725
var delta = timer.getDelta()
assert(delta >= 0, "timer.getDelta()")
var fps = timer.getDelta()
assert(fps >= 0, "timer.getFPS()")
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment