/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * AndroidWorld Library, Copyright 2011 Bryan Chadwick * * * * FILE: ./android/world/test/MousePoints.java * * * * This file is part of AndroidWorld. * * * * AndroidWorld is free software: you can redistribute it and/or * * modify it under the terms of the GNU General Public License * * as published by the Free Software Foundation, either version * * 3 of the License, or (at your option) any later version. * * * * AndroidWorld is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with AndroidWorld. If not, see <http://www.gnu.org/licenses/>. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ package android.world.test; import android.app.Activity; import android.os.Bundle; import android.view.Display; import android.image.*; import android.world.World; public class MousePoints extends Activity{ // Called when the activity is first created. public void onCreate(Bundle savedState) { super.onCreate(savedState); Display dis = getWindowManager().getDefaultDisplay(); // Create and start the World new MousePointsWorld(new EmptyScene(dis.getWidth(), dis.getHeight()-50)) .bigBang(this); } } class MousePointsWorld extends World{ Scene scene; MousePointsWorld(Scene scene){ this.scene = scene; } public Scene onDraw(){ return this.scene; } public World onMouse(int x, int y, String me){ if(!me.equals("button-down")){ return this; }else{ return new MousePointsWorld( this.scene.placeImage(new Circle(20, "solid", "red") .overlay(new Circle(20, "outline", "black")), x, y)); } } }