<< Chapter < Page Chapter >> Page >

Compile and run the program

Create a batch file

Use your text editor to create a text file named CompileAndRun.bat and store it in the folder named Slick0100a .

(Once again, be careful to ensure that the file has the correct extension, particularly if you create it with Windows Notepad. An extension of .txt won'twork.)

Carefully copy the contents Listing 2 into the text file. This is the file that you will use in your attempt to compile and run yoursource-code file named Slick0100a.java . (Line breaks or wrapped lines are not allowed. Make certain that your batch file has only sevenlines of text exclusive of blank lines.)

Listing 2 . The file named CompileAndRun.bat.
echo off del *.classrem refer to jar files in the folder named jars javac -cp .;../jars/slick.jar;../jars/lwjgl.jar Slick0100a.javarem set the java.library.path and the classpath and run the program java -Djava.library.path=../lwjglbin -cp .;../jars/slick.jar;../jars/lwjgl.jar Slick0100apause

Execute the batch file

Double-click your new batch file named CompileAndRun.bat (or execute it in whatever manner you prefer.) This should cause two new windows to appear on your screen.

Slick2D output during startup

The first window to appear should look similar to Figure 1 .

Figure 1 . Output from Slick2D during program startup.
Missing image.

Figure 1 shows information produced by Slick2D when a compiled Slick2D program starts running.

A default Slick2D game window

The second window to appear should look something like Figure 2 .

Figure 2 . A default Slick2D game window.
Missing image.

Figure 2 is a default Slick2D game window. As you will learn in the next module, this particularSlick2D program has no interesting behavior. In effect, it is an "empty" game program. Therefore, the only thingshowing in the game window is a counter in the top left corner that shows the execution rate in frames per second.

Run the program

I encourage you to copy the code from Listing 1 and Listing 2 . Install the necessary software on your computer as described above. Compile the code and executeit. If you don't see results similar to those shown above, go back and review the instructions very carefully.

Summary

I showed you how to install Slick2D in such a way that you can easily compile and execute Slick2D programs from the command line with no need for a high levelIDE.

What's next?

In the next module, I will use the code from Listing 1 to begin explaining the anatomy of a basic Slick2D game engine.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Slick0100: Getting started with the Slick2D game library.
  • File: Slick0100.htm
  • Published: 02/03/13
  • Revised: 06/06/15 for 64-bit
Disclaimers:

Financial : Although the Connexions site makes it possible for you to download a PDF file for thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

I also want you to know that, I receive no financial compensation from the Connexions website even if you purchase the PDF version of the module.

In the past, unknown individuals have copied my modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing me as the author. Ineither receive compensation for those sales nor do I know who does receive compensation. If you purchase such a book, please beaware that it is a copy of a module that is freely available on cnx.org and that it was made and published withoutmy prior knowledge.

Affiliation : I am a professor of Computer Information Technology at Austin Community College in Austin, TX.

Download source code

Click here to download a zip file containing the source code for all of the sample programs in this collection. The zip file alsocontains populated 64-bit versions of the folders named jars and lwjglbin to save you the trouble of downloading the distribution and populating those folders.

Extract the contents of the zip file into an empty folder. Each program should end up in a separate folder. Double-click the file named CompileAndRun.bat in each folder to compile and run the program contained in that folder.

-end-

Questions & Answers

state and explainfour function of a costumer service
Egba Reply
the circular flow model of the economy is a simplification showing how the economy works and the relationship between income,production and spending in the economy as a whole
Anna Reply
what is circular flow
Ntokozo Reply
what is economics?
Dorcas Reply
Economics is defined as the science that study human behaviour as a relationship between ends and scarce means which have alternative uses.
Emmanuella
economics is a social science concerned with the production,distribution, and consumption of goods and services
Michael
in 2021 Amazon reduced the annual subscription fee for its prime membership service which provides free two_day shipping on many goods and other benefits, from $119 to $99. Zoppa consulting, an investment firm estimated that before the price reduction, prime had 62million subscribers globally. If so, what is the arc elasticity of demand for a prime membership.
Joan Reply
Differences between microeconomics and macroeconomics
tatiana Reply
Macroeconomics deal with the economy as a whole.that is an economy affect the firm ,government and the households eg.unemployment, whilst Microeconomics deal with the the decision making of households,firm and government separately.
Amah
what is Economics
Ebem Reply
the branch of knowledge concerned with the production, consumption, and transfer of wealth and has Influence by sociology!!!!
Ajay
Economics is the study of how humans make decisions when they want to fulfil their requirements and desires for goods, services and resources.
Abdullah
Economics is the study how humans make decisions in the faces of scarcity.
Rose
economic is the study of how human make decision in the fact of scarcity.
Toang
Economics is a social science which study human behavior as a relationship between earn and scarce mean which have alternative uses
Juliet
what is market structure
Fatima
market structure in economics depicts how firms are differentiated and categorised based on types of goods they sell and how their operations are affected by external factors and elements.
Nasir
what is economic theory
Madara
what is demand
Gooluck Reply
demand is the willingness to purchase something
Mohamed
demand is the potential ability or williness to purchases something at a particular price at a given period of time..
Ahmed
Demand refers to as quantities of a goods and services in which consumers are willing and able to purchase at a given period of time. Demand can also be defined as the desire backed by ability to purchase .
Fadiga
what is demand
John Reply
is the production of goods in scarcity
David
thanks
John
Demand refers to as quantities of a goods and services in which consumers are willing and able to purchase at a given period of time.
Fadiga
Demand refers to the quantity of goods and services that a consumer is willing and able to buy at a given price over a period of time
Augustina
Do high interest rate in a country increase investment
Alfred
what is demand of supply
music Reply
What is the meaning of supply of labour
Anthonia Reply
what is production?
Elizabeth Reply
Production is basically the creation of goods and services to satisfy human wants
Anthonia
importance of tertiary and example
Elizabeth
Production is the process of producing goods and services to satisfy human needs and want.
Augustina
under what condition will demand curve slope upward from left to right instead of normally sloping downward from left to right
Atama Reply
how i can calculate elasticity?
Tewekel Reply
What is real wages
Emmanuella Reply
Researchers demonstrated that the hippocampus functions in memory processing by creating lesions in the hippocampi of rats, which resulted in ________.
Mapo Reply
The formulation of new memories is sometimes called ________, and the process of bringing up old memories is called ________.
Mapo Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Anatomy of a game engine. OpenStax CNX. Feb 07, 2013 Download for free at https://legacy.cnx.org/content/col11489/1.13
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Anatomy of a game engine' conversation and receive update notifications?

Ask