Skip to content

Commit

Permalink
Added header file for BattleApp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ohmnivore committed Sep 16, 2018
1 parent 82d704b commit 18e4190
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 46 deletions.
48 changes: 2 additions & 46 deletions code/BattleApp.cc
Original file line number Diff line number Diff line change
@@ -1,56 +1,13 @@
#include "Pre.h"
#include "BattleApp.h"

#include "Assets/Gfx/ShapeBuilder.h"
#include "Core/Main.h"
#include "Gfx/Gfx.h"

#include "glm/mat4x4.hpp"
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtx/matrix_transform_2d.hpp"

#include "Camera.h"
#include "Controls.h"
#include "Renderer.h"
#include "Resources.h"
#include "shaders.h"
#include "Assets/Gfx/ShapeBuilder.h"

using namespace Oryol;


class BattleApp : public App {

public:

AppState::Code OnRunning();

AppState::Code OnInit();

AppState::Code OnCleanup();

private:

void DrawTilemap(Renderer::Tilemap& tilemap);

void DrawRenderable(Renderer::Renderable& rend);

Id MainRenderPass;
DrawState MainDrawState; // Renders to texture at native GBA resolution
MainShader::gl vsGLParams;
MainShader::gba vsGBAParams;
glm::mat4 ViewProj;

DrawState ScreenQuadDrawState; // Displays render texture to screen, upscaled

Id UnitMesh;

Camera Cam;
Renderer Renderer;
Controls Controls;
Resources Res;
};
OryolMain(BattleApp);


void BattleApp::DrawTilemap(Renderer::Tilemap& tilemap) {
vsGBAParams.size = Res.Lvl.texSizes[tilemap.texIdx];

Expand All @@ -71,7 +28,6 @@ void BattleApp::DrawTilemap(Renderer::Tilemap& tilemap) {
Gfx::Draw(0);
}


void BattleApp::DrawRenderable(Renderer::Renderable& rend) {
vsGBAParams.size = Res.Lvl.texSizes[rend.texIdx];

Expand Down
50 changes: 50 additions & 0 deletions code/BattleApp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once
#include "Pre.h"

#include "glm/mat4x4.hpp"

#include "Core/Main.h"
#include "Gfx/Gfx.h"

#include "Camera.h"
#include "Controls.h"
#include "Renderer.h"
#include "Resources.h"
#include "shaders.h"

using namespace Oryol;


class BattleApp : public App {

public:

AppState::Code OnRunning();

AppState::Code OnInit();

AppState::Code OnCleanup();

private:

void DrawTilemap(Renderer::Tilemap& tilemap);

void DrawRenderable(Renderer::Renderable& rend);

Id MainRenderPass;
DrawState MainDrawState; // Renders to texture at native GBA resolution
MainShader::gl vsGLParams;
MainShader::gba vsGBAParams;
glm::mat4 ViewProj;

DrawState ScreenQuadDrawState; // Displays render texture to screen, upscaled

Id UnitMesh;

Camera Cam;
Renderer Renderer;
Controls Controls;
Resources Res;
};

OryolMain(BattleApp);
1 change: 1 addition & 0 deletions code/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fips_begin_app(BattleApp windowed)
endif()

fips_files(BattleApp.cc)
fips_files(BattleApp.h)
fips_files(Camera.cc)
fips_files(Camera.h)
fips_files(Controls.cc)
Expand Down

0 comments on commit 18e4190

Please sign in to comment.