Slick Forums

Discuss the Slick 2D Library
It is currently Fri Nov 17, 2017 7:07 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Mon Apr 23, 2012 7:08 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
For example, I was trying to implement a fast way to password-mask characters in a TextField. Right now the only solution is to create a new String object every time the text changes, and fill it with the masking characters. It would be more efficient to implement a CharSequence that always returns the character (i.e. '*') for charAt, and varies in length(). Unfortunately, drawString expects a String, not a CharSequence.


Top
 Profile  
 
PostPosted: Mon Apr 23, 2012 8:41 pm 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
I don't see anyting bad about it, since it will not break compability with old projects it's even an improvement.

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Mon Apr 23, 2012 8:57 pm 
Offline
Regular
User avatar

Joined: Thu May 05, 2011 8:35 pm
Posts: 231
Location: Somewhere between the bits and bytes
Had a look at slicks code, doing this requires a rewrite of some key parts the font system, because the underlying functionality of drawString requires it to be a string.
For example, the fonts uses String specific methods such as toCharArray and substring.
But if that isn't a problem, then this would be a welcome addition.

_________________
For every new problem, a new source of solutions has come to exist.


Top
 Profile  
 
PostPosted: Mon Apr 23, 2012 10:22 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
Keep in mind that changing a method parameter from String to CharSequence is a source compatible but binary incompatible change (eg needs recompile). Like the LWJGL log() utility method.

_________________
TWL - The Themable Widget Library


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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