com.watabou.noosa.Gizmo Java Examples

The following examples show how to use com.watabou.noosa.Gizmo. 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: Toolbar.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	super.update();

	if (lastEnabled != (Dungeon.hero.ready && Dungeon.hero.isAlive())) {
		lastEnabled = (Dungeon.hero.ready && Dungeon.hero.isAlive());

		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}

	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable(true);
	}
}
 
Example #2
Source File: Toolbar.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	super.update();
	
	if (lastEnabled != Dungeon.hero.ready) {
		lastEnabled = Dungeon.hero.ready;
		
		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}
	
	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable( true );
	}
}
 
Example #3
Source File: Toolbar.java    From shattered-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	super.update();
	
	if (lastEnabled != (Dungeon.hero.ready && Dungeon.hero.isAlive())) {
		lastEnabled = (Dungeon.hero.ready && Dungeon.hero.isAlive());
		
		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}
	
	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable(true);
	}
}
 
Example #4
Source File: Toolbar.java    From pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	super.update();
	
	if (lastEnabled != Dungeon.hero.ready) {
		lastEnabled = Dungeon.hero.ready;
		
		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}
	
	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable( true );
	}
}
 
Example #5
Source File: Toolbar.java    From unleashed-pixel-dungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	super.update();
	
	if (lastEnabled != Dungeon.hero.ready) {
		lastEnabled = Dungeon.hero.ready;
		
		for (Gizmo tool : members) {
			if (tool instanceof Tool) {
				((Tool)tool).enable( lastEnabled );
			}
		}
	}
	
	//btnResume.visible = Dungeon.hero.lastAction != null;
	
	if (!Dungeon.hero.isAlive()) {
		btnInventory.enable( true );
	}

	//If we have 2 slots, and 2nd one isn't visible, or we have 1, and 2nd one is visible...
	if ((QuickSlots == 1) == btnQuick2.visible){
		layout();
	}
}
 
Example #6
Source File: PixelScene.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public void saveWindows(){
	savedWindows.clear();
	savedClass = getClass();
	for (Gizmo g : members.toArray(new Gizmo[0])){
		if (g instanceof Window){
			savedWindows.add((Class<? extends Window>) g.getClass());
		}
	}
}
 
Example #7
Source File: Tweener.java    From shattered-pixel-dungeon-gdx with GNU General Public License v3.0 5 votes vote down vote up
public Tweener( Gizmo target, float interval ) {
	super();
	
	this.target = target;
	this.interval = interval;
	
	elapsed = 0;
}
 
Example #8
Source File: Tweener.java    From PD-classes with GNU General Public License v3.0 5 votes vote down vote up
public Tweener( Gizmo target, float interval ) {
	super();
	
	this.target = target;
	this.interval = interval;
	
	elapsed = 0;
}
 
Example #9
Source File: Tweener.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Tweener( Gizmo target, float interval ) {
	super();
	
	this.target = target;
	this.interval = interval;
	
	elapsed = 0;
}
 
Example #10
Source File: VBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void _measure() {
    width = 0;
    height = 0;

    for(Gizmo g :members) {
        if (g instanceof IPlaceable) {
            height += ((IPlaceable) g).height() + gap;
            width = Math.max(width,((IPlaceable) g).width());
        }
    }
}
 
Example #11
Source File: VBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignCenter() {
    float pos = top() + (height() - childsHeight()) / 2;

    for(Gizmo g :members) {
        if (g instanceof IPlaceable) {
            ((IPlaceable) g).setPos(x, pos);
            pos += ((IPlaceable) g).height() + gap;
        }
    }
}
 
Example #12
Source File: VBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignBottom() {
    float pos = bottom();

    for(Gizmo g :members) {
        if (g instanceof IPlaceable) {
            ((IPlaceable) g).setPos(x,pos - ((IPlaceable) g).height() - gap);
            pos -= ((IPlaceable) g).height() + gap;
        }
    }
}
 
Example #13
Source File: VBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignTop() {
    float pos = top();

    for(Gizmo g :members) {
        if (g instanceof IPlaceable) {
            ((IPlaceable) g).setPos(x, pos);
            pos += ((IPlaceable) g).height() + gap;
        }
    }
}
 
Example #14
Source File: BasicBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void remove(Gizmo g) {
    dirty = true;
    super.remove(g);
    if(g instanceof Component) {
        ((Component)g).measure();
    }
}
 
