} /* Draw */ /*********************************************************** * * Method: * Game1 * * Description: * Constructor. * ***********************************************************/ public Game1(model_type m, controller_type c, view_type v) { model = m; ctlr = c; view = v; view.construct(this); } /* Game1 */
static void Main() { model = new model_type(); controller = new controller_type(model); view = new view_type(model); using (Game1 game = new Game1(model, controller, view)) { game.Run(); } } /* Main() */
} /* move_view_location() */ /*********************************************************** * * Method: * check_locks * * Description: * Check for view locks. * ***********************************************************/ public static void check_locks(model_type m) { int_vector2_type position = new int_vector2_type(); position.x = m.level.mario.physics.position.x >> 12; position.y = m.level.mario.physics.position.y >> 12; foreach (Rectangle r in m.level.map.view_locks) { if (r.Contains(position.x, position.y)) { view.X = r.X << 12; view.Y = r.Y << 12; } } } /* check_locks() */
} /* set_view_location() */ /*********************************************************** * * Method: * view_follow_mario * * Description: * Updates the view location to follow mario. * ***********************************************************/ public static void view_follow_mario(model_type m) { level_type level = m.level; if ((view.X + (100 << 12)) < level.mario.physics.position.x) { int mario_x = level.mario.physics.position.x; view.X = mario_x - (100 << 12); } check_locks(m); view_scaled.X = (int)(view.X * scale.X) >> 12; view_scaled.X *= -1; view_scaled.X += left_edge.Width; } /* view_follow_mario() */
/*-------------------------------------------------------------------- * METHODS * --------------------------------------------------------------------*/ /*********************************************************** * * Method: * controller_type * * Description: * Constructor. * ***********************************************************/ public controller_type(model_type m) { model = m; v_idx = 0; } /* controller_type() */
/*-------------------------------------------------------------------- * METHODS * --------------------------------------------------------------------*/ /*********************************************************** * * Method: * view_type * * Description: * Constructor. * ***********************************************************/ public view_type(model_type m) { model = m; } /* view_type() */