コード例 #1
0
  public GameRenderer(Viewport viewport, Camera camera, GameEngine engine) {
    this.viewport = viewport;
    this.camera = camera;
    this.engine = engine;

    shapeRenderer = new MyShapeRenderer();
    shapeRenderer.setAutoShapeType(true);

    spriteBatch = new SpriteBatch();
    font = new BitmapFont();
    font.setColor(Color.WHITE);
    font.setUseIntegerPositions(false);
    font.getData().setScale(0.01f);
    shadowBatch = new ModelBatch(new DepthShaderProvider());

    ShaderProgram.pedantic = false;
    final String vertUber = Gdx.files.internal("shaders/uber.vert").readString();
    final String fragUber = Gdx.files.internal("shaders/uber.frag").readString();
    modelBatch =
        new ModelBatch(
            new DefaultShaderProvider(vertUber, fragUber) {
              @Override
              protected Shader createShader(final Renderable renderable) {
                return new UberShader(renderable, config);
              }
            });
  }
コード例 #2
0
  public CommonDrawer() {
    myTextureChecker = new TextureChecker();
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();
    r = w / h;
    mySpriteBatch = new SpriteBatch();

    final FileHandle fontFile = FileManager.getInstance().getFontsDirectory().child("main.fnt");
    myFont = new BitmapFont(fontFile, true);
    myFont.setUseIntegerPositions(false);

    myOrigFontHeight = myFont.getXHeight();

    layout = new GlyphLayout();
  }