|
In order of no progress to done:
Red,
Orange,
Yellow,
Blue,
Light blue,
Green,
Light green.
Last updated 2/12/09 at 12:01 am PST
Cripes! 2.0 -- See the Class Layout
Arenamatic Code w/ cConsole  |  Twisol
Member since: 9/11/2005 From: Los Angeles |
Posted - 2/8/2009 7:04:55 PM | Last updated: 4:49pm on February 17th, 2009
It occured to me while I was writing my last post that even though I might know what these classes do, if I just toss the names out there carelessly the post might take a little work to decipher. So, for my reference and others', here's a class layout for Cripes 2.0 as of now. I'm going to update this post when I add new classes, so don't count on this post staying the same.
Heirarchy:
Game
-Keyboard
-World
--Map
--EntityMap
-EntityFactory
"Independent" classes (granular classes possibly used in multiple places)
Entity
MazeGen
Class: Game
Purpose: This is where my game loop is. I'm not actually sure what Game's exact purpose is. I just think of it as a pseudo-main()-plus-globals thing. This is because my main.cpp is just a main() with a constructed Game and a call to Game::Run(). It remains to be seen whether that's a good idea. (I like to think it is)
Class: World
Purpose: Patches together the components of the visual world, including the world map and its entities. Can be Draw()n, which gathers the clips of the components and copies them together, drawing to a given console buffer (or STD_OUTPUT_HANDLE if none is supplied).
Class: Keyboard
Purpose: Maintains an internal state map of the keys on a keyboard. Its Update() function should be called once per frame. Every key has four possible states, numbered 0 to 3: inactive, down, held, and releasing. When a key is hit, it enters the down state on the next Update(). If it's still down during the next Update(), it's promoted to held. If a key is down when it's released, it's moved to releasing, then inactive. This is to give the program a chance to handle the key before it's released, as it only goes into releasing if it was tapped and released within the same frame/update. If a key is held when it's released, it's moved directly to inactive.
Class: Map
Purpose: Constructs and maintains a CHAR_INFO buffer representing the game map. It can be Clip()ped, trimming the viewing clip given a viewport width and height and returning the result. Some fun cartesian/geometric math here which 'sews' the opposite edges of the map together.
Class: EntityMap
Purpose: Keeps track of an Entity list, and can create a Clip() just like the Map can. There's some -really- fun code involved in the clipping. Yes, maybe even more fun than the Map code! *shudder*
Class: Entity
Purpose: Contains a vector of CHAR_INFO sprites (all of the same dimensions) that can be used as frames for animated sprites. Also has coordinate variables which the EntityMap uses to determine where the entity is on the map.
Class: EntityFactory
Purpose: Factory class that can load Entity definitions from a file and store them in a std::map with string identifier keys. If there's a Player defined in the file, calling ConstructEntity("Player") returns an instance of an Entity with the defined Player frames and size.
Class: MazeGen
Purpose: Constructed with an EntityFactory pointer, it Generate()s a vector of wall Entities given a maze width/height (in cells, not pixels). See this page for the algorithm I use to generate a maze.
| |
|
| S | M | T | W | T | F | S | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | |
OPTIONS
Track this Journal
ARCHIVES
August, 2009
July, 2009
March, 2009
February, 2009
December, 2008
November, 2008
October, 2008
August, 2008
July, 2008
June, 2008
May, 2008
April, 2008
November, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
December, 2006
October, 2006
September, 2006
July, 2006
May, 2006
April, 2006
|