2019-04-23 01:42:19 -04:00
|
|
|
#include <iostream>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <vector>
|
|
|
|
#include <array>
|
|
|
|
#include <list>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <string>
|
2019-05-03 22:16:56 -04:00
|
|
|
#include <functional>
|
2019-06-04 03:20:13 -04:00
|
|
|
#include <fstream>
|
2019-04-23 01:42:19 -04:00
|
|
|
|
|
|
|
#include <SDL_image.h>
|
2019-04-29 19:27:13 -04:00
|
|
|
#include "sdl2-gfx/SDL2_gfxPrimitives.h"
|
|
|
|
#include "sdl2-gfx/SDL2_rotozoom.h"
|
2019-04-23 01:42:19 -04:00
|
|
|
|
|
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
2019-04-29 19:27:13 -04:00
|
|
|
#include "glm/gtx/string_cast.hpp"
|
|
|
|
#include "glm/gtx/transform.hpp"
|
|
|
|
#include "glm/gtc/matrix_transform.hpp"
|
2019-04-23 01:42:19 -04:00
|
|
|
|
2019-05-02 06:45:41 -04:00
|
|
|
#include "filesystem.hpp"
|
2019-04-23 01:42:19 -04:00
|
|
|
#include "Node.hpp"
|
2019-05-31 23:34:04 -04:00
|
|
|
#include "Game.hpp"
|
2020-06-27 17:47:14 -04:00
|
|
|
#include "Box.hpp"
|
2019-04-29 19:27:13 -04:00
|
|
|
#include "Sprite.hpp"
|
2019-05-02 20:11:45 -04:00
|
|
|
#include "Input.hpp"
|
2019-05-03 02:09:48 -04:00
|
|
|
#include "Delegate.hpp"
|
2019-06-16 03:05:02 -04:00
|
|
|
#include "extension.hpp"
|
2019-04-29 19:27:13 -04:00
|
|
|
|
|
|
|
struct Mushroom : Sprite
|
|
|
|
{
|
|
|
|
|
|
|
|
int direction = 1;
|
|
|
|
|
2019-05-31 23:34:04 -04:00
|
|
|
Mushroom(Node*);
|
2019-04-29 19:27:13 -04:00
|
|
|
void update();
|
2021-08-14 19:53:39 -04:00
|
|
|
virtual std::string class_name() const { return "Mushroom"; }
|
2019-04-29 19:27:13 -04:00
|
|
|
|
|
|
|
};
|
2019-05-31 23:34:04 -04:00
|
|
|
|
2021-08-31 23:55:38 -04:00
|
|
|
struct Cube : Game
|
2019-05-31 23:34:04 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
SDL_Texture *grass_texture;
|
|
|
|
int frame_count = 0, frame_count_timestamp;
|
|
|
|
bool right_active = false, down_active = false, left_active = false,
|
2019-06-04 03:20:13 -04:00
|
|
|
up_active = false, is_writing_audio = true;
|
2019-05-31 23:34:04 -04:00
|
|
|
SDL_Event event;
|
|
|
|
GLuint vbo, space_texture_id, mvp_id, framerate_texture_id, flat_program,
|
|
|
|
world_program, fake_texture_id;
|
|
|
|
glm::mat4 projection, view, model = glm::mat4(1.0f), mvp;
|
|
|
|
Mushroom mushroom = Mushroom(this);
|
|
|
|
Sprite grass = Sprite(this, "resource/Field.png");
|
2019-07-21 03:13:19 -04:00
|
|
|
std::vector<GLuint> face_ids;
|
|
|
|
float amount_rotated;
|
2019-05-31 23:34:04 -04:00
|
|
|
|
2021-08-31 23:55:38 -04:00
|
|
|
Cube();
|
2019-05-31 23:34:04 -04:00
|
|
|
void load_sdl_context();
|
|
|
|
void load_gl_context();
|
|
|
|
void respond(SDL_Event&);
|
|
|
|
void update();
|
2021-08-14 19:53:39 -04:00
|
|
|
virtual std::string class_name() const { return "Demo"; }
|
2019-05-31 23:34:04 -04:00
|
|
|
|
|
|
|
};
|