2016-10-05 16:03:29 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Copyright (C) 2015 Dimok
|
|
|
|
* Modified by Maschell, 2016 for GX2_GUI_Template
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _MAIN_WINDOW_TV_H_
|
|
|
|
#define _MAIN_WINDOW_TV_H_
|
|
|
|
|
|
|
|
#include "gui/Gui.h"
|
|
|
|
#include "gui/GuiMainWindowScreen.h"
|
|
|
|
#include "gui/VPadController.h"
|
|
|
|
#include "game/Pipe.h"
|
|
|
|
#include "game/Background.h"
|
|
|
|
#include "game/ScoreImage.h"
|
|
|
|
#include "game/SplashScreen.h"
|
|
|
|
|
|
|
|
#define state_splash 0
|
|
|
|
#define state_ingame 1
|
|
|
|
#define state_gameover 2
|
|
|
|
#define state_die 5
|
|
|
|
#define state_collided 3
|
|
|
|
#define state_show_gameover 4
|
|
|
|
|
|
|
|
class CVideo;
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
class MainWindowTV : public GuiMainWindowScreen {
|
2016-10-05 16:03:29 +02:00
|
|
|
public:
|
|
|
|
MainWindowTV(int w, int h);
|
2020-07-05 13:34:13 +02:00
|
|
|
|
2016-10-05 16:03:29 +02:00
|
|
|
virtual ~MainWindowTV();
|
2020-07-05 13:34:13 +02:00
|
|
|
|
2016-10-05 16:03:29 +02:00
|
|
|
private:
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
GuiImage bgImageColor;
|
|
|
|
|
|
|
|
GuiSound *wingSound;
|
|
|
|
GuiSound *pointSound;
|
|
|
|
GuiSound *swooshSound;
|
|
|
|
GuiSound *dieSound;
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
GuiImageData *bgImgData;
|
|
|
|
GuiImageData *fgImgData;
|
|
|
|
GuiImageData *splashImgData;
|
|
|
|
GuiImageData *looseImgData;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
Background *bg;
|
|
|
|
Background *fg;
|
2016-10-05 16:03:29 +02:00
|
|
|
//GuiImage* splash; //Splash screen
|
2020-07-05 13:34:13 +02:00
|
|
|
SplashScreen *splash;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
|
|
|
ScoreImage *score_img;
|
2020-07-05 13:34:13 +02:00
|
|
|
int score = 0;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
Pipe *pipes[4];
|
2016-10-05 16:03:29 +02:00
|
|
|
int collision_state[4];
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
int bg_offset = 0;
|
|
|
|
int fg_offset = 0;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
|
|
|
GuiImageData *flappy_bird_frm[4];
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
GuiImage *flappy_bird;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
int flappy_bird_change_skip = 0;
|
|
|
|
int flappy_bird_curr_frame = 0;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
int game_state = 0; //0=start, 1=in-game, 2=game over
|
|
|
|
int set_gameover = 0;
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
#define gravity 0.25f
|
|
|
|
#define jump -4.6f
|
2016-10-05 16:03:29 +02:00
|
|
|
|
2020-07-05 13:34:13 +02:00
|
|
|
float flappy_bird_position = -5.0f;
|
2016-10-05 16:03:29 +02:00
|
|
|
float flappy_bird_velocity = 0.0f;
|
|
|
|
float flappy_bird_rotation = 0.0f;
|
|
|
|
|
|
|
|
void draw(CVideo *v);
|
2020-07-05 13:34:13 +02:00
|
|
|
|
|
|
|
void update(GuiController *c);
|
|
|
|
|
2016-10-05 16:03:29 +02:00
|
|
|
void process();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //_MAIN_WINDOW_TV_H_
|