Hello world source code
Now for the famous Hello World source code.
Create a new class in your HelloWorld project by clicking the new class button from the tool bar.
Create a new class called "HelloWorld"
Add the following code to the new class file.
import pulpcore.Stage; import pulpcore.scene.Scene2D; import pulpcore.image.CoreImage; import pulpcore.sprite.FilledSprite; import pulpcore.sprite.ImageSprite; import static pulpcore.image.Colors.*; public class HelloWorld extends Scene2D { public void load() { //Create a solid fill colored background FilledSprite background = new FilledSprite(WHITE); add(background); //Create a sprite for the logo int x = Stage.getWidth() / 2; int y = Stage.getHeight() / 2; ImageSprite logo = new ImageSprite(CoreImage.load("logo.png"), x, y); logo.setAnchor(ImageSprite.CENTER); //Add the background first and then the logo //Sprite's are rendered in the order they are added add(background); add(logo); } }
We also need to add a logo image to our project. I have chosen the logo made by Sam Washburn on the Pulpcore google group.
Add a copy of this logo.png to the res\zip folder in your HelloWorld project.
You can get a copy of the source code here.
Hello world source code
Next: Ant Configuration
Related Posts:
Eclipse And Pulpcore Tutorial
Just a quick post about a new tutorial I have written. How to build your basic Hello...
Java build path
Next we need to setup the Java build path for our hello world project so that it...
Getting started with Pulpcore
There are several prerequisites that you will need before we get started. JavaSE...
Build and run
To build a Pulpcore applet in Eclipse using an Ant build script is easy. Simply...
It begins
Welcome to the launch of Cloning The Classics a website dedicated to the creation of...

