15 #ifndef PIE_NOON_GAME_H
16 #define PIE_NOON_GAME_H
19 #define PIE_NOON_USES_GOOGLE_PLAY_GAMES
22 #include "ai_controller.h"
23 #include "cardboard_controller.h"
24 #include "fplbase/asset_manager.h"
25 #include "fplbase/input.h"
26 #include "fplbase/renderer.h"
27 #include "full_screen_fader.h"
28 #include "game_state.h"
30 #include "multiplayer_controller.h"
31 #include "multiplayer_director.h"
32 #include "pindrop/pindrop.h"
33 #include "player_controller.h"
34 #include "scene_description.h"
35 #include "touchscreen_button.h"
36 #include "touchscreen_controller.h"
38 #ifdef ANDROID_GAMEPAD
39 #include "gamepad_controller.h"
40 #endif // ANDROID_GAMEPAD
41 #ifdef PIE_NOON_USES_GOOGLE_PLAY_GAMES
42 #include "gpg_manager.h"
43 #include "gpg_multiplayer.h"
50 class CharacterStateMachine;
51 struct RenderingAssets;
55 kLoadingInitialMaterials,
70 bool Initialize(
const char*
const binary_directory);
74 static void SetOverlayName(
const char* overlay_name) {
75 overlay_name_ = overlay_name;
78 #if defined(__ANDROID__)
80 static void ParseViewIntentData(
const std::string& intent_data,
81 std::string* launch_mode,
82 std::string* overlay);
83 #endif // defined(__ANDROID__)
86 bool InitializeConfig();
88 bool InitializeCardboardConfig();
90 bool InitializeGpgIds();
91 bool InitializeRenderer();
92 fplbase::Mesh* CreateVerticalQuadMesh(
93 const flatbuffers::String* material_name,
const vec3& offset,
94 const vec2& pixel_bounds,
float pixel_to_world_scale);
95 bool InitializeRenderingAssets();
96 bool InitializeGameState();
98 const mat4& camera_transform);
103 const mat4& additional_camera_changes,
104 const vec2i& resolution);
106 const mat4& additional_camera_changes);
107 void CorrectCardboardCamera(mat4& cardboard_camera);
108 void DebugPrintCharacterStates();
109 void DebugPrintPieStates();
111 const Config& GetConfig()
const;
112 const Config& GetCardboardConfig()
const;
113 const CharacterStateMachineDef* GetStateMachine()
const;
114 fplbase::Mesh* GetCardboardFront(
int renderable_id,
int variant);
115 PieNoonState UpdatePieNoonState();
116 void TransitionToPieNoonState(PieNoonState next_state);
117 PieNoonState UpdatePieNoonStateAndTransition();
118 void FadeToPieNoonState(PieNoonState next_state,
const WorldTime& fade_time,
119 const mathfu::vec4& color,
const bool fade_in);
120 bool Fading()
const {
return fade_exit_state_ != kUninitialized; }
122 void UploadAndShowLeaderboards();
123 void UpdateGamepadControllers();
125 ControllerId AddController(
Controller* new_controller);
127 ControllerId FindNextUniqueControllerId();
128 void HandlePlayersJoining(
Controller* controller);
129 void HandlePlayersJoining();
130 void AttachMultiplayerControllers();
131 PieNoonState HandleMenuButtons(WorldTime time);
133 void UpdateControllers(WorldTime delta_time);
134 void UpdateTouchButtons(WorldTime delta_time);
136 pindrop::Channel PlayStinger();
137 void InitCountdownImage(
int seconds);
138 void UpdateCountdownImage(WorldTime time);
140 ButtonId CurrentlyAnimatingJoinImage(WorldTime time)
const;
141 const char* TutorialSlideName(
int slide_index);
142 bool AnyControllerPresses();
143 void LoadTutorialSlide(
int slide_index);
144 void LoadInitialTutorialSlides();
145 void RenderInMiddleOfScreen(
const mathfu::mat4& ortho_mat,
float x_scale,
146 fplbase::Material* material);
148 void ProcessMultiplayerMessages();
149 void ProcessPlayerStatusMessage(
const multiplayer::PlayerStatus&);
152 bool ShowMultiscreenSplat(
int splat_num);
154 static void StringArrayResource(
const char* resource_name,
155 std::vector<std::string>* strings);
157 void CheckForNewAchievements();
159 #ifdef PIE_NOON_USES_GOOGLE_PLAY_GAMES
160 void StartMultiscreenGameAsHost();
161 void StartMultiscreenGameAsClient(CharacterId
id);
162 void SendMultiscreenPlayerCommand();
164 void ReloadMultiscreenMenu();
165 void UpdateMultiscreenMenuIcons();
166 void SetupWaitingForPlayersMenu();
167 bool ShouldTransitionFromSlide(WorldTime world_time);
171 static bool LoadFile(
const char* filename, std::string* dest);
179 WorldTime state_entry_time_;
182 std::string config_source_;
184 std::string cardboard_config_source_;
188 fplbase::InputSystem input_;
191 fplbase::Renderer renderer_;
194 fplbase::AssetManager matman_;
197 pindrop::AudioEngine audio_engine_;
200 std::vector<fplbase::Mesh*> cardboard_fronts_[RenderableId_Count];
201 fplbase::Mesh* cardboard_backs_[RenderableId_Count];
204 fplbase::Mesh* stick_front_;
205 fplbase::Mesh* stick_back_;
208 fplbase::Shader* shader_cardboard;
209 fplbase::Shader* shader_lit_textured_normal_;
210 fplbase::Shader* shader_simple_shadow_;
211 fplbase::Shader* shader_textured_;
212 fplbase::Shader* shader_grayscale_;
215 fplbase::Material* shadow_mat_;
218 std::string state_machine_source_;
225 std::vector<std::unique_ptr<Controller>> active_controllers_;
228 std::unique_ptr<MultiplayerDirector> multiplayer_director_;
230 CharacterId multiscreen_my_player_id_;
233 ButtonId multiscreen_action_to_perform_;
236 CharacterId multiscreen_action_aim_at_;
237 int multiscreen_turn_number_;
239 float multiscreen_splat_param;
240 float multiscreen_splat_param_speed;
251 WorldTime prev_world_time_;
254 std::vector<int> debug_previous_states_;
255 std::vector<motive::Angle> debug_previous_angles_;
260 std::map<int, ControllerId> gamepad_to_controller_map_;
265 motive::Motivator1f join_motivator_;
270 PieNoonState fade_exit_state_;
273 pindrop::Channel ambience_channel_;
277 pindrop::Channel stinger_channel_;
280 pindrop::Channel music_channel_;
283 const flatbuffers::Vector<flatbuffers::Offset<fpl::pie_noon::Slide>>*
287 float tutorial_aspect_ratio_;
290 int tutorial_slide_index_;
293 WorldTime tutorial_slide_time_;
296 WorldTime join_animation_start_time_;
298 ButtonId countdown_start_button_;
301 WorldTime multiscreen_turn_end_time_;
303 int next_achievement_index_;
306 const char* version_;
309 WorldTime pause_time_;
312 static std::string overlay_name_;
314 #ifdef PIE_NOON_USES_GOOGLE_PLAY_GAMES
325 #endif // PIE_NOON_GAME_H
Definition: scene_description.h:60
Definition: touchscreen_controller.h:35
Definition: game_state.h:56
Definition: pie_noon_game.h:66
Definition: full_screen_fader.h:27
Definition: cardboard_controller.h:26
Definition: gpg_multiplayer.h:63
Definition: controller.h:26
Definition: gpg_manager.h:33