Add code snippet for Discord in README

This commit is contained in:
Inori 2019-09-04 17:43:29 -04:00
parent 374bc5ef10
commit 843cbff446
3 changed files with 37 additions and 14 deletions

View file

@ -72,21 +72,22 @@ The syntax is: `--<option>=<value>`
Example: `./mkxp --gameFolder="my game" --vsync=true --fixedFramerate=60`
## Midi music
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
You can use this public domain soundfont: [GMGSx.sf2](https://www.dropbox.com/s/qxdvoxxcexsvn43/GMGSx.sf2?dl=0)
## Fonts
In the RMXP version of RGSS, fonts are loaded directly from system specific search paths (meaning they must be installed to be available to games). Because this whole thing is a giant platform-dependent headache, Ancurio decided to implement the behavior Enterbrain thankfully added in VX Ace: loading fonts will automatically search a folder called "Fonts", which obeys the default searchpath behavior (ie. it can be located directly in the game folder, or an RTP).
If a requested font is not found, no error is generated. Instead, a built-in font is used. By default, this font is Liberation Sans. WenQuanYi MicroHei is used as the built-in font if the `cjk_fallback_font` option is used.
## Discord Support
mkxp-z can optionally be built with support for the Discord GameSDK. Currently only basic Activity (rich presence) functionality is implemented.
mkxp-z can optionally be built with support for the Discord GameSDK. Currently only basic Activity (rich presence) functionality is implemented. The Discord module is being actively fleshed out.
A different Client ID may be specified in the configuration file.
```ruby
if Discord.connected?
p Discord.user_name, Discord.user_discriminator, Discord.user_id
Discord::Activity.new do |activity|
activity.start_time = Time.now.to_i
activity.details = MKXP.game_title
end
end
```
## Win32API
@ -123,6 +124,18 @@ mkxp-z provides limited support for some WinAPI functions that would normally br
* `GetPrivateProfileString`: Emulated with MKXP's ini code.
* `GetUserDefaultLangId`: Checks for JP, EN, FR, IT, DE, ES, KO, PT and ZH. Returns English (`0x09`) if the locale can't be determined. Doesn't handle sublanguages. Use `MKXP.user_language` instead.
## Midi music
mkxp doesn't come with a soundfont by default, so you will have to supply it yourself (set its path in the config). Playback has been tested and should work reasonably well with all RTP assets.
You can use this public domain soundfont: [GMGSx.sf2](https://www.dropbox.com/s/qxdvoxxcexsvn43/GMGSx.sf2?dl=0)
## Fonts
In the RMXP version of RGSS, fonts are loaded directly from system specific search paths (meaning they must be installed to be available to games). Because this whole thing is a giant platform-dependent headache, Ancurio decided to implement the behavior Enterbrain thankfully added in VX Ace: loading fonts will automatically search a folder called "Fonts", which obeys the default searchpath behavior (ie. it can be located directly in the game folder, or an RTP).
If a requested font is not found, no error is generated. Instead, a built-in font is used. By default, this font is Liberation Sans. WenQuanYi MicroHei is used as the built-in font if the `cjk_fallback_font` option is used.
## What doesn't work (yet)
* The current implementation of `load_data` is case-sensitive. If you try to load `Data/MapXXX`, you will not find `Data/mapXXX`.

View file

@ -28,6 +28,7 @@
#include "sdl-util.h"
#include "debugwriter.h"
#include "graphics.h"
#include "config.h"
#include "audio.h"
#include "lang-fun.h"
#include "boost-hash.h"
@ -97,6 +98,7 @@ RB_METHOD(mkxpRawKeyStates);
RB_METHOD(mkxpMouseInWindow);
RB_METHOD(mkxpPlatform);
RB_METHOD(mkxpUserLanguage);
RB_METHOD(mkxpGameTitle);
RB_METHOD(mriRgssMain);
RB_METHOD(mriRgssStop);
@ -168,6 +170,7 @@ static void mriBindingInit()
_rb_define_module_function(mod, "mouse_in_window", mkxpMouseInWindow);
_rb_define_module_function(mod, "platform", mkxpPlatform);
_rb_define_module_function(mod, "user_language", mkxpUserLanguage);
_rb_define_module_function(mod, "game_title", mkxpGameTitle);
/* Load global constants */
rb_gv_set("MKXP", Qtrue);
@ -280,6 +283,13 @@ RB_METHOD(mkxpUserLanguage)
return rb_str_new_cstr(getUserLanguage());
}
RB_METHOD(mkxpGameTitle)
{
RB_UNUSED_PARAM;
return rb_str_new_cstr(shState->config().game.title.c_str());
}
static VALUE rgssMainCb(VALUE block)
{
rb_funcall2(block, rb_intern("call"), 0, 0);

View file

@ -70,7 +70,7 @@ RB_METHOD(DiscordActivityInitialize)
if (rb_block_given_p())
{
rb_yield(self);
return DiscordActivitySend(0, 0, self);
DiscordActivitySend(0, 0, self);
};
return self;
}