• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Nifty类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中de.lessvoid.nifty.Nifty的典型用法代码示例。如果您正苦于以下问题:Java Nifty类的具体用法?Java Nifty怎么用?Java Nifty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Nifty类属于de.lessvoid.nifty包,在下文中一共展示了Nifty类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: NiftyJmeDisplay

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public NiftyJmeDisplay(AssetManager assetManager, 
                       InputManager inputManager,
                       AudioRenderer audioRenderer,
                       ViewPort vp){
    this.assetManager = assetManager;

    w = vp.getCamera().getWidth();
    h = vp.getCamera().getHeight();

    resourceLocation = new ResourceLocationJme();
    ResourceLoader.removeAllResourceLocations();
    ResourceLoader.addResourceLocation(resourceLocation);

    soundDev = new SoundDeviceJme(assetManager, audioRenderer);
    renderDev = new RenderDeviceJme(this);
    inputSys = new InputSystemJme(inputManager);
    if (inputManager != null)
        inputManager.addRawInputListener(inputSys);
    
    nifty = new Nifty(renderDev, soundDev, inputSys, new TimeProvider());
    inputSys.setNifty(nifty);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:NiftyJmeDisplay.java


示例2: bind

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void bind(Nifty nifty, Screen screen) {
    window = screen.findElementByName("wdDemo").getNiftyControl(Window.class);
    rbHand[0] = screen.findElementByName("rbLeftHand").getNiftyControl(RadioButton.class);
    rbHand[1] = screen.findElementByName("rbRightHand").getNiftyControl(RadioButton.class);
    rbHand[2] = screen.findElementByName("rbBothHands").getNiftyControl(RadioButton.class);
    rbHand[3] = screen.findElementByName("rbAnyHand").getNiftyControl(RadioButton.class);
    lbGrasped = screen.findElementByName("lbGrasped").getNiftyControl(Label.class);
    btRelease = screen.findElementByName("btRelease").getNiftyControl(Button.class);
    btDestroy = screen.findElementByName("btDestroy").getNiftyControl(Button.class);
    btPlaneRotL = screen.findElementByName("btPlaneRotL").getNiftyControl(Button.class);
    btPlaneRotR = screen.findElementByName("btPlaneRotR").getNiftyControl(Button.class);
    sbObjRot[0] = screen.findElementByName("sbObjRotX").getNiftyControl(Scrollbar.class);
    sbObjRot[1] = screen.findElementByName("sbObjRotY").getNiftyControl(Scrollbar.class);
    sbObjRot[2] = screen.findElementByName("sbObjRotZ").getNiftyControl(Scrollbar.class);
    lbObjAngles[0] = screen.findElementByName("lbObjAngleX").getNiftyControl(Label.class);
    lbObjAngles[1] = screen.findElementByName("lbObjAngleY").getNiftyControl(Label.class);
    lbObjAngles[2] = screen.findElementByName("lbObjAngleZ").getNiftyControl(Label.class);
    btRecStart = screen.findNiftyControl("btRecStart", Button.class);
    btRecFinish = screen.findNiftyControl("btRecFinish", Button.class);
    btRecUndo = screen.findNiftyControl("btRecUndo", Button.class);
    nifty.subscribeAnnotations(this);
}
 
开发者ID:dwhuang,项目名称:SMILE,代码行数:23,代码来源:DemoWindowController.java


示例3: show

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void show(Nifty nifty, final String message) {
    this.nifty = nifty;

    ScreenBuilder builder;
    if (Constants.android) {
        builder = createAndroid(message);
    } else {
        builder = createDesktop(message);
    }
    Screen scr = builder.build(nifty);

    textField = scr.findNiftyControl("textField", TextField.class);

    nifty.addScreen(SCREEN_ID, scr);
    nifty.gotoScreen(SCREEN_ID);
}
 
开发者ID:matthewseal,项目名称:MoleculeViewer,代码行数:17,代码来源:TextinputDialog.java


示例4: WindowAccount

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public WindowAccount(int id, Nifty nifty, GenericSendTask accountTask) throws JSONException {
    this.id = id;
    this.nifty = nifty;

    this.scheduler = Executors.newScheduledThreadPool(1);

    this.accountController = new AccountController();
    this.accountController.addObserver(accountTask);
    accountTask.addObserver(this.accountController);

    this.animatorOverlay = new AnimatorOverlayData();
    InputData inputData = new InputData("configInput.json");
    this.accountOverlay = new AccountOverlay(inputData);
    accountTask.addObserver(this.accountOverlay);
    this.accountOverlay.addObserver(accountTask);
    ConsoleWriter.debug("end constructor Interface");
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:18,代码来源:WindowAccount.java


示例5: WindowGame

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public WindowGame(int id, Nifty nifty, GenericSendTask inputTask, GenericSendTask gameTask) throws JSONException, SlickException {
    this.id = id;
    this.nifty = nifty;

    InputData inputData = new InputData("configInput.json");
    this.input = new InputGame(inputData);
    this.input.addObserver(inputTask);

    this.gameController = new GameController();
    this.animatorGameData = new AnimatorGameData();
    this.animatorOverlayData = new AnimatorOverlayData();
    this.gameOverlay = new GameOverlay(inputData);


    gameTask.addObserver(this.gameController);
    this.gameController.addObserver(gameTask);
    gameTask.addObserver(this.gameOverlay);
    this.gameOverlay.addObserver(gameTask);
}
 
开发者ID:LeNiglo,项目名称:TinyTank,代码行数:20,代码来源:WindowGame.java


示例6: bind

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
    super.bind(nifty, screen);
    // login
    tfEmail = (TextField) nifty.getScreen("start").
            findNiftyControl("tfEmail", TextField.class);
    tfPassword = (TextField) nifty.getScreen("start").
            findNiftyControl("tfPassword", TextField.class);
    lbCheck = (Label) nifty.getScreen("start").
            findNiftyControl("lbCheck", Label.class);
    // register
    tfRegName = (TextField) nifty.getScreen("start").
            findNiftyControl("tfRegName", TextField.class);
    tfRegEmail = (TextField) nifty.getScreen("start").
            findNiftyControl("tfRegEmail", TextField.class);
    tfRegPassword = (TextField) nifty.getScreen("start").
            findNiftyControl("tfRegPassword", TextField.class);
    tfRegPassword2 = (TextField) nifty.getScreen("start").
            findNiftyControl("tfRegPassword2", TextField.class);
    lbRegCheck = (Label) nifty.getScreen("start").
            findNiftyControl("lbRegCheck", Label.class);
}
 
开发者ID:duodecimo,项目名称:magicallyous,代码行数:23,代码来源:MagicallyousScreenController.java


示例7: initialize

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void initialize(AppStateManager stateManager, Application app) {
	super.initialize(stateManager, app);
	app.getViewPort().attachScene(rootNode);
       
       niftyDisplay = new NiftyJmeDisplay(app.getAssetManager(), app.getInputManager(), app.getAudioRenderer(), app.getGuiViewPort());
       Nifty nifty = niftyDisplay.getNifty();
       
       stateManager.attach(LoginScreen.getSingleton());
       nifty.fromXml("Interface/Nifty/Main.xml", "screenLogin", LoginScreen.getSingleton(), CharsScreen.getSingleton(), WorldScreen.getSingleton());
	
       Logger.getLogger("de.lessvoid.nifty").setLevel(Level.SEVERE);
       Logger.getLogger("NiftyInputEventHandlingLog").setLevel(Level.SEVERE);
       app.getGuiViewPort().addProcessor(niftyDisplay);
	this.app = app;
	rootNode.setCullHint(CullHint.Dynamic);
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:18,代码来源:RootNodeState.java


示例8: checkCompletion

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void checkCompletion() {

        if (isCompleted()) {
            NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(
                    assetManager, inputManager, Main.getApp().getAudioRenderer(), Main.getApp().getGuiViewPort());
            /**
             * Create a new NiftyGUI object
             */
            Nifty nifty = niftyDisplay.getNifty();
            /**
             * Read your XML and initialize your custom ScreenController
             */
            nifty.fromXml("Interface/gameWon.xml", "start");
            // nifty.fromXml("Interface/helloworld.xml", "start", new MySettingsScreen(data));
            // attach the Nifty display to the gui view port as a processor
            Main.getApp().getGuiViewPort().addProcessor(niftyDisplay);
// disable the fly cam
            Main.getApp().getFlyByCamera().setDragToRotate(true);

        }

    }
 
开发者ID:kemonoske,项目名称:ArcaneMining,代码行数:23,代码来源:SealField.java


示例9: activate

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
/**Called when activating the effect
 * @param nifty - the main nifty calling class
 * @param element - the element triggering the effect
 * @param parameter - the parameters passed in for the effect 
 *  **/
@Override
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
	super.activate(nifty, element, parameter);
	if (parameter.getProperty("startColor") != null) {
		start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
	}
	if (parameter.getProperty("endColor") != null) {
		end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
	}
	if (parameter.getProperty("start") != null) {
		start = new Alpha(parameter.getProperty("start"));
	}
	if (parameter.getProperty("end") != null) {
		end = new Alpha(parameter.getProperty("end"));
	}
	interpolator = parameter.getInterpolator();
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:23,代码来源:OrbFadeChange.java


示例10: bind

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
	this.nifty = nifty;
	this.screen = screen;

	turnText = screen.findElementById("turnText");
	playerName = screen.findElementById("playerName");

	moneyBar = screen.findNiftyControl("moneyBar", Loadingbar.class);
	energyBar = screen.findNiftyControl("energyBar", Loadingbar.class);
	populationBar = screen.findNiftyControl("populationBar", Loadingbar.class);

	unitBox = screen.findElementById("unitBox");

	addImages();

	Globals.setHUDController(this);
}
 
开发者ID:oberien,项目名称:Oberien,代码行数:19,代码来源:HUDScreenController.java


示例11: createNewGui

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
/**
 * Create a new empty gui with one screen and set as the current gui.
 * @param nifty a valid Nifty instace @see Nifty
 * @throws ParserConfigurationException if controller failed to create
 * a valid document instance
 */
public void createNewGui(Nifty nifty) throws ParserConfigurationException, JAXBException, ClassNotFoundException, IOException, NoProductException{
    gui= GUIFactory.getInstance().createGUI(nifty);
    GScreen screen = (GScreen) GUIFactory.getInstance().newGElement(GScreen.class);
    GLayer layer1 = (GLayer) GUIFactory.getInstance().newGElement(GLayer.class);
    screen.addChild(layer1, true);
    getGui().addScreen(screen);
    this.currentS = screen;
    this.currentL = layer1;
    this.currentlayers.clear();
    this.currentlayers.add(layer1);
    GUseControls standardControls = new GUseControls();
    GUseStyle standardStyle = new GUseStyle();
    standardControls.setFilename("nifty-default-controls.xml");
    standardStyle.setFilename("nifty-default-styles.xml");
    this.gui.addUseControls(standardControls);
    this.gui.addUseStyles(standardStyle);
    this.model.setCurentGUI(gui);
    this.setChanged();
    this.notifyObservers(new ReloadGuiEvent(gui));
    this.clearChanged();
    writer = new GUIWriter(gui);
    dragDropManager = new NiftyDDManager(nifty);
    System.gc();
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:31,代码来源:GUIEditor.java


示例12: refresh

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void refresh() {
    Nifty temp = nElement.getNifty();
    Attributes att = this.nElement.getElementType().getAttributes();
    String newStyle = att.get("style");
    Attributes attcopy = new Attributes(att);
    // Add the old style if there was one
    if (oldStyle != null && !oldStyle.equals(newStyle)) {

        att.set("style", oldStyle);
        nElement.setStyle(newStyle);
        attcopy = att;
        oldStyle = newStyle;
    }
    if (att.isSet("renderOrder")) {
        int renderorder = att.get("renderOrder").isEmpty() ? this.parent.children.indexOf(this) : att.getAsInteger("renderOrder");
        nElement.setRenderOrder(renderorder);
    }
    nElement.setId(id);
    this.internalRefresh(temp, attcopy);
    this.processRemoved();
    fireUpdate();
}
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:23,代码来源:GElement.java


示例13: activate

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
/**Called when activating the effect
 * @param nifty - the main nifty calling class
 * @param element - the element triggering the effect
 * @param parameter - the parameters passed in for the effect 
 *  **/
public void activate(final Nifty nifty, final Element element, final EffectProperties parameter) {
	this.el = element;
	if (parameter.getProperty("startColor") != null) {
		start = new Alpha(new Color(parameter.getProperty("startColor", "#000000ff")).getAlpha());
	}
	if (parameter.getProperty("endColor") != null) {
		end = new Alpha(new Color(parameter.getProperty("endColor", "#ffffffff")).getAlpha());
	}
	if (parameter.getProperty("start") != null) {
		start = new Alpha(parameter.getProperty("start"));
	}
	if (parameter.getProperty("end") != null) {
		end = new Alpha(parameter.getProperty("end"));
	}
	interpolator = parameter.getInterpolator();
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:23,代码来源:FadeEraseText.java


示例14: init

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public void init() {
       InputSystemAwtImpl inputSystem = new InputSystemAwtImpl();
       FontProviderJava2dImpl fontProvider = new FontProviderJava2dImpl();
registerFonts(fontProvider);
       RenderDeviceJava2dImpl renderDevice = new RenderDeviceJava2dImpl(graphWrap);
renderDevice.setFontProvider(fontProvider);
nifty = new Nifty(renderDevice,  new SoudDevicenull(), inputSystem,new TimeProvider());
      
       java.net.URL empty = getClass().getResource("/jada/ngeditor/resources/empty.xml");
       try {
           nifty.fromXml(empty.getFile(),empty.openStream(), "screen1");
       } catch (IOException ex) {
           Logger.getLogger(J2DNiftyView.class.getName()).log(Level.SEVERE, null, ex);
       }
       this.dragDropManager = new NiftyDDManager(nifty);
       timer = new Timer(30,this); 
       timer.start();
       this.setIgnoreRepaint(true);
       nifty.resolutionChanged();
   }
 
开发者ID:relu91,项目名称:niftyeditor,代码行数:21,代码来源:J2DNiftyView.java


示例15: setNifty

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
void setNifty(final Nifty nifty) {
    this.nifty = nifty;

    if (Globals.replayMode) {
        return;
    }

    DeathMatchHeroSelectionLayerBuilder layerBuilder
            = new DeathMatchHeroSelectionLayerBuilder();

    Screen screen = nifty.getScreen("default_hud");

    heroSelectionLayer = layerBuilder
            .build(nifty, screen, screen.getRootElement());
    heroSelectionLayer.hideWithoutEffect();

    DeathMatchHeroSelectionLayerController control = heroSelectionLayer
            .getControl(DeathMatchHeroSelectionLayerController.class);
    control.setStateManager(states);
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:21,代码来源:DeathmatchCommon.java


示例16: bind

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen, Element element, Properties parameter,
                 Attributes controlDefinitionAttributes)
{
        assert this.element == null;
        this.element = element;
        this.nifty = nifty;
        
        ElementRenderer[] renders = element.getElementRenderer();
        for (int i = 0; i < renders.length; ++i)
        {
                if (renders[i] instanceof PanelRenderer)
                {
                        renders[i] = new CameraRenderer();
                }
        }
}
 
开发者ID:Periapsis,项目名称:aphelion,代码行数:18,代码来源:CameraNiftyController.java


示例17: NiftyJmeDisplay

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public NiftyJmeDisplay(AssetManager assetManager, 
                       InputManager inputManager,
                       AudioRenderer audioRenderer,
                       ViewPort vp){
    this.assetManager = assetManager;

    w = vp.getCamera().getWidth();
    h = vp.getCamera().getHeight();

    soundDev = new SoundDeviceJme(assetManager, audioRenderer);
    renderDev = new RenderDeviceJme(this);
    inputSys = new InputSystemJme(inputManager);
    if (inputManager != null)
        inputManager.addRawInputListener(inputSys);
    
    nifty = new Nifty(renderDev, soundDev, inputSys, new FastTimeProvider());
    inputSys.setNifty(nifty);

    resourceLocation = new ResourceLocationJme();
    nifty.getResourceLoader().removeAllResourceLocations();
    nifty.getResourceLoader().addResourceLocation(resourceLocation);
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:23,代码来源:NiftyJmeDisplay.java


示例18: init

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
public static void init(){
			
	
	LwjglInputSystem inputSystem = new LwjglInputSystem();
	
	try {
		inputSystem.startup();
	} catch (Exception e) {
		e.printStackTrace();
	}
	
	nifty = new Nifty(
			new LwjglRenderDevice(),
			new NullSoundDevice(),
			inputSystem,
			new AccurateTimeProvider());
		
	drawGameScreen();
	
	
	itemImages.put(ItemListEnum.LASERRIFLE,
				   nifty.createImage("assets/textures/laserRifle.png",
						   			 true));
	
	nifty.gotoScreen("gui");
}
 
开发者ID:Mathgoat,项目名称:square-loot,代码行数:27,代码来源:HUD.java


示例19: createItem

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
/**Creates a GUI item based on the item's details, and binds it to the parent element
 * given. Adds 'hoverstats' panel. The bound element is a Draggable with panel and 
 * image sub-elements.
 * 
 * @param parent - Element to bind to
 * @param item - Item to represent
 * @param nifty - Main nifty class
 */
public static void createItem (Element parent, Item item, Nifty nifty){
	
	//Set up draggable as panel to hold item
	DraggableBuilder drag = new DraggableBuilder("ItemVal"+item.getId());
	drag.childLayoutCenter();
	drag.width(parent.getWidth()+"");
	drag.height(parent.getHeight()+"");
	drag.visibleToMouse(true);
	
	//Set image for item
	ImageBuilder itemImage = new ImageBuilder();
	itemImage.filename("Interface/"+imageMap.get(item.getType()));
	itemImage.width(""+(int)(parent.getWidth()*1.1));
	itemImage.height(""+(int)(parent.getHeight()*1.1));
	itemImage.childLayoutVertical();
	drag.image(itemImage);
	
	addHoverPanel(drag,item,nifty);
	
	drag.build(nifty,nifty.getScreen("hud"), parent);
	drag.renderOrder(1000);
}
 
开发者ID:GSam,项目名称:Game-Project,代码行数:31,代码来源:InventoryItemFactory.java


示例20: bind

import de.lessvoid.nifty.Nifty; //导入依赖的package包/类
@Override
public void bind(
        @Nonnull final Nifty niftyParam,
        @Nonnull final Screen screenParam,
        @Nonnull final Element newElement,
        @Nonnull final Parameters parameter) {
    super.bind(newElement);
    nifty = niftyParam;

    final Element text = newElement.findElementById("#text");
    if (text == null) {
        log.severe("ProgressBar element misses the text content element.");
        return;
    }
    buttonTextElement = text;

    if (newElement.getId() == null) {
        log.warning("ProgressBar element has no ID and can't publish any events properly.");
    }

    final TextRenderer renderer = buttonTextElement.getRenderer(TextRenderer.class);
    if (renderer == null) {
        throw new RuntimeException("ProgressBarControl is corrupted, #text element found, but missing TextRenderer");
    }
    buttonTextRenderer = renderer;

    final Element indicator = newElement.findElementById("#indicator");
    if(indicator == null) {
        log.severe("ProgressBar element misses the progress content element.");
        return;
    }
    progressIndicatorElement = indicator;
}
 
开发者ID:SkidRunner,项目名称:jME3-Examples,代码行数:34,代码来源:ProgressBarControl.java



注:本文中的de.lessvoid.nifty.Nifty类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IClosableIterator类代码示例发布时间:2022-05-21
下一篇:
Java EditorNotificationPanel类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap