Java Code Examples for com.watabou.noosa.Image#copy()

The following examples show how to use com.watabou.noosa.Image#copy() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QuickSlotButton.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	slot = new ItemSlot() {
		@Override
		protected void onClick() {
			if (targeting && Dungeon.hero.lastTarget != null) {
				GameScene.handleCell( Dungeon.hero.lastTarget.pos );
			} else {
				Item item = select(slotNum);
				if (item.usesTargeting)
					useTargeting();
				item.execute( Dungeon.hero );
			}
		}
		@Override
		protected boolean onLongClick() {
			return QuickSlotButton.this.onLongClick();
		}
		@Override
		protected void onTouchDown() {
			icon.lightness( 0.7f );
		}
		@Override
		protected void onTouchUp() {
			icon.resetColor();
		}
	};
	slot.showParams( true, false, true );
	add( slot );
	
	crossB = Icons.TARGET.get();
	crossB.visible = false;
	add(crossB);
	
	crossM = new Image();
	crossM.copy( crossB );
}
 
Example 2
Source File: QuickSlot.java    From pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	slot = new ItemSlot() {
		@Override
		protected void onClick() {
			if (targeting) {
				GameScene.handleCell( lastTarget.pos );
			} else {
				useTargeting();
				select().execute( Dungeon.hero );
			}
		}
		@Override
		protected boolean onLongClick() {
			return QuickSlot.this.onLongClick();
		}
		@Override
		protected void onTouchDown() {
			icon.lightness( 0.7f );
		}
		@Override
		protected void onTouchUp() {
			icon.resetColor();
		}
	};
	add( slot );
	
	crossB = Icons.TARGET.get();
	crossB.visible = false;
	add( crossB );
	
	crossM = new Image();
	crossM.copy( crossB );
}
 
Example 3
Source File: QuickSlot.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
	protected void createChildren() {
		super.createChildren();
		
		slot = new ItemSlot() {
			@Override
			protected void onClick() {
				if (targeting) {
					GameScene.handleCell( currentTarget.pos );
				} else {
					Item item = select();

                    cancel();

//					if (item == lastItem) {
//						useTargeting();
//					} else {
//						lastItem = item;
//					}
                    if ( item != null ) {
                        item.execute( Dungeon.hero, QuickSlot.this == quickslot0 && item.equipAction() != null ? item.equipAction() : item.quickAction() );

                        if( !GameScene.checkListener() ) {
                            useTargeting();
                        }
                    }
				}
			}
			@Override
			protected boolean onLongClick() {
				return QuickSlot.this.onLongClick();
			}
			@Override
			protected void onTouchDown() {
				icon.lightness( 0.7f );
			}
			@Override
			protected void onTouchUp() {
				icon.resetColorAlpha();
			}
		};

        slot.setScale(0.8f);

		add( slot );
		
		crossB = Icons.TARGET.get();
		crossB.visible = false;
		add(crossB);

		crossM = new Image();
		crossM.copy(crossB);
	}
 
Example 4
Source File: QuickSlotButton.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();
	
	slot = new ItemSlot() {
		@Override
		protected void onClick() {
			if (targeting) {
				int cell = autoAim(lastTarget, select(slotNum));

				if (cell != -1){
					GameScene.handleCell(cell);
				} else {
					//couldn't auto-aim, just target the position and hope for the best.
					GameScene.handleCell( lastTarget.pos );
				}
			} else {
				Item item = select(slotNum);
				if (item.usesTargeting)
					useTargeting();
				item.execute( Dungeon.hero );
			}
		}
		
		@Override
		public GameAction keyAction() {
			return QuickSlotButton.this.keyAction();
		}
		@Override
		protected boolean onLongClick() {
			return QuickSlotButton.this.onLongClick();
		}
		@Override
		protected void onPointerDown() {
			sprite.lightness( 0.7f );
		}
		@Override
		protected void onPointerUp() {
			sprite.resetColor();
		}
	};
	slot.showExtraInfo( false );
	add( slot );
	
	crossB = Icons.TARGET.get();
	crossB.visible = false;
	add( crossB );
	
	crossM = new Image();
	crossM.copy( crossB );
}
 
Example 5
Source File: QuickSlot.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {
    super.createChildren();

    slot = new ItemSlot() {
        @Override
        protected void onClick() {

            if (objectForSlot != null) {
                updateSlotBySelection();
                return;
            }

            if (targeting && lastTarget != null) {
                GameScene.handleCell(lastTarget.getPos());
            } else {
                if (quickslotItem == lastItem) {
                    useTargeting();
                } else {
                    lastItem = quickslotItem;
                }
                if (quickslotItem != null) {

                    if (!Dungeon.hero.isAlive()) {
                        return;
                    }

                    quickslotItem.execute(Dungeon.hero);
                }
            }
        }

        @Override
        protected boolean onLongClick() {
            return QuickSlot.this.onLongClick();
        }

        @Override
        protected void onTouchDown() {
            icon.lightness(0.7f);
        }

        @Override
        protected void onTouchUp() {
            icon.resetColor();
        }
    };
    slot.setInQuickSlot(true);
    add(slot);

    crossB = Icons.TARGET.get();
    crossB.setVisible(false);
    add(crossB);

    crossM = new Image();
    crossM.copy(crossB);
}
 
Example 6
Source File: QuickSlotButton.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void createChildren() {
	super.createChildren();

	slot = new ItemSlot() {
		@Override
		protected void onClick() {

			if (!Dungeon.hero.isAlive())
				return;

			if (NoosaInputProcessor.modifier) {
				onLongClick();
				return;
			}

			if (targeting) {
				int cell = autoAim(lastTarget, select(slotNum));

				if (cell != -1){
					GameScene.handleCell(cell);
				} else {
					//couldn't auto-aim, just target the position and hope for the best.
					GameScene.handleCell( lastTarget.pos );
				}
			} else {
				Item item = select(slotNum);
				if (item.usesTargeting)
					useTargeting();
				item.execute( Dungeon.hero );
			}
		}
		@Override
		protected boolean onLongClick() {
			return QuickSlotButton.this.onLongClick();
		}
		@Override
		protected void onTouchDown() {
			icon.lightness( 0.7f );
		}
		@Override
		protected void onTouchUp() {
			icon.resetColor();
		}
	};
	slot.showParams( true, false, true );
	add( slot );

	crossB = Icons.TARGET.get();
	crossB.visible = false;
	add( crossB );

	crossM = new Image();
	crossM.copy( crossB );
}