Example #15
Source File: BasicBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Gizmo add(Gizmo g) {
    dirty = true;

    if(g instanceof Component) {
        ((Component)g).measure();
    }

    return super.add(g);
}
 
Example #16
Source File: ScrollableList.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(float x, float y) {
	int size = content.getLength();
	for (int i = 0; i < size; i++) {
		Gizmo item = content.getMember(i);
		if (item instanceof IClickable) {
			if (((IClickable) item).onClick(x, y)) {
				break;
			}
		}
	}
}
 
Example #17
Source File: HBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void _measure() {
    width = 0;
    height = 0;

    for(Gizmo g :members) {
        if (g instanceof Component) {
            width += ((Component) g).width() + gap;
            height = Math.max(height,((Component) g).height());
        }
    }
}
 
Example #18
Source File: HBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignCenter() {

        float pos = x + (maxWidth - childsWidth()) / 2;

        for(Gizmo g :members) {
            if (g instanceof Component) {
                ((Component) g).setPos(pos, yAlign((Component) g));
                pos += ((Component) g).width() + gap;
            }
        }
    }
 
Example #19
Source File: HBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignRight() {
    float pos = x + maxWidth;

    for(Gizmo g :members) {
        if (g instanceof Component) {
            ((Component) g).setPos(pos - ((Component) g).width() - gap, yAlign((Component) g));
            pos -= ((Component) g).width() + gap;
        }
    }
}
 
Example #20
Source File: HBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void alignLeft() {
    float pos = x;

    for(Gizmo g :members) {
        if (g instanceof Component) {
            ((Component) g).setPos(pos, yAlign((Component) g));
            pos += ((Component) g).width() + gap;
        }
    }
}
 
Example #21
Source File: VHBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void putInNextRow(Gizmo g) {
    HBox hBox = new HBox(maxWidth);
    hBox.setAlign(rowsAlign);
    hBox.add(g);
    rows.add(hBox);
    super.add(hBox);
}
 
Example #22
Source File: VHBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void remove(Gizmo g) {
    dirty = true;
    for (HBox row:rows) {
        row.remove(g);
    }
    allMembers.remove(g);
}
 
Example #23
Source File: VHBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Gizmo add(Gizmo g) {
    _add(g);
    allMembers.add(g);

    return g;
}
 
Example #24
Source File: VHBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
private void _add(Gizmo g) {
    dirty = true;
    if(rows.isEmpty()) {
        putInNextRow(g);
    }

    HBox hBox = rows.get(rows.size()-1);
    hBox.add(g);

    if(hBox.width() > maxWidth) {
        hBox.remove(g);
        putInNextRow(g);
    }

}
 
Example #25
Source File: VHBox.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public void reset() {
    removeAll();
    rows.clear();

    for(Gizmo g:allMembers) {
        _add(g);
    }
}
 
Example #26
Source File: PixelScene.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public void saveWindows(){
	savedWindows.clear();
	savedClass = getClass();
	for (Gizmo g : members.toArray(new Gizmo[0])){
		if (g instanceof Window){
			savedWindows.add((Class<? extends Window>) g.getClass());
		}
	}
}
 
Example #27
Source File: Tweener.java    From shattered-pixel-dungeon with GNU General Public License v3.0 5 votes vote down vote up
public Tweener( Gizmo target, float interval ) {
	super();
	
	this.target = target;
	this.interval = interval;
	
	elapsed = 0;
}
 
Example #28
Source File: Tweener.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
public Tweener( Gizmo target, float interval ) {
	super();
	
	this.target = target;
	this.interval = interval;
	
	elapsed = 0;
}
 
Example #29
Source File: JumpTweener.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@LuaInterface
public static void attachTo(CharSprite spr, int targetCell,  float height, float time) {
	JumpTweener tweener = new JumpTweener(spr, spr.worldToCamera(targetCell), height, time);
	spr.getParent().add(tweener);
	tweener.listener = Gizmo::killAndErase;
}
 
Example #30
Source File: PosTweener.java    From remixed-dungeon with GNU General Public License v3.0 4 votes vote down vote up
@LuaInterface
public static void attachTo(Visual visual, float dx, float dy, float time) {
	PosTweener tweener = new PosTweener(visual,dx,dy,time);
	visual.getParent().add(tweener);
	tweener.listener = Gizmo::killAndErase;
}