66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#include <iostream>
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
#include <vector>
|
|
#include <array>
|
|
#include <list>
|
|
#include <cstdlib>
|
|
#include <algorithm>
|
|
#include <string>
|
|
#include <functional>
|
|
#include <fstream>
|
|
|
|
#include <SDL_image.h>
|
|
#include "sdl2-gfx/SDL2_gfxPrimitives.h"
|
|
#include "sdl2-gfx/SDL2_rotozoom.h"
|
|
|
|
#define GLM_ENABLE_EXPERIMENTAL
|
|
#include "glm/gtx/string_cast.hpp"
|
|
#include "glm/gtx/transform.hpp"
|
|
#include "glm/gtc/matrix_transform.hpp"
|
|
|
|
#include "filesystem.hpp"
|
|
#include "Node.hpp"
|
|
#include "Game.hpp"
|
|
#include "Box.hpp"
|
|
#include "Sprite.hpp"
|
|
#include "Input.hpp"
|
|
#include "Delegate.hpp"
|
|
#include "extension.hpp"
|
|
|
|
struct Mushroom : Sprite
|
|
{
|
|
|
|
int direction = 1;
|
|
|
|
Mushroom(Node*);
|
|
void update();
|
|
virtual std::string class_name() const { return "Mushroom"; }
|
|
|
|
};
|
|
|
|
struct Cube : Game
|
|
{
|
|
|
|
SDL_Texture *grass_texture;
|
|
int frame_count = 0, frame_count_timestamp;
|
|
bool right_active = false, down_active = false, left_active = false,
|
|
up_active = false, is_writing_audio = true;
|
|
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");
|
|
std::vector<GLuint> face_ids;
|
|
float amount_rotated;
|
|
|
|
Cube();
|
|
void load_sdl_context();
|
|
void load_gl_context();
|
|
void respond(SDL_Event&);
|
|
void update();
|
|
virtual std::string class_name() const { return "Demo"; }
|
|
|
|
};
|