Slick Forums

Discuss the Slick 2D Library
It is currently Tue Nov 25, 2014 8:30 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Dec 17, 2012 1:05 pm 
Offline

Joined: Mon Dec 17, 2012 12:56 pm
Posts: 13
Greetings all,

For the last 18 months, I have been working on a awt Java2D RPG. Completely home grown engine, from scratch. I didn't think it would become that serious, but it has, and now (graphic) performance has started to become an issue.

I have looked over some of the code samples and tutorials etc... but have not found all the answers I need to convert yet.

If someone on here is kind enough to help me, I'd be very appreciative.

I used KeyEvent and MouseEvent from java awt/swing. Is there an easy way to convert those classes over to the input methods in Slick?
All of my graphics are in a sqlite database, and I use ImageIO to read the data in from blob fields directly on start up. Would I still be able to load my images directly into Slick from the database.
Is there a way to load an Slick Image from a BufferedImage? I could the canvas into different "viewports" and made my own little windowing system.
How do I lighten and darken an image in Slick?
How do I blend an image onto the canvas so it is like 50% translucent?
Does Slick2D play ogg files?

I know it's a lot of questions, but it is important I get the engine converted this week.

Much appreciated.


Top
 Profile  
 
PostPosted: Mon Dec 17, 2012 2:05 pm 
Offline
User avatar

Joined: Tue Jul 17, 2012 11:27 am
Posts: 67
To lighten an image you need OpenGL otherwise your contrast will decrease. Darken is easier, you can do this with setColor() and a grayscale.

I think ogg files work well because Slick uses OpenAl(?).

_________________
Open source isometric engine made with libGDX: http://wurfelengine.net


Top
 Profile  
 
PostPosted: Mon Dec 17, 2012 2:28 pm 
Offline

Joined: Mon Dec 17, 2012 12:56 pm
Posts: 13
Thanks for the info. I will take a look at that. I may have found something to do with lightening an image.


Top
 Profile  
 
PostPosted: Mon Dec 17, 2012 3:09 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Quote:
I used KeyEvent and MouseEvent from java awt/swing. Is there an easy way to convert those classes over to the input methods in Slick?

Probably not; but then again, refactoring a game to use a different library is never easy. You would probably have a better time restarting from scratch; it would also allow you to fix up your coding style and tailor your game exactly to Slick2D, rather than trying to force a Java2D-style down OpenGL's throat. ;)

Quote:
All of my graphics are in a sqlite database, and I use ImageIO to read the data in from blob fields directly on start up. Would I still be able to load my images directly into Slick from the database.

OpenGL games should use a texture atlas. Whether you decode your images on the fly into a large texture atlas at runtime, or whether you do something else to pack your textures together, you won't get very good performance without a texture atlas.

Quote:
Is there a way to load an Slick Image from a BufferedImage? I could the canvas into different "viewports" and made my own little windowing system.

Yes but you should not need to do this. Ideally, your Slick game should not have any dependencies on AWT. For offscreen rendering you should use Image.createOffscreenGraphics (part of the dev branch) and getGraphics().

Quote:
How do I lighten and darken an image in Slick?

With shaders or fixed-function glTexEnv described here:
https://github.com/mattdesl/lwjgl-basic ... &-Contrast (this is for LibGDX, but similar concepts apply)

Quote:
How do I blend an image onto the canvas so it is like 50% translucent?

Code:
image.draw(x, y, width, height, colorWithAlpha);


Quote:
Does Slick2D play ogg files?

Yes.


Top
 Profile  
 
PostPosted: Mon Dec 17, 2012 4:10 pm 
Offline

Joined: Mon Dec 17, 2012 12:56 pm
Posts: 13
Thanks for all your assistance.

I am definitely going to refactor the entire interface.

I had the game fairly well abstracted (except for the key/mouse bindings) and it is not going to be hard to refactor the BufferedImages out at all.

I have been looking at the Slick2D source code today, and it is very straightforward. I will be able to take a lot of what I did and just directly translate it into Slick.

I am glad to have found this library and this community.


Top
 Profile  
 
PostPosted: Tue Dec 18, 2012 12:24 am 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
If you are planning on refactoring completely, might I suggest LibGDX? Its better maintained than Slick (which is nowadays pretty much dead), uses newer OpenGL techniques, has better support for shaders, ports to Android/iOS/HTML5, and includes a stronger community of professionals. It's pretty much Slick's successor, and the only reason to continue using Slick (in my humble opinion) is if you are developing something simple and can't be arsed to learn some basic graphics programming concepts (matrices, textures, GL states, etc). :)

Good luck.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group