Skip to content

Commit

Permalink
fixed MazeGenerator2 naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Tekrental authored and Tekrental committed Jan 10, 2014
1 parent c3a81be commit 88a46a1
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CloudsVisualSystemMazeGenerator2::CloudsVisualSystemMazeGenerator2()

void CloudsVisualSystemMazeGenerator2::selfSetupGui()
{
ParamManager* pm = &ParamManager::getInstance();
ParamManager2* pm = &ParamManager2::getInstance();

customGui = new ofxUISuperCanvas("MAZE BUILDER 2", gui);
customGui->copyCanvasStyle(gui);
Expand Down Expand Up @@ -107,10 +107,10 @@ void CloudsVisualSystemMazeGenerator2::guiRenderEvent(ofxUIEventArgs &e)
void CloudsVisualSystemMazeGenerator2::selfSetup()
{
// maze = new Maze(30, 4, 30);
maze[0] = new Maze(60, 8, 40);
maze[0] = new Maze2(60, 8, 40);
maze[0]->generate();

mazeCam = new MazeCamera(maze[0]->getWidth()/2, ParamManager::getInstance().cameraHeight, 100);
mazeCam = new MazeCamera2(maze[0]->getWidth()/2, ParamManager2::getInstance().cameraHeight, 100);

light = new ofLight();
light->setDirectional();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#pragma once

#include "CloudsVisualSystem.h"
#include "ParamManager.h"
#include "Maze.h"
#include "ParamManager2.h"
#include "Maze2.h"

//TODO: rename this to your own visual system
class CloudsVisualSystemMazeGenerator2 : public CloudsVisualSystem {
Expand Down Expand Up @@ -98,8 +98,8 @@ class CloudsVisualSystemMazeGenerator2 : public CloudsVisualSystem {
protected:
void setLightOri(ofLight* light, ofVec3f rot);

Maze* maze[3];
MazeCamera* mazeCam;
Maze2* maze[3];
MazeCamera2* mazeCam;

ofLight *light;
ofVec3f lightAng;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
//
//

#include "Maze.h"
#include "Maze2.h"

//#define SIDE_WALLS

Maze::Maze(float cSize, float wThickness, float wHeight, ofVec3f p)
Maze2::Maze2(float cSize, float wThickness, float wHeight, ofVec3f p)
{
cellSize = cSize;
wallThickness = wThickness;
wallHeight = wHeight;
pos = p;

for (int i=0; i<NUM_CELLS_X; i++) {
for (int j=0; j<NUM_CELLS_Y; j++)
for (int i=0; i<NUM_CELLS_X2; i++) {
for (int j=0; j<NUM_CELLS_Y2; j++)
{
cells[i][j] = new MazeCell(i, j, cellSize,
cells[i][j] = new MazeCell2(i, j, cellSize,
wallThickness, wallHeight);
}
}
Expand All @@ -34,18 +34,18 @@ Maze::Maze(float cSize, float wThickness, float wHeight, ofVec3f p)
currentYLimit = 40;
}

Maze::~Maze()
Maze2::~Maze2()
{
for (int i=0; i<NUM_CELLS_X; i++)
for (int i=0; i<NUM_CELLS_X2; i++)
{
for (int j=0; j<NUM_CELLS_Y; j++)
for (int j=0; j<NUM_CELLS_Y2; j++)
{
delete cells[i][j];
}
}
}

void Maze::generate()
void Maze2::generate()
{
// set starting (exit) point
int randX = 0;
Expand All @@ -67,7 +67,7 @@ void Maze::generate()
}
}

void Maze::update(ofCamera *cam)
void Maze2::update(ofCamera *cam)
{
if (!finishedGenerating) {
for (int i=0; i<4; i++) {
Expand All @@ -76,13 +76,13 @@ void Maze::update(ofCamera *cam)
}
}

void Maze::draw(ofCamera *cam)
void Maze2::draw(ofCamera *cam)
{
ofPushMatrix();
ofTranslate(pos);
// for tiling
int yStart = cam->getPosition().z/cellSize-25;
int yLimit = min(yStart+(int)ParamManager::getInstance().showAhead,NUM_CELLS_Y);
int yLimit = min(yStart+(int)ParamManager2::getInstance().showAhead,NUM_CELLS_Y2);
if (yStart < 0) {
yStart = 0;
}
Expand All @@ -91,10 +91,10 @@ void Maze::draw(ofCamera *cam)

// draw the ground
ofFill();
ofSetColor(ParamManager::getInstance().getGroundColor());
ofSetColor(ParamManager2::getInstance().getGroundColor());
ofPushMatrix();
ofTranslate(NUM_CELLS_X*cellSize/2, -wallHeight/2, middle*cellSize);
ofScale(NUM_CELLS_X*cellSize+120, 1, length*cellSize);
ofTranslate(NUM_CELLS_X2*cellSize/2, -wallHeight/2, middle*cellSize);
ofScale(NUM_CELLS_X2*cellSize+120, 1, length*cellSize);
ofBox(1);
ofPopMatrix();

Expand All @@ -107,14 +107,14 @@ void Maze::draw(ofCamera *cam)
ofBox(1);
ofPopMatrix();
ofPushMatrix();
ofTranslate(NUM_CELLS_X*cellSize+0.1, 800-wallHeight/2, middle*cellSize);
ofTranslate(NUM_CELLS_X2*cellSize+0.1, 800-wallHeight/2, middle*cellSize);
ofScale(wallThickness, 1600, length*cellSize);
ofBox(1);
ofPopMatrix();
#endif

// draw the cells
for (int i=0; i<NUM_CELLS_X; i++)
for (int i=0; i<NUM_CELLS_X2; i++)
{
for (int j=yStart; j<yLimit; j++)
{
Expand All @@ -125,12 +125,12 @@ void Maze::draw(ofCamera *cam)
ofPopMatrix();
}

float Maze::getWidth()
float Maze2::getWidth()
{
return NUM_CELLS_X*cellSize;
return NUM_CELLS_X2*cellSize;
}

void Maze::generateStep()
void Maze2::generateStep()
{
if (finishedGenerating) { return; }
bool valid = false;
Expand Down Expand Up @@ -161,7 +161,7 @@ void Maze::generateStep()
}
break;
case 1:
if (curx < NUM_CELLS_X-1 && cells[curx+1][cury]->notVisited()) {
if (curx < NUM_CELLS_X2-1 && cells[curx+1][cury]->notVisited()) {
currentCell->right = false;
currentCell = cells[curx+1][cury];
currentCell->visit();
Expand All @@ -173,7 +173,7 @@ void Maze::generateStep()
}
break;
case 2:
if (cury < min(NUM_CELLS_Y-1,currentYLimit-1) && cells[curx][cury+1]->notVisited()) {
if (cury < min(NUM_CELLS_Y2-1,currentYLimit-1) && cells[curx][cury+1]->notVisited()) {
currentCell->bottom = false;
currentCell = cells[curx][cury+1];
currentCell->visit();
Expand Down Expand Up @@ -205,7 +205,7 @@ void Maze::generateStep()
else {
int prevLimit = currentYLimit;
currentYLimit += 60;
if (prevLimit > NUM_CELLS_Y) {
if (prevLimit > NUM_CELLS_Y2) {
finishedGenerating = true;
currentCell = NULL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
#define __MazeGenerator__Maze__

#include <ofMain.h>
#include "MazeCamera.h"
#include "MazeCell.h"
#include "ParamManager.h"
#include "MazeCamera2.h"
#include "MazeCell2.h"
#include "ParamManager2.h"

#define NUM_CELLS_X 61
#define NUM_CELLS_Y 10000
#define NUM_CELLS_X2 61
#define NUM_CELLS_Y2 10000

class Maze
class Maze2
{
public:
float cellSize;
float wallThickness;
float wallHeight;

Maze(float cSize, float wThick, float wHeight, ofVec3f p = ofVec3f());
~Maze();
Maze2(float cSize, float wThick, float wHeight, ofVec3f p = ofVec3f());
~Maze2();
void generate();

void update(ofCamera* cam);
Expand All @@ -40,12 +40,12 @@ class Maze
ofVec3f pos;
ofVbo geometry;

MazeCell* cells[NUM_CELLS_X][NUM_CELLS_Y];
std::stack<MazeCell*> cellStack;
MazeCell2* cells[NUM_CELLS_X2][NUM_CELLS_Y2];
std::stack<MazeCell2*> cellStack;
int step;
int currentYLimit;
MazeCell* currentCell;
MazeCell* exitCell;
MazeCell2* currentCell;
MazeCell2* exitCell;

bool finishedGenerating;
bool finishedSolving;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
//
//

#include "MazeCamera.h"
#include "MazeCamera2.h"

MazeCamera::MazeCamera(float x, float y, float z) : ofCamera()
MazeCamera2::MazeCamera2(float x, float y, float z) : ofCamera()
{
setPosition(x, y, z);
lookAt(ofVec3f(x, y, z+10));
rotate(ParamManager::getInstance().cameraAngle, ofVec3f(1, 0, 0));
rotate(ParamManager2::getInstance().cameraAngle, ofVec3f(1, 0, 0));
setFov(100);

vel = ofVec3f(0, 0, 1);
}

//#define FLYING_CAM

void MazeCamera::update()
void MazeCamera2::update()
{
#ifdef FLYING_CAM
float mazeWidth = 1860;
Expand All @@ -29,15 +29,15 @@ void MazeCamera::update()
vel = (mousePos-getPosition()).normalize() * ParamManager::getInstance().cameraSpeed;
lookAt(mousePos);
#else
setPosition(getPosition().x, ParamManager::getInstance().cameraHeight, getPosition().z);
vel = ofVec3f(0, 0, ParamManager::getInstance().cameraSpeed);
setPosition(getPosition().x, ParamManager2::getInstance().cameraHeight, getPosition().z);
vel = ofVec3f(0, 0, ParamManager2::getInstance().cameraSpeed);
lookAt(getPosition() + ofVec3f(0, 0, 10));
#endif
rotate(ParamManager::getInstance().cameraAngle, ofVec3f(1, 0, 0));
rotate(ParamManager2::getInstance().cameraAngle, ofVec3f(1, 0, 0));
move(vel);
}

void MazeCamera::draw()
void MazeCamera2::draw()
{
ofPushMatrix();
ofTranslate(mousePos);
Expand All @@ -47,12 +47,12 @@ void MazeCamera::draw()
ofPopMatrix();
}

void MazeCamera::setVelocity(ofVec3f v)
void MazeCamera2::setVelocity(ofVec3f v)
{
vel = v;
}

void MazeCamera::applyLimits(ofVec3f &p)
void MazeCamera2::applyLimits(ofVec3f &p)
{
if (p.x < 50) {
p.x = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
#define __MazeGenerator__MazeCamera__

#include <ofMain.h>
#include "ParamManager.h"
#include "Maze.h"
#include "ParamManager2.h"
#include "Maze2.h"

class MazeCamera : public ofCamera
class MazeCamera2 : public ofCamera
{
public:

MazeCamera(float x, float y, float z);
MazeCamera2(float x, float y, float z);

void update();
void draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//
//

#include "MazeCell.h"
#include "MazeCell2.h"

MazeCell::MazeCell(int _x, int _y, float s, float t, float h)
MazeCell2::MazeCell2(int _x, int _y, float s, float t, float h)
{
x = _x;
y = _y;
Expand All @@ -24,7 +24,7 @@ MazeCell::MazeCell(int _x, int _y, float s, float t, float h)
visible = true;
}

void MazeCell::draw(bool isGenerator)
void MazeCell2::draw(bool isGenerator)
{
if (!visible) {
return;
Expand All @@ -33,7 +33,7 @@ void MazeCell::draw(bool isGenerator)
if (isGenerator)
{
ofFill();
ofSetColor(ParamManager::getInstance().getGeneratorColor());
ofSetColor(ParamManager2::getInstance().getGeneratorColor());
ofPushMatrix();
ofTranslate(x*size+size/2, 0, y*size+size/2);
ofScale(size, size, size);
Expand All @@ -42,7 +42,7 @@ void MazeCell::draw(bool isGenerator)
}

ofFill();
ofSetColor(ParamManager::getInstance().getWallColor());
ofSetColor(ParamManager2::getInstance().getWallColor());

if (top && bottom && right && left) {
// ofPushMatrix();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#define __MazeGenerator__MazeCell__

#include <ofMain.h>
#include "ParamManager.h"
#include "ParamManager2.h"

class MazeCell
class MazeCell2
{
public:
float size;
Expand All @@ -23,7 +23,7 @@ class MazeCell
bool searchStart;
bool visible;

MazeCell(int x, int y, float s, float thickness, float height);
MazeCell2(int x, int y, float s, float thickness, float height);

void draw(bool isGenerator);

Expand Down
Loading

0 comments on commit 88a46a1

Please sign in to comment.