@Override protected void onTouchUp( NoosaInputProcessor.Touch touch ) { if (dragging) { dragging = false; thumb.am = THUMB_ALPHA; } else { PointF p = content.camera.screenToCamera( (int)touch.current.x, (int)touch.current.y ); ScrollPane.this.onClick( p.x, p.y ); } }
@Override protected void onTouchUp( Touch touch ) { if (dragging) { dragging = false; thumb.am = THUMB_ALPHA; } else { PointF p = content.camera.screenToCamera( (int)touch.current.x, (int)touch.current.y ); ScrollPane.this.onClick( p.x, p.y ); } }
@Override protected void onClick( Touch touch ) { if (dragging) { dragging = false; indicator.am = INDICATOR_ALPHA; } else { PointF p = content.camera.screenToCamera( (int)touch.current.x, (int)touch.current.y ); ScrollPane.this.onClick( p.x, p.y ); } }
public boolean overlapsScreenPoint( int x, int y ) { Camera c = camera(); if (c == null) return false; PointF p = c.screenToCamera( x, y ); return overlapsPoint( p.x, p.y ); }
public boolean overlapsScreenPoint( int x, int y ) { Camera c = camera(); if (c != null) { PointF p = c.screenToCamera( x, y ); return overlapsPoint( p.x, p.y ); } else { return false; } }
public boolean overlapsScreenPoint( int x, int y ) { Camera c = camera(); if (c == null) return false; PointF p = c.screenToCamera( x, y ); return overlapsPoint( p.x, p.y ); }
@Override protected void onDrag(NoosaInputProcessor.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); } }
@Override protected void onDrag(Touchscreen.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); } }
@Override protected void onTouchDown(Touchscreen.Touch touch) { pressed = true; PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x-2, p.x, sliderBG.x+sliderBG.width()-2); sliderNode.brightness(1.5f); }
@Override protected void onTouchUp(Touchscreen.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); sliderNode.resetColor(); //sets the selected value selectedVal = minVal + Math.round(sliderNode.x / tickDist); sliderNode.x = (int) (x + tickDist * (selectedVal - minVal)); onChange(); pressed = false; } } };
@Override protected void onTouchDown(NoosaInputProcessor.Touch touch) { pressed = true; PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x-2, p.x, sliderBG.x+sliderBG.width()-2); sliderNode.brightness(1.5f); }
@Override protected void onTouchUp(NoosaInputProcessor.Touch touch) { if (pressed) { PointF p = camera().screenToCamera((int) touch.current.x, (int) touch.current.y); sliderNode.x = GameMath.gate(sliderBG.x - 2, p.x, sliderBG.x + sliderBG.width() - 2); sliderNode.resetColor(); //sets the selected value selectedVal = minVal + Math.round(sliderNode.x / tickDist); sliderNode.x = (int) (x + tickDist * (selectedVal - minVal)); onChange(); pressed = false; } } };
public int screenToTile( int x, int y ) { Point p = camera().screenToCamera( x, y ). offset( this.point().negate() ). invScale( SIZE ). floor(); return p.x >= 0 && p.x < Level.WIDTH && p.y >= 0 && p.y < Level.HEIGHT ? p.x + p.y * Level.WIDTH : -1; }
@Override protected void onClick( Touch touch ) { if (dragging) { dragging = false; } else { PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y ); for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])){ if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){ select( mob.pos ); return; } } for (Heap heap : Dungeon.level.heaps.values()){ if (heap.sprite != null && heap.sprite.overlapsPoint( p.x, p.y)){ select( heap.pos ); return; } } select( ((DungeonTilemap)target).screenToTile( (int)touch.current.x, (int)touch.current.y, true ) ); } }
public void reset( Item item, int cell, float endX, float endY ) { view( item ); active = visible = true; PointF tile = DungeonTerrainTilemap.raisedTileCenterToWorld(cell); Point screen = Camera.main.cameraToScreen(tile.x, tile.y); PointF start = camera().screenToCamera(screen.x, screen.y); x = this.startX = start.x - ItemSprite.SIZE / 2; y = this.startY = start.y - ItemSprite.SIZE / 2; this.endX = endX - ItemSprite.SIZE / 2; this.endY = endY - ItemSprite.SIZE / 2; left = DURATION; scale.set( startScale = Camera.main.zoom / camera().zoom ); }
@Override protected void onClick( NoosaInputProcessor.Touch touch ) { if (dragging) { dragging = false; } else { PointF p = Camera.main.screenToCamera( (int)touch.current.x, (int)touch.current.y ); for (Char mob : Dungeon.level.mobs.toArray(new Mob[0])){ if (mob.sprite != null && mob.sprite.overlapsPoint( p.x, p.y)){ select( mob.pos ); return; } } for (Heap heap : Dungeon.level.heaps.values()){ if (heap.sprite != null && heap.sprite.overlapsPoint( p.x, p.y)){ select( heap.pos ); return; } } select( ((DungeonTilemap)target).screenToTile( (int)touch.current.x, (int)touch.current.y, true ) ); } }
public void reset( Item item, int cell, float endX, float endY ) { view( item ); active = visible = true; PointF tile = DungeonTerrainTilemap.raisedTileCenterToWorld(cell); Point screen = Camera.main.cameraToScreen(tile.x, tile.y); PointF start = camera().screenToCamera(screen.x, screen.y); x = this.startX = start.x - ItemSprite.SIZE / 2; y = this.startY = start.y - ItemSprite.SIZE / 2; this.endX = endX - ItemSprite.SIZE / 2; this.endY = endY - ItemSprite.SIZE / 2; left = DURATION; scale.set( startScale = Camera.main.zoom / camera().zoom ); }
public int screenToTile(int x, int y, boolean wallAssist ) { PointF p = camera().screenToCamera( x, y ). offset( this.point().negate() ). invScale( SIZE ); //snap to the edges of the tilemap p.x = GameMath.gate(0, p.x, Dungeon.level.width()-0.001f); p.y = GameMath.gate(0, p.y, Dungeon.level.height()-0.001f); int cell = (int)p.x + (int)p.y * Dungeon.level.width(); if (wallAssist && map != null && DungeonTileSheet.wallStitcheable(map[cell])){ if (cell + mapWidth < size && p.y % 1 >= 0.75f && !DungeonTileSheet.wallStitcheable(map[cell + mapWidth])){ cell += mapWidth; } } return cell; }
public int screenToTile(int x, int y, boolean wallAssist ) { PointF p = camera().screenToCamera( x, y ). offset( this.point().negate() ). invScale( SIZE ); //snap to the edges of the tilemap p.x = GameMath.gate(0, p.x, Dungeon.level.width()-0.001f); p.y = GameMath.gate(0, p.y, Dungeon.level.height()-0.001f); int cell = (int)p.x + (int)p.y * Dungeon.level.width(); if (wallAssist && map != null && DungeonTileSheet.wallStitcheable(map[cell])){ if (cell + mapWidth < size && p.y % 1 >= 0.75f && !DungeonTileSheet.wallStitcheable(map[cell + mapWidth])){ cell += mapWidth; } } return cell; }