コード例 #1
0
  /* (non-Javadoc)
   * @see chu.engine.Game#init(int, int, java.lang.String)
   */
  public void init(int width, int height, String name) {
    super.init(width, height, name);
    Player p1 = new Player("Player", (byte) 0);
    localPlayer = p1;
    ByteBuffer icon16, icon32;
    icon16 = icon32 = null;
    try {
      icon16 =
          ByteBuffer.wrap(
              TextureLoader.getTexture(
                      "PNG", ResourceLoader.getResourceAsStream("res/gui/icon16.png"))
                  .getTextureData());
      icon32 =
          ByteBuffer.wrap(
              TextureLoader.getTexture(
                      "PNG", ResourceLoader.getResourceAsStream("res/gui/icon32.png"))
                  .getTextureData());
    } catch (IOException e) {
      e.printStackTrace();
    }
    Display.setIcon(new ByteBuffer[] {icon16, icon32});
    FEResources.loadResources();
    FEResources.loadBitmapFonts();
    WeaponFactory.loadWeapons();
    UnitFactory.loadUnits();
    p1.getParty().setColor(Party.TEAM_BLUE);

    /* OpenGL final setup */
    glEnable(GL_LINE_SMOOTH);

    UnitFactory.getUnit("Lyn");
    connect = new ConnectStage();
    setCurrentStage(new TitleStage());
    SoundTrack.loop("main");
  }
コード例 #2
0
 /* (non-Javadoc)
  * @see chu.engine.Entity#render()
  */
 public void render() {
   BitmapFont font = FEResources.getBitmapFont("default_med");
   Renderer.drawRectangle(x - 1, y - 1, x + width + 1, y + height + 1, renderDepth, Color.black);
   if (hasFocus) {
     Renderer.drawRectangle(x, y, x + width, y + height, renderDepth, FOCUSED);
     float linepos = x + font.getStringWidth(input.substring(0, cursorPos)) + 2;
     Renderer.drawRectangle(
         linepos, y + 1, linepos + 1, y + height - 1, renderDepth - 0.02f, CURSOR);
   } else {
     Renderer.drawRectangle(x, y, x + width, y + height, renderDepth, UNFOCUSED);
   }
   Renderer.drawString("default_med", input.toString(), x + 2, y + 5, renderDepth - 0.01f);
 }
コード例 #3
0
 /**
  * Instantiates a new connect button.
  *
  * @param x the x
  * @param y the y
  * @param w the w
  * @param h the h
  */
 public ConnectButton(float x, float y, float w, float h) {
   super(x, y, w, h);
   sprite.addAnimation("default", FEResources.getTexture("connect_button"));
 }