Friday, July 18, 2014

GRVC Design Pattern

My extension to a classic "model-view-controller" design pattern: Example: My tile-map class: G = Geometry Model. (Which tiles are where on the tilemap) R = Render Model. (How should different tiles be rendered?) V = View. (Uses the geometry model and render model to create an internal view on a buffer object) C = Controller. (A basic controller. Maybe better though of as API? It has no UI plugged into it. But has basic commands for editing the tilemap. Maybe should rename it as GRAV (GeomModle,RenderModel,API,View) Sample of the sprite-map I am working on for the level editor:
package JM_LIB.toolSystems.levelEditor.leMap 
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SpriteRecMap_LEM;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapBasicController;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapRenModel;
 import JM_LIB.toolSystems.levelEditor.leMap.components.spriteHandle.SRMapView_LEM;
  * My own design pattern: GRVC:
  * G.R.V.C. - Geom-model.Render-Model.view.Basic-Controller.
  * Contains everything you need to render, edit, and save a sprite map.
  * DOES NOT contain any UI or display object container to display the buffer though!
  * @author JMIM
 public class LeSpriteCore 
  /** A basic controller that handles basic sprite setting API.
   *  Also references the _view, _ren, and _geon so it can re-draw stuff after edits are made to the map with the controller. **/
  private var _ctrl:SRMapBasicController;
  /** A render model that tells us how different sprite recs should be rendered. **/
  private var _ren:SRMapRenModel;
  /** View object that renders our geom **/
  private var _view:SRMapView_LEM;
  /** The sprite map geometry. No render data. Just tells us what is where. **/
  private var _geom:SpriteRecMap_LEM;
  public function LeSpriteCore() 

No comments:

Post a Comment