Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

I cant seem to render text. #788

Discussion options

package pkg2d.platformer.game;
import de.gurkenlabs.litiengine.Game;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;

/**
*

  • @author KTECH
    */
    public class Main {

    /**

    • @param args the command line arguments
      */
      public static void main(String[] args) {
      // TODO code application logic here

Game.init(args);
Graphics2D g = null;
Game.graphics().renderText(g, "my text", 50, 100);

 Game.loop();
}

}
Please assist

You must be logged in to vote

Replies: 1 comment 5 replies

Comment options

You are passing null as the Graphics2D object to draw on.
The proper way would be to create and add a Screen, then in that screen's render method take the Graphics2D instance to draw whatever you want.

You must be logged in to vote
5 replies
Comment options

Any small amount of code

Comment options

how can i do that? The documentation is a bit vague

Comment options

Answer selected by ElectricIceBird
Comment options

Thank you for your reply it worked!!

Comment options

Awesome! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /