From 80a877a5f543936a49ecd747a5627c73afa8821f Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Sun, 18 Jul 2021 21:57:47 +0100
Subject: [PATCH] code tidy for demo

---
 demo/main.cpp | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/demo/main.cpp b/demo/main.cpp
index 70da07a..9e76acf 100644
--- a/demo/main.cpp
+++ b/demo/main.cpp
@@ -166,6 +166,16 @@ int main(int argc, char* argv[]) {
 		ecs.addComponent<fggl::gfx::Camera>(camEnt);
 	}
 
+	auto floorEnt = ecs.createEntity();
+	{
+		ecs.addComponent<fggl::math::Transform>( floorEnt );
+
+		fggl::data::Mesh mesh = fggl::data::make_quad_xz();
+
+		auto token = meshRenderer.upload( mesh );
+		auto bounds = ecs.addComponent<fggl::gfx::MeshToken>(floorEnt, token);
+	}
+
 	int nCubes = 3;
 	int nSections = 2;
 
@@ -183,8 +193,12 @@ int main(int argc, char* argv[]) {
 			const auto shapeOffset = glm::vec3( 0.0f, 0.0f, i * 1.0f );
 
 			const auto cubeMat = glm::translate( fggl::math::mat4( 1.0f ) , shapeOffset );
-			const auto leftSlope = fggl::math::modelMatrix( glm::vec3(-1.0f, 0.0f, 0.0f) + shapeOffset, glm::vec3( 0.0f, -HALF_PI, 0.0f) );
-			const auto rightSlope = fggl::math::modelMatrix( glm::vec3( 1.0f, 0.0f, 0.0f) + shapeOffset, glm::vec3( 0.0f, HALF_PI, 0.0f) );
+			const auto leftSlope = fggl::math::modelMatrix( 
+					glm::vec3(-1.0f, 0.0f, 0.0f) + shapeOffset,
+					glm::vec3( 0.0f, -HALF_PI, 0.0f) );
+			const auto rightSlope = fggl::math::modelMatrix( 
+					glm::vec3( 1.0f, 0.0f, 0.0f) + shapeOffset,
+					glm::vec3( 0.0f, HALF_PI, 0.0f) );
 
 			fggl::data::make_cube( mesh, cubeMat );
 			fggl::data::make_slope( mesh, leftSlope );
@@ -231,12 +245,16 @@ int main(int argc, char* argv[]) {
 					const fggl::gfx::Joystick& joyData = input.joystick(i);
 					ImGui::Text( "%s", joyData.name );
 					ImGui::Text( "gamepad: %s", joyData.gamepad ? "yes" : "no" );
-					ImGui::Text( "axes: %d, buttons: %d, hats: %d", joyData.axisCount, joyData.buttonCount, joyData.hatCount);
+					ImGui::Text( "axes: %d, buttons: %d, hats: %d",
+							joyData.axisCount,
+							joyData.buttonCount,
+							joyData.hatCount);
 
 					if (ImGui::TreeNode("axis##2")) {
 						// dump data
 						for ( int axid = 0; axid < joyData.axisCount; axid++ ) {
-							ImGui::Text("axis %d, value: %f", axid, joyData.axes[axid] );
+							ImGui::Text("axis %d, value: %f", 
+									axid, joyData.axes[axid] );
 						}
 						ImGui::TreePop();
 					}
@@ -244,7 +262,9 @@ int main(int argc, char* argv[]) {
 					if (ImGui::TreeNode("buttons##2")) {
 						// dump data
 						for ( int btnid = 0; btnid < joyData.buttonCount; btnid++ ) {
-							ImGui::Text("button %d, value: %s", btnid, joyData.buttons[btnid] == GLFW_PRESS ? "down" : "up" );
+							ImGui::Text("button %d, value: %s", btnid,
+									joyData.buttons[btnid] == GLFW_PRESS
+									? "down" : "up" );
 						}
 						ImGui::TreePop();
 					}
@@ -252,7 +272,8 @@ int main(int argc, char* argv[]) {
 					if (ImGui::TreeNode("hats##2")) {
 						// dump data
 						for ( int btnid = 0; btnid < joyData.hatCount; btnid++ ) {
-							ImGui::Text("button %d, value: %d", btnid, joyData.hats[btnid] );
+							ImGui::Text("button %d, value: %d",
+									btnid, joyData.hats[btnid] );
 						}
 						ImGui::TreePop();
 					}
-- 
GitLab