mardi 7 avril 2015

Creating shapes with Nifty GUI and LWJGL


Vote count:

0




I am trying to create a hexagon on the screen in my LWJGL game. I am using Nifty GUI. I currently have 2 screens, and I want to switch to a screen where I programmatically draw hexagons.


Here is my xml for the screen



<?xml version="1.0" encoding="UTF-8"?>

<nifty xmlns="http://ift.tt/1O3QX9b" xmlns:xsi="http://ift.tt/ra1lAU" xsi:schemaLocation="http://ift.tt/1O3QX9b http://ift.tt/1O3QX9b">
<useStyles filename="nifty-default-styles.xml" />
<useControls filename="nifty-default-controls.xml" />
<screen id="start" controller="StartScreen">
<layer id="background" childLayout="center">
<image filename="util/img/menuTexture.png" />
</layer>
<layer id="title" childLayout="vertical">
<image align="center" height="20%" width="80%" filename="util/img/title.png" />
<panel id="subactions" childLayout="absolute" marginTop="40%" height="13%">
<image align="left" height="100%" width="30%" x="0px" y="0px" filename="util/img/rules.png">
<interact onClick="showRules()" />
</image>
<image align="right" height="100%" width="30%" x="70%" y="0px" filename="util/img/exit.png">
<interact onClick="exitGame()" />
</image>
</panel>
<image align="center" height="20%" width="80%" filename="util/img/start game.png" marginTop="5%">
<interact onClick="startGame()" />
</image>
</layer>
</screen>
<screen id="rules" controller="StartScreen">
<layer id="background" childLayout="center">
<image filename="util/img/menuTexture.png" />
</layer>
<layer id="transparent" backgroundColor="#D1D1D1A7" childLayout="vertical">
<panel id="rulesPanel" childLayout="center">
<image filename="util/img/game rules.png" width="100%" height="100%" />
</panel>
<panel id="goToStartPanel" childLayout="center" width="100%" height="13%">
<image height="100%" filename="util/img/exit.png">
<interact onClick="goToStartScreen()" />
</image>
</panel>
</layer>
</screen>


How do I switch to such a screen (would I use nifty.gotoScreen() ?) and initialize the render loop?


Any example code would be helpful. Thank you very much.



asked 56 secs ago

Jay S.

374






Creating shapes with Nifty GUI and LWJGL

Aucun commentaire:

Enregistrer un commentaire