Java Code Examples for org.newdawn.slick.Input#disableControllers()

The following examples show how to use org.newdawn.slick.Input#disableControllers() . 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
/**
 * Entry point to our simple test
 * 
 * @param args The arguments supplied to the test
 * @throws SlickException Indicates a failure loading or processing resources 
 * @throws IOException Indicates a failure loading the font
 */
public static void main(String[] args) throws SlickException, IOException {
	Input.disableControllers();
	AppGameContainer container = new AppGameContainer(new UnicodeFontTest());
	container.setDisplayMode(512, 600, false);
	container.setTargetFrameRate(20);
	container.start();
}
 
Example 2
void initialize () throws SlickException {
	initializeComponents();
	initializeMenus();
	initializeEvents();

	setSize(800, 600);
	setLocationRelativeTo(null);

	Input.disableControllers();

	sampleNeheButton.doClick();

	game = new BasicGame("Hiero") {
		String sampleText;

		public void init (final GameContainer container) throws SlickException {
			container.setShowFPS(false);
			container.setVerbose(false);
			container.setTargetFrameRate(60);
			container.setClearEachFrame(false);
			container.setAlwaysRender(true);
			gamePanel.setVisible(true);
		}

		public void update (GameContainer container, int delta) throws SlickException {
			if (newUnicodeFont != null) {
				if (unicodeFont != null) unicodeFont.destroy();
				unicodeFont = newUnicodeFont;
				newUnicodeFont = null;
			}

			// BOZO - Fix no effects.
			if (unicodeFont.loadGlyphs(25)) {
				glyphPageComboModel.removeAllElements();
				int pageCount = unicodeFont.getGlyphPages().size();
				int glyphCount = 0;
				for (int i = 0; i < pageCount; i++) {
					glyphPageComboModel.addElement("Page " + (i + 1));
					glyphCount += ((GlyphPage)unicodeFont.getGlyphPages().get(i)).getGlyphs().size();
				}
				glyphPagesTotalLabel.setText(String.valueOf(pageCount));
				glyphsTotalLabel.setText(String.valueOf(glyphCount));
			}

			if (saveBmFontFile != null) {
				try {
					BMFontUtil bmFont = new BMFontUtil(unicodeFont);
					bmFont.save(saveBmFontFile);
				} catch (Exception ex) {
					Log.error("Error saving BMFont files: " + saveBmFontFile.getAbsolutePath(), ex);
				} finally {
					saveBmFontFile = null;
				}
			}
		}

		public void render (GameContainer container, Graphics g) throws SlickException {
			if (unicodeFont == null) return;

			try {
				sampleText = sampleTextPane.getText();
			} catch (Exception ex) {
			}

			if (sampleTextRadio.isSelected()) {
				g.setBackground(renderingBackgroundColor);
				g.clear();
				int offset = unicodeFont.getYOffset(sampleText);
				if (offset > 0) offset = 0;
				unicodeFont.drawString(0, -offset, sampleText, Color.white, 0, sampleText.length());
			} else {
				g.setBackground(Color.white);
				g.clear();
				unicodeFont.addGlyphs(sampleText);
				g.setColor(renderingBackgroundColor);
				g.fillRect(0, 0, unicodeFont.getGlyphPageWidth() + 2, unicodeFont.getGlyphPageHeight() + 2);
				int index = glyphPageCombo.getSelectedIndex();
				List pages = unicodeFont.getGlyphPages();
				if (index >= 0 && index < pages.size())
					((GlyphPage)pages.get(glyphPageCombo.getSelectedIndex())).getImage().draw(1, 1);
			}
		}
	};

	canvasContainer = new CanvasGameContainer(game) {
		public int getWidth () {
			int width = super.getWidth();
			return width <= 0 ? 1 : width;
		}

		public int getHeight () {
			int height = super.getHeight();
			return height <= 0 ? 1 : height;
		}
	};
}