Package com.google.gwt.maeglin89273.game.mengine.physics

Examples of com.google.gwt.maeglin89273.game.mengine.physics.Vector


*/
public abstract class LineBuilder implements LevelBuilder{
  protected static final String P1="p1";
  protected static final String P2="p2";
  public void build(JSONObject creation){
    Point p1;
    Point p2;
    JSONObject point;
    point=creation.get(P1).isObject();
    p1=new Point(point.get(X).isNumber().doubleValue(),
           point.get(Y).isNumber().doubleValue());
    point=creation.get(P2).isObject();
    p2=new Point(point.get(X).isNumber().doubleValue(),
           point.get(Y).isNumber().doubleValue());
    this.buildLine( p1, p2);
  }
View Full Code Here


   * @param w
   * @param h
   * @param block
   */
  public DotKey(Point p, double w, double h,String[] kinds) {
    super(p, w, h,new Point(400+2*SpriteBlock.SPACING,0),DefinersFactory.getDefiners(kinds));
   
  }
 
View Full Code Here

   * @param w
   * @param h
   * @param kinds
   */
  public LineKey(Point p,double w,double h,String[] kinds){
    super(p, w, h, new Point(200+SpriteBlock.SPACING,0),DefinersFactory.getDefiners(kinds));
  }
View Full Code Here

  public static class MagneticLineDefiner extends StaticLineDefiner{

    public MagneticLineDefiner() {
       
      super(ASBOTXConfigs.CreationPowerComsumption.MAGNETIC_LINE,
          new Point(3*ICON_BOUNDS_PLUS_SPACING,ICON_BOUNDS_PLUS_SPACING), null);
     
    }
View Full Code Here

     
    }
    @Override
    public void sketch(Context2d context){
      if(pointA!=null&&pointB!=null){
        Point center=Point.getCenter(pointA, pointB);
        context.setLineWidth(2);
        context.setStrokeStyle(Color.RED);
        context.beginPath();
        context.moveTo(pointA.getX(),pointA.getY());
        context.lineTo(center.getX(),center.getY());
        context.stroke();
       
        context.setStrokeStyle(Color.BLUE);
        context.beginPath();
        context.moveTo(center.getX(),center.getY());
        context.lineTo(pointB.getX(), pointB.getY());
        context.stroke();
      }
    }
View Full Code Here

 
  @Override
  public void onMouseDown(MouseDownEvent event) {
    switch(event.getNativeButton()){
      case NativeEvent.BUTTON_LEFT:
        Point mP=MEngine.getMousePosition();
       
        //return because the next step button is clicked
        if(manager.getButton().onClick(mP)){
          return;
        }
View Full Code Here

   * @param p
   * @param w
   * @param h
   */
  public CreatorPanel(Creator creator,double screenWidth,double screenHeight) {
    super(new Point(screenWidth*3/16,screenHeight-screenWidth*1/16), screenWidth*3/8, screenWidth*1/8);
    double halfH=getHeight()/2;
    double oneThirdW=getWidth()/3;
    this.creator=creator;
    this.keys[AREA_KEY_INDEX]=new AreaKey(new Point(getX()-oneThirdW,getTopY()+halfH),oneThirdW,getHeight(),creator.getLevel().getAreaDefinerKinds());
    this.keys[LINE_KEY_INDEX]=new LineKey(new Point(getX(),getTopY()+halfH),oneThirdW,getHeight(),creator.getLevel().getLineDefinerKinds());
    this.keys[DOT_KEY_INDEX]=new DotKey(new Point(getX()+oneThirdW,getTopY()+halfH),oneThirdW,getHeight(),creator.getLevel().getDotDefinerKinds());
 
  }
View Full Code Here

  }

  @Override
  public void onMouseUp(MouseUpEvent event) {
    if(event.getNativeButton()==NativeEvent.BUTTON_LEFT){
      Point mP=MEngine.getMousePosition();
     
      //notify the pen is up
      //detect step 3
      manager.getDetector().detect(3, creatorPanel.onPenUp(camera.ConvertToWorldPosition(mP)));
      if(!creatorPanel.isAnyKeyPressed()&&grabPos!=null){
        worldLayer.getCamera().move(mP.delta(grabPos), false);
        grabPos=null;
      }
    }
  }
View Full Code Here

   * @see com.google.gwt.maeglin89273.game.mengine.utility.page.Page#update()
   */
  @Override
  public void update() {
    if(grabPos!=null){
      Point mP=MEngine.getMousePosition();
      Vector v=mP.delta(grabPos);
      worldLayer.getCamera().move(v, true);
      grabPos.setPosition(mP);
     
      //detect step 1
      manager.getDetector().detect(1, v);
View Full Code Here

 
  public static class ShinyBallBuilder implements LevelBuilder{

    @Override
    public void build(JSONObject creation) {
      new ShinyBall( new Point(creation.get(X).isNumber().doubleValue(),
                        creation.get(Y).isNumber().doubleValue()));
     
    }
View Full Code Here

TOP

Related Classes of com.google.gwt.maeglin89273.game.mengine.physics.Vector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.