[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - ResizableFrame question

Slick Forums

Discuss the Slick 2D Library
It is currently Mon Aug 02, 2021 3:33 am

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: ResizableFrame question
PostPosted: Mon Jun 17, 2013 12:16 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32
Hi

I'm looking to do something similar to the ResizableFrame, I have been looking at the ResizableFrame code but I have some questions.

I couldn't see any paint methods, how is this drawn? (I must be missing something simple here)

When drawing a frame you need to provide images for the top, bottom, left, right, 4 corners, I couldn't see any methods to override any of these programatically. How can I override any of these so I can set them manually?

Thanks

abcdef


Top
 Profile  
 
PostPosted: Mon Jun 17, 2013 7:05 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
The images are defined by the theme.


Top
 Profile  
 
PostPosted: Mon Jun 17, 2013 7:46 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32
Whats the format in the xml? (I've looked at some of the samples but its not clear what the general rule is)

also where in the class itself is the painting done? I want to create a class similar to ResizableFrame and do some things with the border graphics but I can't see where I can control this.


Top
 Profile  
 
PostPosted: Tue Jun 18, 2013 6:23 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
You can see an example for ResizableFrame in the TWLExamples repositories - the chat example and simple.xml both use it.

Painting is generally done in Widget.paintBackground - which just draws the background image over the whole widget. The theme engine does the rest. The background image is typically a 9-split image (the 4 corner, 4 edges and center) but any kind of construction can be used.


Top
 Profile  
 
PostPosted: Tue Jun 18, 2013 8:30 am 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32


Top
 Profile  
 
PostPosted: Tue Jun 18, 2013 5:30 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
The names references by alias are all defined inside <images> sections (except for "none" which means no image) - eg <area> elements.

For performance it would be better to combine your PNGs into one.


Top
 Profile  
 
PostPosted: Tue Jun 18, 2013 5:51 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32


Top
 Profile  
 
PostPosted: Tue Jun 18, 2013 8:55 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 7:31 am 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32
Ah :D

Bit of Eureka moment, have been looking at ImageManager and I think I understand more or less what is going on now to create the GridImage and thus how all the borders are created for everything

I'm thinking I might extend your code to be able to create a GridImage from individual files (making it configurable in xml) and to also be able to add textures (by providing the byte buffer directly) manually to the LWJGLCacheContext so I can include images from a binary data file (example like a quake pak file) and still reference them in the xml


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 1:04 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32
Part one is complete, but done slightly different to what I said above. I have made it so that you can add any decoder in the theme xml for images. I have plugged in some other formats and it works fine. I created a PNG version (as I had to move the code) to be backwards compatible and its the default decoder if one isn't specified.

By doing it this way you can essentially write anything for the filename and interpret at will in the decoders.

Next step is to now use this functionality and to create a new tag in the theme xml file so that you can specify 9 attributes for building a GridImage manually


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 4:00 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32
Part two done now too, created a new top level item in theme, also made a special decoder just for this to set the texture to a plain color. Am now able to set all of the 8 borders + background separately using any decoder of choice.

One issue still to solve is that if the border is bigger than what you want to draw it, it defaults to border size not the size you want


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 5:12 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
You could already plug in your own decoders, and you can assemble as many PNGs as you want - and all that without changing a single line of code.


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 6:04 pm 
Offline

Joined: Tue Oct 11, 2011 7:30 pm
Posts: 32


Top
 Profile  
 
PostPosted: Wed Jun 19, 2013 7:18 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
Just use a URLStreamHandler - you can take a look at the TWL Theme Editor - it uses this to access the DOM in memory without creating a file.

You can use the query part of the file name to pass anything you want to your URLStreamHandler.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 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:  
cron
Powered by phpBB® Forum Software © phpBB Group