Skip to content

Commit

Permalink
Added files from previous projects
Browse files Browse the repository at this point in the history
  • Loading branch information
skdeng committed Oct 7, 2014
1 parent 31976ad commit a630067
Show file tree
Hide file tree
Showing 50 changed files with 3,862 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.sdf
*.v12.suo
/Debug/
Debug/
6 changes: 6 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Artificial
Self
Teaching
Roaming
Intelligent
Agent
22 changes: 22 additions & 0 deletions astria.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "astria", "astria\astria.vcxproj", "{AA160014-3EA4-4114-B955-031B22CC7A6A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AA160014-3EA4-4114-B955-031B22CC7A6A}.Debug|Win32.ActiveCfg = Debug|Win32
{AA160014-3EA4-4114-B955-031B22CC7A6A}.Debug|Win32.Build.0 = Debug|Win32
{AA160014-3EA4-4114-B955-031B22CC7A6A}.Release|Win32.ActiveCfg = Release|Win32
{AA160014-3EA4-4114-B955-031B22CC7A6A}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
42 changes: 42 additions & 0 deletions astria/Agent.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "State.h"
#include "Agent.h"
#include "utils.h"

Agent::Agent()
{
std::string name = "Individual " + NextValidID;
Agent(name);
}

Agent::Agent(std::string name)
{
int x = RandInt(CParams::WorldMinX, CParams::WorldMaxX);
int y = RandInt(CParams::WorldMinY, CParams::WorldMaxY);
int z = CParams::GroundLevel;
Agent(name, x, y, z);
}

Agent::Agent(std::string name, int x, int y, int z)
{
Name = name;
Position = glm::vec3(x, y, z);
Look = glm::vec3(0) - Position;
MoveDirection = glm::vec3(0);
Speed = 0;

CurrentState = new State();
}

Agent::~Agent()
{

}

void Agent::ChangeState(State* newState)
{
assert(CurrentState && newState);

CurrentState->Exit(this);
CurrentState = newState;
CurrentState->Enter(this);
}
50 changes: 50 additions & 0 deletions astria/Agent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef _AGENT_H_
#define _AGENT_H_

#include "Object.h"
#include "Common.h"

enum AGENT_STATE
{
STATE_ROAM,
STATE_FLEE
};

class Agent : public Object
{
public:
Agent();
Agent(std::string name);
Agent(std::string name, int x, int y, int z);
~Agent();

void Move(float direction, float distance);

void ChangeState(State* newState);
void Interact(Object* target);

void Update();

vector<Object*> GetSurrounding(float radius);
vector<Object*> GetSurrounding(int numObj);

// Accessor functions
public:
glm::vec3 GetMoveDirection () const { return MoveDirection; }
glm::vec3 GetLook () const { return Look; }
float GetSpeed () const { return Speed; }
State* GetState () const { return CurrentState; }

private:
std::string Name;

glm::vec3 Look;
glm::vec3 MoveDirection;
float Speed;

State* CurrentState;


};

#endif
14 changes: 14 additions & 0 deletions astria/Common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef _COMMON_H_
#define _COMMON_H_

// Include common headers
#include <SDL/SDL.h>
#include <cassert>
#include <vector>
#include <string>
#include <gl\GL.h>
#include <gl\GLU.h>
#include <glm\glm.hpp>
#include <gl\glew.h>

#endif
Loading

0 comments on commit a630067

Please sign in to comment.