public TwlTest() throws Exception { renderer = new LWJGLRenderer(); theme = ThemeManager.createThemeManager(SimpleTest.class.getResource("simple_demo.xml"), renderer); root = new Widget(); root.setTheme(""); gui = new GUI(root, renderer); gui.setSize(); gui.applyTheme(theme); addTestAlert(10, 10, "<minwidth"); addTestAlert(10, 100, "Between min and max width"); addTestAlert( 10, 180, "Past max width but less than max height. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "); addTestAlert( 10, 350, "Past max width and past max height. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. " + "This is a lot of text. This is a lot of text. This is a lot of text. This is a lot of text. "); }
static void init(Arguments args) { // Load the specified config file Config config = new Config(args.get_value("config", "voxicity.properties")); String mode = args.get_value("mode", "client"); if (mode.equals("server")) { // Start the server, it spawns its own thread // and takes over from here new Server(config).run(); } else if (mode.equals("client")) { try { System.out.println("Intializing display"); Display.setDisplayMode(new DisplayMode(1200, 720)); Display.create(); Display.setTitle("Voxicity"); System.out.println("Display created"); } catch (LWJGLException e) { System.out.println("Unable to open Display"); e.printStackTrace(); System.exit(1); } System.out.println("Setting up OpenGL states"); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearColor(126.0f / 255.0f, 169.0f / 255.0f, 254.0f / 255.0f, 1.0f); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); System.out.println( "Number of texture units: " + GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS)); System.out.println( "Number of image texture units: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); System.out.println( "Number of vertex texture units: " + GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)); System.out.println( "Number of combined vertex/image texture units: " + GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)); try { LWJGLRenderer gui_renderer = new LWJGLRenderer(); LoginGUI login_gui = new LoginGUI(); ThemeManager theme = ThemeManager.createThemeManager(Voxicity.class.getResource("/login.xml"), gui_renderer); GUI gui = new GUI(login_gui, gui_renderer); gui.applyTheme(theme); while (!login_gui.is_login_pressed()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); gui.update(); Display.update(); if (Display.isCloseRequested()) { Display.destroy(); System.exit(0); } } Socket client_s = new Socket(login_gui.get_server_name(), 11000); Client client = new Client(config, new NetworkConnection(client_s)); client.run(); System.out.println("Destroying display"); Display.destroy(); } // Catch exceptions from the game init and main game-loop catch (LWJGLException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (IOException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } else { System.out.println("Invalid mode: " + mode); } }