Slick Forums

Discuss the Slick 2D Library
It is currently Wed May 22, 2013 11:58 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat May 23, 2009 11:37 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
I'd like to request added features, more methods in the Graphics.

The methods I'd like to see are being able to draw or fill by a specified alignment.

Consider:
g.fillRect(x,y,width,height)

draws from x,y and x+width towards y+height. It is vertically-aligned at top and horizontally-aligned to the left.


But sometimes you want to be able to draw in more ways than that, without the added complexities of calculating the alignment.

Instead there could be a Alignment enum containing all the alignment possible to draw with:

Alignment.Default = Alignment.TopLeft
Alignment.TopCenter
Alignment.TopRight
Alignment.MiddleRight
Alignment.BottomRight
Alignment.BottomCenter
Alignment.BottomLeft
Alignment.MiddleLeft



An example: Imagine a health-bar that starts from bottom-center, and not left-top as it usually does.

g.fillRect(200,200,4,100, Alignment.BottomCenter) // at 100% health
g.fillRect(200,200,4,50, Alignment.BottomCenter) // at 50% health

the same as:

g.fillRect(198,100,4,100) // at 100% health
g.fillRect(198,150,4,50) // at 50% health



Just for added convenience.


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 24, 2009 11:52 am 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Graphics was only really made available for Graphics2D compatibility with Java 2D. This sorta thing sounds better suited to some higher level UI lib?

Kev


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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