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
32b3025a
Verified
Commit
32b3025a
authored
Feb 13, 2018
by
RobLoach
Browse files
Clean the NativeTest
parent
5f1c3df9
Changes
7
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
32b3025a
...
...
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## 0.14.1 - Unreleased
### Changed
-
Updated documentation
-
Fixed native test
## 0.14.0 - 2018-01-16
### Changed
...
...
Makefile
View file @
32b3025a
...
...
@@ -85,7 +85,7 @@ tests: dependencies
$(MAKE)
HAVE_CHAISCRIPT
=
0
HAVE_TESTS
=
1
test-native
:
tests
retroarch
-L
$(TARGET)
test
/main.chai
retroarch
-L
$(TARGET)
test
/
native/
main.chai
PREFIX
:=
/usr
INSTALLDIR
:=
$(PREFIX)
/lib/libretro
...
...
src/ChaiLove.h
View file @
32b3025a
...
...
@@ -76,7 +76,7 @@
#include "love/event.h"
#ifdef __HAVE_TESTS__
#include "../test/native/
Main
.h"
#include "../test/native/
NativeTest
.h"
#endif
class
ChaiLove
{
...
...
@@ -118,7 +118,7 @@ class ChaiLove {
SDL_Event
sdlEvent
;
#ifdef __HAVE_TESTS__
Main
test
;
NativeTest
test
;
#endif
};
...
...
test/native/
Main
.cpp
→
test/native/
NativeTest
.cpp
View file @
32b3025a
...
...
@@ -8,18 +8,18 @@
#ifdef __HAVE_TESTS__
#include "
Main
.h"
#include "
NativeTest
.h"
#include "../../src/ChaiLove.h"
using
love
::
config
;
void
Main
::
conf
(
config
&
t
)
{
void
NativeTest
::
conf
(
config
&
t
)
{
t
.
window
.
width
=
1080
;
t
.
window
.
height
=
768
;
}
bool
Main
::
load
()
{
app
=
ChaiLove
::
getInstance
();
bool
NativeTest
::
load
()
{
ChaiLove
*
app
=
ChaiLove
::
getInstance
();
app
->
filesystem
.
mount
(
"test"
,
"/"
);
secondfont
=
app
->
graphics
.
newFont
(
"assets/Raleway-Regular.ttf"
,
60
);
thefont
=
app
->
graphics
.
newFont
(
"assets/c64_16x16.png"
,
16
,
16
,
"
\x7f
!
\"
#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[
\\
]^_`abcdefghijklmnopqrstuvwxyz{|}~"
);
...
...
@@ -28,13 +28,15 @@ bool Main::load() {
jump
=
app
->
sound
.
newSoundData
(
"assets/jump.wav"
);
}
void
Main
::
update
(
float
delta
)
{
void
NativeTest
::
update
(
float
delta
)
{
ChaiLove
*
app
=
ChaiLove
::
getInstance
();
if
(
app
->
joystick
.
isDown
(
0
,
0
)
&&
!
jump
->
isPlaying
())
{
app
->
audio
.
play
(
jump
);
}
}
void
Main
::
draw
()
{
void
NativeTest
::
draw
()
{
ChaiLove
*
app
=
ChaiLove
::
getInstance
();
app
->
graphics
.
setColor
(
77
,
182
,
172
);
app
->
graphics
.
ellipse
(
"fill"
,
0
,
768
,
200
,
180
);
...
...
test/native/
Main
.h
→
test/native/
NativeTest
.h
View file @
32b3025a
#ifdef __HAVE_TESTS__
#ifndef CHAILOVE_TEST_NATIVE_MAIN_H
#define CHAILOVE_TEST_NATIVE_MAIN_H
#ifndef CHAILOVE_TEST_NATIVE_NATIVETEST_H
#define CHAILOVE_TEST_NATIVE_NATIVETEST_H
#include "../../src/love/Types/Graphics/Image.h"
#include "../../src/love/Types/Graphics/Font.h"
#include "../../src/love/config.h"
#include "../../src/love/Types/Audio/SoundData.h"
#include "../../src/ChaiLove.h"
using
love
::
Types
::
Graphics
::
Image
;
using
love
::
Types
::
Graphics
::
Font
;
using
love
::
config
;
using
love
::
Types
::
Audio
::
SoundData
;
using
::
ChaiLove
;
class
Main
{
class
NativeTest
{
public:
void
conf
(
config
&
t
);
bool
load
();
...
...
@@ -27,7 +24,6 @@ public:
Font
*
secondfont
;
SoundData
*
jump
;
Image
*
img
;
ChaiLove
*
app
;
};
#endif
...
...
test/native/README.md
0 → 100644
View file @
32b3025a
# Native Tests
This provides some native tests to call ChaiLove directly through C++.
## Usage
```
make test-native
```
...or...
```
make tests
retroarch -L chailove_libretro.so test/native/main.chai
```
test/native/main.chai
0 → 100644
View file @
32b3025a
def draw() {
love.graphics.print("See NativeTests.cpp for the test cases", 5, 5)
}
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