mirror of
https://github.com/libretro/libretro-chailove.git
synced 2024-11-24 08:30:04 +00:00
Update scripting
This commit is contained in:
parent
d39262a1f9
commit
f0b88b69ef
@ -5,13 +5,13 @@
|
||||
|
||||
namespace chaigame {
|
||||
|
||||
bool keyboard::isKeyDown(int key) {
|
||||
bool keyboard::isDown(int key) {
|
||||
return (bool)keys[key];
|
||||
}
|
||||
|
||||
bool keyboard::isDown(const std::string& key) {
|
||||
int keycode = getKeyCodeFromName(key);
|
||||
return isKeyDown(keycode);
|
||||
return isDown(keycode);
|
||||
}
|
||||
|
||||
int keyboard::getKeyCodeFromName(const std::string& name) {
|
||||
|
@ -11,7 +11,7 @@ namespace chaigame {
|
||||
Uint8* keys;
|
||||
bool load();
|
||||
bool isDown(const std::string& key);
|
||||
bool isKeyDown(int key);
|
||||
bool isDown(int key);
|
||||
void setKeyRepeat(int delay = 400, int interval = 30);
|
||||
bool update();
|
||||
int getKeyCodeFromName(const std::string& name);
|
||||
|
@ -91,8 +91,8 @@ namespace chaigame {
|
||||
chai.add_global(var(std::ref(app->graphics)), "graphics");
|
||||
|
||||
// Register the Keyboard module.
|
||||
chai.add(fun(&keyboard::update), "update");
|
||||
chai.add(fun(&keyboard::isDown), "isDown");
|
||||
chai.add(fun<bool, keyboard, const std::string&>(&keyboard::isDown), "isDown");
|
||||
chai.add(fun(&keyboard::setKeyRepeat), "setKeyRepeat");
|
||||
chai.add_global(var(std::ref(app->keyboard)), "keyboard");
|
||||
|
||||
// Register the Event module.
|
||||
@ -106,6 +106,7 @@ namespace chaigame {
|
||||
// Register the Filesystem module.
|
||||
chai.add(fun(&filesystem::read), "read");
|
||||
chai.add(fun(&filesystem::exists), "exists");
|
||||
chai.add(fun(&filesystem::mount), "mount");
|
||||
chai.add(fun<int, filesystem, const std::string&>(&filesystem::getSize), "getSize");
|
||||
chai.add(fun(&filesystem::load), "load");
|
||||
chai.add_global(var(std::ref(app->filesystem)), "filesystem");
|
||||
@ -262,9 +263,11 @@ namespace chaigame {
|
||||
printf("Skipping call to update(): %s\n", e.what());
|
||||
}
|
||||
catch (std::exception& e) {
|
||||
hasUpdate = false;
|
||||
printf("Failed to call update(t): %s\n", e.what());
|
||||
}
|
||||
catch (...) {
|
||||
hasUpdate = false;
|
||||
printf("Unhandled exception in update()");
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user