Verified Commit cfd13009 authored by RobLoach's avatar RobLoach
Browse files

Update documentation

parent 629f0e9c
......@@ -6,11 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## 0.24.0 - Unreleased
### Features
- Update to use libretro-common audio
- Added `love.system.getClipboardText()`
- Added `love.system.setClipboardText()`
- Added `love.data.encode()`
- Added `love.data.decode()`
- New audio system from libretro-common
### Chores
- Added `love.filesystem.mount()` test
......
......@@ -66,7 +66,7 @@ docs/html: docs-clean
doxygen docs/Doxyfile
docs-start: docs/html
php -S localhost:9999 -t docs/html
php -S localhost:8080 -t docs/html
docs-clean:
rm -rf docs/html
......
......@@ -3,28 +3,29 @@
*
* This provides a quick introduction on how to get started with [ChaiLove](http://github.com/libretro/libretro-chailove).
*
* ## Get ChaiLove
* ## 1. Install ChaiLove
*
* ChaiLove is a [libretro](https://www.libretro.com/) core, which can be run through [RetroArch](http://retroarch.com/). To play the sample game [Floppy Bird](https://github.com/RobLoach/ChaiLove-FloppyBird)...
* ChaiLove is a [libretro](https://www.libretro.com/) core, which can be run through [RetroArch](http://retroarch.com/). It can be installed through the user interface...
* 1. Run [RetroArch](http://retroarch.com/)
* 2. *Online Updater* → *Core Updator* → *ChaiLove*
*
* ## Running Games
* ## 2. Running Games
*
* ChaiLove can load a game in two ways:
*
* 1. Run on a `main.chai` file
* 2. Run on a compressed `game.chailove` file
* 1. Run the `main.chai` file
* 2. Run the compressed `game.chailove` file
*
* To download and play the sample game, [Floppy Bird](https://github.com/RobLoach/ChaiLove-FloppyBird)...
*
* To [download and play](https://github.com/RobLoach/ChaiLove-FloppyBird/releases) the sample [Floppy Bird](https://github.com/RobLoach/ChaiLove-FloppyBird) game...
* 1. Run RetroArch
* 2. Visit *Online Updater* → *Content Downloader* → *ChaiLove* → *Floppy Bird*
* 3. *Load Content* → *Downloads* → *Floppy Bird.chailove*
*
* To run games through ChaiLove manually through the command line interface...
* To run games through the command line...
*
* @code
* retroarch -L chailove_libretro.so path/to/FloppyBird.chailove
* retroarch -L chailove_libretro.so FloppyBird.chailove
* @endcode
*
* ## Next Steps
......
......@@ -10,6 +10,8 @@ namespace Graphics {
/**
* Drawable image type.
*
* @see love.graphics.newImage
*/
class Image {
public:
......
......@@ -33,8 +33,6 @@ class audio {
SoundData* newSource(const std::string& filename, const std::string& type);
SoundData* newSource(const std::string& filename);
float m_volume = 1.0f;
/**
* Returns the master volume.
*
......@@ -50,6 +48,8 @@ class audio {
* @return The audio module, to allow method chaining.
*/
audio& setVolume(float volume);
float m_volume = 1.0f;
};
} // namespace love
......
......@@ -19,8 +19,6 @@ class filesystem {
/**
* Loads and runs a .chai file.
*
* @param file The name (and path) of the file. Having the .chai extension at the end is optional.
*
* ### Example
*
* @code
......@@ -28,6 +26,8 @@ class filesystem {
* love.filesystem.load("myotherscript")
* @endcode
*
* @param file The name (and path) of the file. Having the .chai extension at the end is optional.
*
* @return Whether or not the file was loaded and ran properly.
*/
bool load(const std::string& file);
......
......@@ -20,6 +20,12 @@ class image {
/**
* Creates a new ImageData object.
*
* ## Example
*
* @code
* var bear = love.image.newImageData("bear.png")
* @endcode
*
* @param filename The filename of the image file.
*
* @return The new ImageData object.
......
......@@ -49,9 +49,18 @@ class joystick {
/**
* Checks if a button is pressed on a joystick.
*
* ## Example
*
* @code
* if (love.joystick.isDown(0, "left")) {
* love.graphics.print("Joystick is pushed LEFT", 100, 100)
* }
* @endcode
*
* @param joystick The joystick to be checked.
* @param button The button to be checked.
*
*
* @return True if the joystick button is pressed.
*/
bool isDown(int joystick, const std::string& button);
......
......@@ -177,6 +177,8 @@ class script {
* buttonPressed = button
* }
* @endcode
*
* @see joystickreleased
*/
void joystickpressed(int joystick, const std::string& button);
......@@ -199,6 +201,8 @@ class script {
* buttonReleased = button
* }
* @endcode
*
* @see joystickpressed
*/
void joystickreleased(int joystick, const std::string& button);
......@@ -226,6 +230,8 @@ class script {
* mousey = y
* }
* @endcode
*
* @see mousereleased
*/
void mousepressed(int x, int y, const std::string& button);
......@@ -253,6 +259,8 @@ class script {
* mousey = y
* }
* @endcode
*
* @see mousepressed
*/
void mousereleased(int x, int y, const std::string& button);
......@@ -297,6 +305,8 @@ class script {
* print("Scancode: " + to_string(scancode))
* }
* @endcode
*
* @see keyreleased
*/
void keypressed(const std::string& key, int scancode);
......@@ -314,6 +324,8 @@ class script {
* print("Scancode: " + to_string(scancode))
* }
* @endcode
*
* @see keypressed
*/
void keyreleased(const std::string& key, int scancode);
......@@ -333,6 +345,8 @@ class script {
* ])
* }
* @endcode
*
* @see loadstate
*/
std::string savestate();
......@@ -354,6 +368,8 @@ class script {
* return true
* }
* @endcode
*
* @see savestate
*/
bool loadstate(const std::string& data);
......
......@@ -19,22 +19,29 @@ class sound {
void update();
~sound();
// void convert_float_to_s16(int16_t *out, const float *in, size_t samples);
/**
* Creates a new SoundData.
*
* @param filename The file name of the file to load.
*
* @return A new SoundData object, NULL if loading failed.
*
* @code
* global boom
* def load() {
* boom = love.sound.newSoundData("boom.wav")
* }
*
* def joystickpressed(joystick, button) {
* love.audio.play(beat)
* }
* @endcode
*/
Types::Audio::SoundData* newSoundData(const std::string& filename);
std::vector<Types::Audio::SoundData*> sounds;
bool m_loaded = false;
retro_audio_sample_t audio_cb = NULL;
retro_audio_sample_batch_t audio_batch_cb = NULL;
};
......
/**
* Main Test 2
* Sound Test
*
* An alternative test with a different file name.
* Focused sound test.
*
* retroarch -L chailove_libretro.so test/main2.chai
* retroarch -L chailove_libretro.so test/sound.chai
*/
global beat
......@@ -13,7 +13,7 @@ def load() {
}
def draw() {
love.graphics.print("Press a joystick button!", 5, 20)
love.graphics.print("Press a joystick button!", 20, 100)
}
def joystickpressed(joystick, button) {
......
// Linked List
var list = List()
// push_back()
list.push_back(3)
list.push_back("A")
// front() and back()
assert_equal(list.front(), 3, "List.front()")
assert_equal(list.back(), "A", "List.back()")
// size()
assert_equal(list.size(), 2, "List.size()")
// resize()
list.resize(0);
assert_equal(list.size(), 0, "List.resize()");
// Loop
var finalListItem = "This will loop through all items, and assign the last"
list.push_back("first")
list.push_back("second")
......@@ -20,5 +26,6 @@ for (listItem : list) {
}
assert_equal(finalListItem, "third", "List.for()")
// pop_front()
list.pop_front()
assert_equal(list.front(), "second", "List.pop_front()")
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