native-lib.cpp 654 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdint.h>
  2. #include "Game.h"
  3. extern "C" {
  4. Game game[] = {Game(0), Game(0)};
  5. void gameInit(int gameType, int count) {
  6. for (int i = 0; i < count; i++) {
  7. game[i] = Game(gameType);
  8. }
  9. }
  10. void gameProcessBuf(
  11. int id,
  12. uint8_t *buf,
  13. int len,
  14. int *result) {
  15. game[id].GameProcess(buf, len);
  16. game[id].getGameResult(result);
  17. }
  18. void getGameResult(
  19. int id,
  20. int *result) {
  21. game[id].getGameResult(result);
  22. }
  23. int getInteractionCMD() {
  24. return game[0].getInteractionCMD();
  25. }
  26. void getGameVersion(char* version) {
  27. std::string v = GAME_VERSION;
  28. strcpy(version,v.c_str());
  29. }
  30. }