Kaynağa Gözat

添加dancegame getResult的接口

liangjianbo 4 yıl önce
ebeveyn
işleme
733b334cfd
3 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 8 2
      shoes_sdk/DanceGame.cpp
  2. 1 0
      shoes_sdk/DanceGame.h
  3. 1 2
      shoes_sdk/Game.cpp

+ 8 - 2
shoes_sdk/DanceGame.cpp

@@ -2,9 +2,15 @@
 //
 #include "DanceGame.h"
 
+
+void DanceGame::getResult(int* matrix)
+{
+	memcpy(matrix, result, 4 * sizeof(int));
+}
+
 DanceGame::DanceGame()
 {
-	memset(result, -1, 4 * sizeof(int));
+	memset(result, 0, 4 * sizeof(int));
 
 	memset(h_pos_last, 0, 4 * sizeof(short));
 
@@ -115,7 +121,7 @@ void DanceGame::game_boundary(short *global_pos)
 short DanceGame::dance_game_process(short* pos, short zupt, int s_rssi, short host_or_slave)
 {
 
-	short pos_index = -1;
+	short pos_index = 0;
 
 	if (s_rssi < 45 && rssi_flag == 0)
 	{

+ 1 - 0
shoes_sdk/DanceGame.h

@@ -16,6 +16,7 @@ public:
 	void game_boundary(short *global_pos);
 	short dance_game_process(short* pos, short zupt, int s_rssi, short host_or_slave);
 	void Process(short* right_pos, short* right_att, int right_zupt, short* left_pos, short* left_att, int left_zupt, int jump, int down, int rssi);
+	void getResult(int *matrix);
 
 private:
 

+ 1 - 2
shoes_sdk/Game.cpp

@@ -65,6 +65,7 @@ void Game::GameProcess(short* right_pos, short* right_att, int right_zupt, short
 
 		dancegame.Process(right_pos, right_att, right_zupt, left_pos, left_att, left_zupt, jump, down, rssi);
 
+		dancegame.getResult(resultMatrix);
 	}
 
 }
@@ -72,8 +73,6 @@ void Game::GameProcess(short* right_pos, short* right_att, int right_zupt, short
 void Game::RunGameProcess(short* right_pos, short* right_att, int right_zupt, short* left_pos, short* left_att, int left_zupt, int jump, int down)
 {
 	rungame.Process( right_pos, right_att,  right_zupt, left_pos, left_att, left_zupt, jump, down);
-
-	rungame.getResult(resultMatrix);
 }