<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://slick.ninjacave.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Decerez</id>
		<title>Slick2D Wiki - User contributions [en-gb]</title>
		<link rel="self" type="application/atom+xml" href="http://slick.ninjacave.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Decerez"/>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Special:Contributions/Decerez"/>
		<updated>2026-05-06T17:40:34Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.4</generator>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Embedding_Mozilla_Rhino&amp;diff=576</id>
		<title>Embedding Mozilla Rhino</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Embedding_Mozilla_Rhino&amp;diff=576"/>
				<updated>2018-05-09T18:33:36Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 560 by Abc123456 ([[User talk:Abc123456|talk vandalism&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Scripting engines have started to become very popular game development tools. They allow developers to make changes to game logic without needing to recompile, or possibly even restart, the game.&lt;br /&gt;
&lt;br /&gt;
This tutorial describes the steps needed to get start using the Mozilla Rhino Javascript engine in your Slick-based games.&lt;br /&gt;
&lt;br /&gt;
== Getting Rhino ==&lt;br /&gt;
&lt;br /&gt;
The obvious first step is to [https://developer.mozilla.org/en-US/docs/Rhino get the Rhino distribution]. Unpack the zip file and place the js.jar file in your project. Make sure to add it to your classpath and double check your build setup to be sure the jar file is included when your program is compiled and run.&lt;br /&gt;
&lt;br /&gt;
== Running Rhino and Slick together ==&lt;br /&gt;
&lt;br /&gt;
The following program is a simple implementation of Rhino running inside a Slick game. It is pretty well commented, and should explain the necessary steps as they happen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
  This file demonstrates using the Rhino Javascript engine within the&lt;br /&gt;
  Slick 2d game engine.&lt;br /&gt;
 &lt;br /&gt;
  Rhino can be found at: http://www.mozilla.org/rhino/&lt;br /&gt;
  Slick can be found at: http://slick.cokeandcode.com/&lt;br /&gt;
*/&lt;br /&gt;
 &lt;br /&gt;
import org.newdawn.slick.AppGameContainer;&lt;br /&gt;
import org.newdawn.slick.BasicGame;&lt;br /&gt;
import org.newdawn.slick.GameContainer;&lt;br /&gt;
import org.newdawn.slick.Graphics;&lt;br /&gt;
import org.newdawn.slick.Input;&lt;br /&gt;
import org.newdawn.slick.SlickException;&lt;br /&gt;
 &lt;br /&gt;
import org.mozilla.javascript.Context;&lt;br /&gt;
import org.mozilla.javascript.ScriptableObject;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
public class Rhino extends BasicGame {&lt;br /&gt;
 &lt;br /&gt;
    /*&lt;br /&gt;
      The ScriptProxy class defined here is one half of the interface&lt;br /&gt;
      between Java code and the Javascript environment. It is used to,&lt;br /&gt;
      among other things, provide access to Java objects within Rhino.&lt;br /&gt;
 &lt;br /&gt;
      The ScriptableObject class implements the majority of the&lt;br /&gt;
      Scriptable interface. The Scriptable interface is used to define&lt;br /&gt;
      functions and objects that will be available to the javascript&lt;br /&gt;
      environment.&lt;br /&gt;
    */&lt;br /&gt;
    class ScriptProxy extends ScriptableObject {&lt;br /&gt;
    	String test1;&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  This is the only method required to fully implement the&lt;br /&gt;
    	  abstract class ScriptableObject. I&amp;#039;m not sure what it is&lt;br /&gt;
    	  supposed to do. The &amp;quot;global&amp;quot; value is used in at least one&lt;br /&gt;
    	  example in the Rhino documentation.&lt;br /&gt;
	*/&lt;br /&gt;
    	public String getClassName() {&lt;br /&gt;
    	    return &amp;quot;global&amp;quot;;&lt;br /&gt;
    	}&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  Access to the &amp;quot;test&amp;quot; object in the javascript environment is&lt;br /&gt;
    	  implemented through calls to the setTest and getTest&lt;br /&gt;
    	  methods.&lt;br /&gt;
	*/&lt;br /&gt;
    	public void setTest(String str) {&lt;br /&gt;
    	    test1 = str;&lt;br /&gt;
    	}&lt;br /&gt;
 &lt;br /&gt;
    	public String getTest() {&lt;br /&gt;
    	    return test1;&lt;br /&gt;
    	}&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  A test function that can be called within the JavaScript&lt;br /&gt;
    	  environment.&lt;br /&gt;
	*/&lt;br /&gt;
    	public void testfunc(String s) {&lt;br /&gt;
	    // 	    System.out.println(&amp;quot;test function called&amp;quot;);&lt;br /&gt;
    	    System.out.println(s);&lt;br /&gt;
    	}&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    /*&lt;br /&gt;
      A Context is an instance of the javascript environment. The&lt;br /&gt;
      context is used to load and interpret .js files and interpret&lt;br /&gt;
      Javascript code as strings, among other things. In this example&lt;br /&gt;
      it is used exclusively to interpret Javascript strings.&lt;br /&gt;
    */&lt;br /&gt;
    protected Context scriptContext;&lt;br /&gt;
    protected ScriptProxy gameProxy;&lt;br /&gt;
 &lt;br /&gt;
    public void init(GameContainer container) throws SlickException {&lt;br /&gt;
    	/*&lt;br /&gt;
    	  The static method Context.enter is, apparently, the easiest&lt;br /&gt;
    	  way to obtain a javascript environment.&lt;br /&gt;
	*/&lt;br /&gt;
    	scriptContext = Context.enter();&lt;br /&gt;
    	gameProxy = new ScriptProxy();&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  We&amp;#039;ll set a string for the &amp;quot;test&amp;quot; property that will be&lt;br /&gt;
    	  exposed in Javascript now so we know it is calling across&lt;br /&gt;
    	  the bridge.&lt;br /&gt;
	*/&lt;br /&gt;
    	gameProxy.setTest(&amp;quot;This was set within java, but called from javascript.&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  This must be called before scripts can be evaluated in this&lt;br /&gt;
    	  Context. It creates some of the basic Javascript objects.&lt;br /&gt;
	*/&lt;br /&gt;
    	scriptContext.initStandardObjects(gameProxy);&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  Functions provided by a ScriptableObject (such as our&lt;br /&gt;
    	  example &amp;#039;testfunc&amp;#039;) are initialized in the following manner.&lt;br /&gt;
	*/&lt;br /&gt;
    	String[] scriptAvailableFunctions = { &amp;quot;testfunc&amp;quot; };&lt;br /&gt;
    	gameProxy.defineFunctionProperties(scriptAvailableFunctions, ScriptProxy.class, ScriptableObject.DONTENUM);&lt;br /&gt;
 &lt;br /&gt;
    	/*&lt;br /&gt;
    	  A &amp;quot;property&amp;quot; is a Javascript object that is exposed through&lt;br /&gt;
    	  getters and setters in the ScriptableObject. Rhino&lt;br /&gt;
    	  automatically prepends the &amp;quot;set&amp;quot; and &amp;quot;get&amp;quot; terms and&lt;br /&gt;
    	  uppercases the first letter, so exact naming is important.&lt;br /&gt;
	*/&lt;br /&gt;
    	gameProxy.defineProperty(&amp;quot;test&amp;quot;, ScriptProxy.class, ScriptableObject.DONTENUM);&lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public void render(GameContainer container, Graphics g) {&lt;br /&gt;
    	/*&lt;br /&gt;
    	  Here we are using the context (javascript engine) to&lt;br /&gt;
    	  evaluate a string. The first parameter is our&lt;br /&gt;
    	  ScriptableObject, which is used to provide definitions for&lt;br /&gt;
    	  the engine. The second argument is the code to be evaluated.&lt;br /&gt;
    	  In this case simply writing &amp;quot;test&amp;quot; evaluates the Javascript&lt;br /&gt;
    	  object named &amp;quot;test&amp;quot;, which is looked up in our gameProxy,&lt;br /&gt;
    	  which passed the result of it&amp;#039;s getTest() method to the&lt;br /&gt;
    	  Javascript engine.&lt;br /&gt;
 &lt;br /&gt;
    	  Since this is the only instruction in the string to be&lt;br /&gt;
    	  evaluated it is used as the return value for&lt;br /&gt;
    	  evaluateString. To provide flexibility in return type&lt;br /&gt;
    	  handling evaluateString returns a java.lang.Object, which is&lt;br /&gt;
    	  why the result must be cast back into a String.&lt;br /&gt;
 &lt;br /&gt;
    	  The third parameter is a string that describes the source&lt;br /&gt;
    	  for the Javascript code being evaluated. This may be a&lt;br /&gt;
    	  filename if that is where the string comes from.&lt;br /&gt;
 &lt;br /&gt;
    	  The fourth parameter is the starting line number for this&lt;br /&gt;
    	  script, which might be useful if a script is being pieced&lt;br /&gt;
    	  together from a variety of components.&lt;br /&gt;
 &lt;br /&gt;
    	  The last parameter is used to provide a security domain for&lt;br /&gt;
    	  the script to run under. I *think* this is used to ensure&lt;br /&gt;
    	  that the Javascript code cannot execute certain methods or&lt;br /&gt;
    	  instantiate some objects, but haven&amp;#039;t done enough research&lt;br /&gt;
    	  to be sure. Passing a null value here does not restrict the&lt;br /&gt;
    	  evaluation of Javascript code.&lt;br /&gt;
	*/&lt;br /&gt;
    	String result = (String) scriptContext.evaluateString(gameProxy, &amp;quot;test;&amp;quot;, &amp;quot;js&amp;quot;, 1, null);&lt;br /&gt;
    	g.drawString(&amp;quot;Javascript result: &amp;quot; + result, 40, 120);&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public void update(GameContainer container, int delta) {&lt;br /&gt;
 &lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    public void keyPressed(int key, char c) {&lt;br /&gt;
    	if(key == Input.KEY_ESCAPE) {&lt;br /&gt;
    	    /*&lt;br /&gt;
    	      The script context will most likely be shut down&lt;br /&gt;
    	      properly, but it&amp;#039;s a good idea to be neat and tidy,&lt;br /&gt;
    	      right?&lt;br /&gt;
	    */&lt;br /&gt;
    	    scriptContext.exit();&lt;br /&gt;
    	    System.exit(0);&lt;br /&gt;
    	}&lt;br /&gt;
    	if(key == Input.KEY_SPACE) {&lt;br /&gt;
    	    /*&lt;br /&gt;
    	      This example is largely similar to the above, except&lt;br /&gt;
    	      that now we are calling the javascript function&lt;br /&gt;
    	      &amp;quot;testfunc()&amp;quot;. This is found and executed on gameProxy,&lt;br /&gt;
    	      printing a string to the console.&amp;quot;&lt;br /&gt;
	    */&lt;br /&gt;
    	    scriptContext.evaluateString(gameProxy, &amp;quot;testfunc(\&amp;quot;testing console output\&amp;quot;);&amp;quot;, &amp;quot;js&amp;quot;, 5, null);&lt;br /&gt;
    	}&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    public Rhino(String s) {&lt;br /&gt;
    	super(s);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public static void main(String[] Args) {&lt;br /&gt;
    	try {&lt;br /&gt;
    	    AppGameContainer container = new AppGameContainer(new Rhino(&amp;quot;Rhino&amp;quot;));&lt;br /&gt;
    	    container.setDisplayMode(600,480,false);&lt;br /&gt;
    	    //       container.setShowFPS(false);&lt;br /&gt;
    	    container.setMinimumLogicUpdateInterval(30);&lt;br /&gt;
    	    container.start();&lt;br /&gt;
    	} catch (SlickException e) {&lt;br /&gt;
	    e.printStackTrace();&lt;br /&gt;
    	}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Next Steps ==&lt;br /&gt;
&lt;br /&gt;
The next step to consider from here is how the Javascript code handles game logic updates. One simple option is to create a Javascript function named tick that your game calls every time update() runs. This in turn calls all of the functions that need to be run in Javascript on every game update.&lt;br /&gt;
&lt;br /&gt;
One obvious step to take from this point is to extend the access of the Javascript environment into your game. You don&amp;#039;t need to use an inner class to implement your ScriptableObject, and could easily have it in another file. If you already have a scene graph it probably has quite a few methods for interacting with your game environment, which might make it a good idea to turn this into a ScriptableObject and make it available to the Javascript engine.&lt;br /&gt;
&lt;br /&gt;
Since the ScriptableObject we are using also stores all of the definitions that are in scope, a second ScriptableObject can be created for a user interaction console. This allows you to expose only very specific parts of the game to the user and prevent them from directly modifying the underlying game.&lt;br /&gt;
&lt;br /&gt;
== Hot Loading Definitions ==&lt;br /&gt;
&lt;br /&gt;
One interesting use for the Javascript environment is being able to modify the game logic as the game is running. This is remarkably easy to set up. We can create a command-line input prompt that runs with the game by declaring a boolean consolePrinted member variable and adding the following code to the update method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	if(!consolePrinted) {&lt;br /&gt;
	    System.out.print(&amp;quot;rhino&amp;gt; &amp;quot;);&lt;br /&gt;
	    consolePrinted = true;&lt;br /&gt;
	}&lt;br /&gt;
	// Only parse input strings when the input buffer is empty so we&lt;br /&gt;
	// don&amp;#039;t block the game loop.&lt;br /&gt;
	if(System.in.available() != 0) {&lt;br /&gt;
	    byte[] b = new byte[System.in.available()];&lt;br /&gt;
	    System.in.read(b);&lt;br /&gt;
	    String s = new String(b);&lt;br /&gt;
	    gameProxy.setTest(s);&lt;br /&gt;
	    consolePrinted = false;&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example simply alter the test property in Javascript, but we could just as easily be executing the string directly as Javascript or using it to provide a simple command system for reloading Javascript files.&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Overview&amp;diff=575</id>
		<title>Overview</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Overview&amp;diff=575"/>
				<updated>2018-05-09T18:32:38Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 530 by Abc123456 (talk) vandalism&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Slick2D is a simple set of tools wrapped around the [http://lwjgl.org/ LWJGL] OpenGL binding for Java. It&amp;#039;s aims are as follows:&lt;br /&gt;
* Provide a simple 2D API&lt;br /&gt;
* Make transition from Java2D to OpenGL easier&lt;br /&gt;
* Enable distribution via WebStart without the complexity&lt;br /&gt;
* Provide the tools required for most simple games out of the box&lt;br /&gt;
* Extensible framework for flexibility&lt;br /&gt;
* Mix and Match - you use what you want, nothing is enforced.&lt;br /&gt;
* Help with rendering, sound, input, collision and anything else we can think of.&lt;br /&gt;
&lt;br /&gt;
Here are some things we&amp;#039;re explicitly not doing and why:&lt;br /&gt;
* Abstracting the rendering method (i.e. Java2D or OpenGL). With the advent of LWJGL Applets, it&amp;#039;s a waste of time and just makes things more complicated.&lt;br /&gt;
* Take over your development - where would the fun be if the library just forced you to do everything it&amp;#039;s way?&lt;br /&gt;
* Fix everything - there will always be challenges in games development.&lt;br /&gt;
* Move to 3D eventually.&lt;br /&gt;
&lt;br /&gt;
Check out the [[Getting Started]] guide to start your journey into slick-smooth Java game development!&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Resource_Loading&amp;diff=574</id>
		<title>Resource Loading</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Resource_Loading&amp;diff=574"/>
				<updated>2018-05-09T18:30:45Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 554 by Abc123456 (talk) Restoring page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;When referencing resources ([[images]], [[SpriteSheet|spritesheets]], fonts, sounds etc.) the underlying class will use the ResourceManager to find the resource and obtain an input stream to it.&lt;br /&gt;
&lt;br /&gt;
The resource manager first tries to look the resource up using the classpath. Putting your resources in the classpath is generally the best way to work since it makes transitioning to deployment (webstart and/or applets) much easier - since the classpath is present at testing and at deployment. Note that the context class loader is used which ensure that at deployment what ever the framework being used for deployment is can specify an appropriate class loader to obtain resources.&lt;br /&gt;
&lt;br /&gt;
If the resource manager is unable to locate the resoruce within the classpath it will attempt to use the reference provided as a file name relative to the current directory. This is sometimes useful during testing. It is also possible to deploy while still being dependent on direct file reference (maybe using an installer and keeping files unjarred) but this is not recommended.&lt;br /&gt;
&lt;br /&gt;
Finally if the resource manager can not locate the resource it will report an error which may stop initialisation. It is possible that resource location can fail but still the resource can remain valid and so a resource simply not being located is not always a reason to stop init.&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Deferred Resource Loading]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Resources]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Images&amp;diff=573</id>
		<title>Images</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Images&amp;diff=573"/>
				<updated>2018-05-09T18:30:03Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 523 by Abc123456 (talk) Restored page state from bot spam&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Images are the most primitive drawing tool within Slick. They are the root of most of utilities for rendering. Each image will draw a rectangular area on the screen filled with some pixels based on either a generated source (see [[ImageBuffer]]) or a image loaded from disk.&lt;br /&gt;
&lt;br /&gt;
Slick currently uses java&amp;#039;s ImageIO to load images so supports, PNG, GIF and JPG. It also supports TGA through a pure java loader which is generally much faster than using ImageIO. However, the TGA must be non-compressed and 32 bit to be loaded correctly. Note that of course resources are generally placed in JAR files and as such TGA compresses down in this context in a similar magnitude to PNG.&lt;br /&gt;
&lt;br /&gt;
As with most things in Slick images are currently rendered in the simplest manner possible, using OpenGL immediate mode. This is not the most efficient manner and hence this is subject to change at a later date (should a need arise).&lt;br /&gt;
&lt;br /&gt;
Note that fonts, sprite sheets and particles all rely on the basic image class. It&amp;#039;s also worth remember that any given texture (or external image) is loaded only once and hence no caching is required on the developers side. This also means that sub-images and references to the original data so memory is not duplicated. As a side effects images are considered non-mutable - i.e. they can not be changed - which may have invalidated another references rendering.&lt;br /&gt;
&lt;br /&gt;
== Loading Images ==&lt;br /&gt;
&lt;br /&gt;
To load an image, you only need to make a simple object initialization call, where the Slick Engine will do most of the preparation for you. &lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Image img = new Image(&amp;quot;res/myimage.png&amp;quot;);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The image can either be in the classpath (for webstart) or on the file system (for local testing).&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
Rendering images that have been loaded can be just as simple as loading them into your program. Simply call the &amp;#039;draw&amp;#039; method in your &amp;#039;render&amp;#039; method as so:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;img.draw(x, y);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will render your image at the specified X and Y coordinates of the GameContainer&amp;#039;s graphics. &lt;br /&gt;
&lt;br /&gt;
== Image Filtering ==&lt;br /&gt;
&lt;br /&gt;
Though rendering your image may seem simple enough, sometimes there can be strange outcomes to what is shown on screen, in comparison to the actual picture you are trying to load. One point of interest is the image&amp;#039;s filter setting. If you wish to scale your image without a blurring effect (read: Linear Filtering; causes textures to blend colors in the magnification process), you will need to use the &amp;#039;Nearest&amp;#039; filter setting. This can come in handy when working with pixel-style art games, as it retains the color of the actual image being used by using the nearest pixel to the expanded sector.&lt;br /&gt;
&lt;br /&gt;
Enabling &amp;#039;Linear&amp;#039; Filtering: (Example of 16x16 scaled at 4f with Linear Filtering: http://i.imgur.com/Iw6gPQr.png)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Image img = new Image(&amp;quot;res/myimage.png&amp;quot;);&lt;br /&gt;
img.setFilter(Image.FILTER_LINEAR);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Enabling &amp;#039;Nearest&amp;#039; Filtering: (Example of 16x16 scaled at 4f with Nearest Filtering: http://i.imgur.com/0yHRMWy.png)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Image img = new Image(&amp;quot;res/myimage.png&amp;quot;);&lt;br /&gt;
img.setFilter(Image.FILTER_NEAREST);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
* [[Resource Loading]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Images]] [[Category:Graphics]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Graphics&amp;diff=572</id>
		<title>Graphics</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Graphics&amp;diff=572"/>
				<updated>2018-05-09T18:29:32Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 540 by Abc123456 (talk) Restored page from spam&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Slick2D supplies several ways to draw images on your screen:&lt;br /&gt;
* [[Images]]&lt;br /&gt;
* [[Animation]]&lt;br /&gt;
&lt;br /&gt;
~And more~&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Hello_World&amp;diff=571</id>
		<title>Hello World</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Hello_World&amp;diff=571"/>
				<updated>2018-05-09T18:28:10Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 531 by Abc123456 (talk) Restored Page from spam&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To make sure your setup succeeded, create a main class like the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
package simpleslickgame;&lt;br /&gt;
import java.util.logging.Level;&lt;br /&gt;
import java.util.logging.Logger;&lt;br /&gt;
import org.newdawn.slick.AppGameContainer;&lt;br /&gt;
import org.newdawn.slick.BasicGame;&lt;br /&gt;
import org.newdawn.slick.GameContainer;&lt;br /&gt;
import org.newdawn.slick.Graphics;&lt;br /&gt;
import org.newdawn.slick.SlickException;&lt;br /&gt;
&lt;br /&gt;
public class SimpleSlickGame extends BasicGame&lt;br /&gt;
{&lt;br /&gt;
	public SimpleSlickGame(String gamename)&lt;br /&gt;
	{&lt;br /&gt;
		super(gamename);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	@Override&lt;br /&gt;
	public void init(GameContainer gc) throws SlickException {}&lt;br /&gt;
&lt;br /&gt;
	@Override&lt;br /&gt;
	public void update(GameContainer gc, int i) throws SlickException {}&lt;br /&gt;
&lt;br /&gt;
	@Override&lt;br /&gt;
	public void render(GameContainer gc, Graphics g) throws SlickException&lt;br /&gt;
	{&lt;br /&gt;
		g.drawString(&amp;quot;Howdy!&amp;quot;, 10, 10);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public static void main(String[] args)&lt;br /&gt;
	{&lt;br /&gt;
		try&lt;br /&gt;
		{&lt;br /&gt;
			AppGameContainer appgc;&lt;br /&gt;
			appgc = new AppGameContainer(new SimpleSlickGame(&amp;quot;Simple Slick Game&amp;quot;));&lt;br /&gt;
			appgc.setDisplayMode(640, 480, false);&lt;br /&gt;
			appgc.start();&lt;br /&gt;
		}&lt;br /&gt;
		catch (SlickException ex)&lt;br /&gt;
		{&lt;br /&gt;
			Logger.getLogger(SimpleSlickGame.class.getName()).log(Level.SEVERE, null, ex);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If a window opens saying &amp;#039;Howdy!&amp;#039;, your setup is fully configured and ready for development.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Elevate_Fitness_Goals_With_Beyond_Yoga_Apparel&amp;diff=570</id>
		<title>Elevate Fitness Goals With Beyond Yoga Apparel</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Elevate_Fitness_Goals_With_Beyond_Yoga_Apparel&amp;diff=570"/>
				<updated>2018-05-09T18:27:05Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Removing self advertisement&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;-REMOVED-&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Loading_libraries_and_natives_from_path&amp;diff=569</id>
		<title>Loading libraries and natives from path</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Loading_libraries_and_natives_from_path&amp;diff=569"/>
				<updated>2018-05-09T18:25:39Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 561 by Abc123456 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Some of you may want to load the libraries and natives needed for slick from a custom path or directory.&lt;br /&gt;
This is useful when you don&amp;#039;t want your users to type in additional parameters for starting your program.&lt;br /&gt;
Working with additional parameters can - more often than not - bring about errors and/or reports of bugs.&lt;br /&gt;
&lt;br /&gt;
To avoid these problems, you can follow this tutorial.&lt;br /&gt;
&lt;br /&gt;
==Filestructure==&lt;br /&gt;
In this section you will see the structure which we will use for this example.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;YourDirectory&amp;gt;&lt;br /&gt;
    ├── libs&lt;br /&gt;
    │   ├── lwjgl.jar&lt;br /&gt;
    │   ├── slick.jar&lt;br /&gt;
    │   └── natives&lt;br /&gt;
    │       ├── libjinput-linux.so&lt;br /&gt;
    │       ├── libjinput-linux64.so&lt;br /&gt;
    │       ├── liblwjgl.so&lt;br /&gt;
    │       ├── liblwjgl64.so&lt;br /&gt;
    │       ├── libopenal.so&lt;br /&gt;
    │       └── libopenal64.so&lt;br /&gt;
    └── YourProgram.jar&lt;br /&gt;
&lt;br /&gt;
For this example the libraries used are the minimum for a Slick programm which are:&lt;br /&gt;
* lwjgl.jar&lt;br /&gt;
* slick.jar&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The natives libraries which are used are the natives for linux:&lt;br /&gt;
* libjinput-linux.so&lt;br /&gt;
* libjinput-linux64.so&lt;br /&gt;
* liblwjgl.so&lt;br /&gt;
* liblwjgl64.so&lt;br /&gt;
* libopenal.so&lt;br /&gt;
* libopenal64.so&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The native libraries with the 64 at the end of the file-name are those needed for 64 Bit Linux and those without are for 32 Bit systems.&lt;br /&gt;
&lt;br /&gt;
You may also put the natives for Windows (.dll) and Mac (.dylib / .jnilib) to be platform independent.&lt;br /&gt;
&lt;br /&gt;
==Adding the code==&lt;br /&gt;
It is very important to add the following lines of code at the beginning of your &amp;quot;public static void main(String[] args)&amp;quot;-method because the libraries need to be loaded before you use them!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The first line of code you have to add is the one setting your &amp;quot;java.library.path&amp;quot;. This is the path where your libraries are. In our scenario the path of the libraries is &amp;quot;libs&amp;quot;. So our code will look like this:&lt;br /&gt;
 System.setProperty(&amp;quot;java.library.path&amp;quot;, &amp;quot;libs&amp;quot;);&lt;br /&gt;
This will tell java to use the relative path to the directory libs for loading the libraries. You may also use absolute paths here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The second and last line you have to add is the one saying lwjgl where the native libraries are.&lt;br /&gt;
 //Extracted from [http://www.lwjgl.org/wiki/index.php?title=Distributing_Your_LWJGL_Application Distributing Your LWJGL Application]&lt;br /&gt;
 System.setProperty(&amp;quot;org.lwjgl.librarypath&amp;quot;, new File(&amp;quot;libs/natives&amp;quot;).getAbsolutePath());&lt;br /&gt;
This line of code tells lwjgl that the native libraries are located in the directory with the relative path &amp;quot;libs/natives&amp;quot;.&lt;br /&gt;
The &amp;quot;File&amp;quot; used here is only for getting the absolute path to our natives directory because the parameter &amp;quot;org.lwjgl.librarypath&amp;quot; does only support absolute paths.&lt;br /&gt;
&lt;br /&gt;
==Finished sourcecode==&lt;br /&gt;
The following code shows how your source code should look like when you&amp;#039;re done with this tutorial:&lt;br /&gt;
 public static void main(String[] args) {&lt;br /&gt;
        System.setProperty(&amp;quot;java.library.path&amp;quot;, &amp;quot;libs&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
        //Extracted from [http://www.lwjgl.org/wiki/index.php?title=Distributing_Your_LWJGL_Application Distributing Your LWJGL Application]&lt;br /&gt;
        System.setProperty(&amp;quot;org.lwjgl.librarypath&amp;quot;, new File(&amp;quot;libs/natives&amp;quot;).getAbsolutePath());&lt;br /&gt;
 &lt;br /&gt;
        //Your sourcecode for starting the display&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	<entry>
		<id>http://slick.ninjacave.com/wiki/index.php?title=Game_Containers&amp;diff=568</id>
		<title>Game Containers</title>
		<link rel="alternate" type="text/html" href="http://slick.ninjacave.com/wiki/index.php?title=Game_Containers&amp;diff=568"/>
				<updated>2018-05-09T18:25:13Z</updated>
		
		<summary type="html">&lt;p&gt;Decerez: Undo revision 559 by Abc123456 (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The concept of containers isn&amp;#039;t a particularly new one, the container provides environment in which your application (in this case a game) can run. It provides that game with a set of facilities and expects the game to comply to a certain interface. This allows the container (sometimes called the framework) to handle most of the bits of code common between all games for you - leaving you to focus on the important game logic bits and pieces.&lt;br /&gt;
&lt;br /&gt;
== Basic Functionality ==&lt;br /&gt;
&lt;br /&gt;
In the case of Slick, the container holds a Game - that is the class that is contained must comply to the Game interface. To make things even easier Slick provides a basic abstract implementation of Game which you can simply extend, called BasicGame. When extending BasicGame you&amp;#039;ll need to implement 3 methods:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;init()&amp;#039;&amp;#039;&amp;#039; - This is called when the game starts and should be used to load resources and initialise the game state.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;render()&amp;#039;&amp;#039;&amp;#039; - This method is passed a graphics content which can be used to draw to the screen. All of your game&amp;#039;s rendering should take place in this method (or in methods called from this method)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;update()&amp;#039;&amp;#039;&amp;#039; - The method is called each game loop to cause your game to update it&amp;#039;s logic. So if you have a little guy flying across the screen this is where you should make him move. This is also where you should check input and change the state of the game.&lt;br /&gt;
&lt;br /&gt;
The GameContainer itself provides methods to control the properties of the game rendering and update. For instance, the game container is where you look for controlling what resolution the game runs at and whether it&amp;#039;s in fullscreen mode. It&amp;#039;s also responsible for maintaining the game timer and loop. There are a couple of implementations of GameContainer currently available (discussed below), however where possible you should rely on the GameContainer interface - apart from of course when constructing your container where you are making an explicit decision about how your game is to be displayed.&lt;br /&gt;
&lt;br /&gt;
While the Slick game container framework is useful it doesn&amp;#039;t suit everyone. It is intended that the features of Slick can be used outside of the framework as part of a generic LWJGL game.&lt;br /&gt;
&lt;br /&gt;
== Application Game Container ==&lt;br /&gt;
&lt;br /&gt;
The application game container is the most used, it&amp;#039;s intended to run your game stand alone or as a webstart. It uses a simple window to display the game and allows you to configure the display mode directly. It&amp;#039;s generally constructed in main and started with the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
try { &lt;br /&gt;
    AppGameContainer container = new AppGameContainer(new MyGame()); &lt;br /&gt;
    container.setDisplayMode(800,600,false); &lt;br /&gt;
    container.start(); &lt;br /&gt;
} catch (SlickException e) { &lt;br /&gt;
    e.printStackTrace(); &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Where the 800 and 600 specify the window resolution and the false (or true) specify whether the game should be run in fullscreen mode. Note how the container is created with an instance of the game implementation. In this way when you change containers the game itself does not need to be changed at all. This makes it very easy to make a demo version of your game available via a webpage while mainitaining the full version as a standalone application.&lt;br /&gt;
&lt;br /&gt;
== Applet Game Container ==&lt;br /&gt;
&lt;br /&gt;
The applet game container uses the recently added LWJGL Applet support to present the game as a Java Applet embedded into a webpage. This functionality is currently still being tested and developed. It is known to have issues running within Opera and on low end machines. Supporting an OpenGL context within a browser window is proving to be difficult to be make stable in all cases.&lt;br /&gt;
&lt;br /&gt;
However, for most people this is a great option and allows you deploy your game as an applet with the minimal of fuss. The Slick distribution provides the files required for applet distribution in the “applet” directory. To use your game in the applet you need to specify something similar to the following in the applet tag in the HTML:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    &amp;lt;applet code=&amp;quot;org.newdawn.slick.AppletGameContainer&amp;quot; archive=&amp;quot;slick.jar,testdata.jar,lwjgl_applet.jar,lwjgl.jar,lwjgl_util_applet.jar,natives.jar,jinput.jar&amp;quot; &lt;br /&gt;
            width=&amp;quot;640&amp;quot; height=&amp;quot;480&amp;quot;&amp;gt; &lt;br /&gt;
        &amp;lt;param name=&amp;quot;game&amp;quot; value=&amp;quot;org.newdawn.slick.tests.InputTest&amp;quot;&amp;gt; &lt;br /&gt;
    &amp;lt;/applet&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Where the game parameters is replaced with the fully qualified name of your Game class and the archive list contains all the jars you require signed with an appropriate certificate. See the webstart tutorial for details on how to produce a certificate and sign the the JARs correctly.&lt;br /&gt;
&lt;br /&gt;
== Future Game Containers ==&lt;br /&gt;
&lt;br /&gt;
There are currently no other containers in development, although there are plans for a container that uses a AWT Canvas to display the game. This would allow tools developers the ability to embedded the games (and application displays) into other GUIs, much like the Pedigree Particle Editor.&lt;br /&gt;
&lt;br /&gt;
Developing a game container is resonably simple by extending the standard GameContainer class and adding the part specific to the particular rendering context. If something about the game containers provided doesn&amp;#039;t fit with the way you usually write games it&amp;#039;s often easiest to simply create a new game container that does exactly what you want rather than attempt to fit in with existing implementations.&lt;br /&gt;
&lt;br /&gt;
[[Category:Graphics]]&lt;/div&gt;</summary>
		<author><name>Decerez</name></author>	</entry>

	</feed>