Advertisement
Ancurio

mkxpRawKeyStates

Oct 14th, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.59 KB | None | 0 0
  1. diff --git a/binding-mri/binding-mri.cpp b/binding-mri/binding-mri.cpp
  2. index 6fccdd5..9848652 100644
  3. --- a/binding-mri/binding-mri.cpp
  4. +++ b/binding-mri/binding-mri.cpp
  5. @@ -74,6 +74,7 @@ void graphicsBindingInit();
  6.  
  7.  void fileIntBindingInit();
  8.  
  9. +RB_METHOD(mkxpRawKeyStates);
  10.  RB_METHOD(mriPrint);
  11.  RB_METHOD(mriP);
  12.  RB_METHOD(mriDataDirectory);
  13. @@ -141,10 +142,21 @@ static void mriBindingInit()
  14.     VALUE mod = rb_define_module("System");
  15.     _rb_define_module_function(mod, "data_directory", mriDataDirectory);
  16.     _rb_define_module_function(mod, "puts", mkxpPuts);
  17. +   _rb_define_module_function(mod, "raw_key_states", mkxpRawKeyStates);
  18.  
  19.     rb_gv_set("MKXP", Qtrue);
  20.  }
  21.  
  22. +RB_METHOD(mkxpRawKeyStates)
  23. +{
  24. +   RB_UNUSED_PARAM;
  25. +
  26. +   VALUE str = rb_str_new(0, sizeof(EventThread::keyStates));
  27. +   memcpy(RSTRING_PTR(str), EventThread::keyStates, sizeof(EventThread::keyStates));
  28. +
  29. +   return str;
  30. +}
  31. +
  32.  static void
  33.  showMsg(const std::string &msg)
  34.  {
  35. diff --git a/src/eventthread.cpp b/src/eventthread.cpp
  36. index 6678772..6000dad 100644
  37. --- a/src/eventthread.cpp
  38. +++ b/src/eventthread.cpp
  39. @@ -34,7 +34,7 @@
  40.  
  41.  #include <string.h>
  42.  
  43. -bool EventThread::keyStates[] = { false };
  44. +uint8_t EventThread::keyStates[] = { false };
  45.  
  46.  EventThread::JoyState EventThread::joyState =
  47.  {
  48. diff --git a/src/eventthread.h b/src/eventthread.h
  49. index ec5e8bb..15d4f63 100644
  50. --- a/src/eventthread.h
  51. +++ b/src/eventthread.h
  52. @@ -42,7 +42,7 @@ struct SDL_Window;
  53.  class EventThread
  54.  {
  55.  public:
  56. -   static bool keyStates[SDL_NUM_SCANCODES];
  57. +   static uint8_t keyStates[SDL_NUM_SCANCODES];
  58.  
  59.     struct JoyState
  60.     {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement