Comments (34)
resize() is what you should be using. Adjusting width and height directly will not cause the 9slice asset to resize itself correctly.
What errors are you getting? And can you post a gist?
from flixel-ui.
at the moment the build looks broken from the latest commits . there is an issue on flixel side, but there might be some flixel ui things too:
https://gist.github.com/gltovar/6705065
when the build is fixed I can get into is some more =] I wanted to see if the latest changes fixed it
from flixel-ui.
I'm in the process of getting a pull request accepted to flixel:
HaxeFlixel/flixel#647
Maybe switch to my flixel fork's dev branch temporarily until it goes through?
I've just updated flixel-ui's dev branch with my latest stuff.
from flixel-ui.
sure i'll do that one, one sec.
from flixel-ui.
https://gist.github.com/gltovar/6705447
so here is the basics looks like any resizing of a button is causing an issue:
at the most basic level, say you create a XML button:
button id="btn0" use_def="button" x="0" y="-5" label="$START_GAME" width="300" height="200"
(had to remove the xml i pasted here, but its just a standard button using the button blue skin)
this is causing an error on FlxSprite line 618 the frame (FlxFrame) object is null. If I add a few null checks up the line, then the item is rendered improperly (not resized at all) Im going to double check this now, just to make sure the latest updates didn't fix it.
from flixel-ui.
Interesting. Let me know if it's still broken in latest updates, then I'll try to repro.
from flixel-ui.
I assume this is flash target? or CPP?
from flixel-ui.
flash at the moment, haven't tried a cpp target yet
from flixel-ui.
what's your "button" definition, if I may ask? Is it custom or are you using an included definition?
from flixel-ui.
oh, but even before using the xml, I was just manually doing a: this.loadGraphicSlice9( ["assets/gfx/ui/buttons/button_blue.png"], 18, 18, ["6,6,11,11"] ); on a button and it also causes the error.
I was planning on calling resize(w,h) afterwards or setting the values in the loadGraphicSlice9 and adding the source values.
here is a gist of the xml i am using: https://gist.github.com/gltovar/6705563 its a near copy of one of the examples in the RPG interface.
from flixel-ui.
okay thanks. And confirmed the latest updates don't fix it?
from flixel-ui.
doesn't look like it.
im getting that error on your flixel branch (after updating FlxAnimationController line 507 to remove gotoandstop reference to a frameindex)
from flixel-ui.
if I do a null check for frame on line 618 on flxsprite this is what it renders out http://screencast.com/t/llc2l4An9ah7
from flixel-ui.
Thanks for bearing with me. I'm trying to repro now.
from flixel-ui.
Okay, think I've repro'd. Let's narrow this thing down.
from flixel-ui.
i was thinking this part of flxSprite::LoadGraphic() might be the issue:
if (!Std.is(Graphic, TextureRegion))
{
region = new Region(0, 0, Width, Height);
region.width = cachedGraphics.bitmap.width;
region.height = cachedGraphics.bitmap.height;
}
because in the future updateFrameData() might have the wrong parameters for the region
{
framesData = cachedGraphics.tilesheet.getSpriteSheetFrames(region, null);
}
frame = framesData.frames[0];
but i don't pin down what is going wrong there
from flixel-ui.
good thoughts, might be related to the recent refactoring in flixel animation system!
from flixel-ui.
what's strange is the RPG Interface in flixel-demos still seems to compile just fine. Does that work for you?
from flixel-ui.
it compiles, but breaks when i click on save or battle. but at the moment I'm trying to make sure I have the latest flixel-demos in my libs... its taking its sweet time
What im looking for in the demos is for a button that isn't the default width/height of 80 by 20
from flixel-ui.
ok with the latest demo code i can see the rpg interface working again. I'll look at the button code to see if I can see differences
from flixel-ui.
I might have started to find your error but I'll have to finish investigating tomorrow. Let me know what you find.
from flixel-ui.
so in toying around i found that if i change the save menu's button size (big_button_blue) in the xml. Looks like when the bounds (at least hight wise) gets bigger or equal than the original image size (54px in this case) the error gets hit. So the slightly larger buttons in the save menu are just being scaled to 34px but if you change it to 54 or bigger then its breaks (53 works)
So i think there is some merit to the region, and where ever the size of a sprite is kept being an issue but haven't quite find the root cause just yet.
from flixel-ui.
I noticed that line 288 of FlxUITyped Button has this:
if(all.height > H){
but i think it should see if src_h should be taken into account if its set, right? (going to try it, but not sure if i'm interpreting src_w and src_h correctly
from flixel-ui.
nice i think that was the problem:
http://screencast.com/t/wmBwNJl3TE
(dont mind the unlocalized vars, I skipped the main menu and jumped straight into the save screen for debugging, so firetongue never got inited)
on line 288 i changed it to:
if( (_src_h != -1 && all.height > _src_h) || all.height > H){
from flixel-ui.
ok so now setting the buttons size in the xml is fixed i just tried doing it manually though code:
this.loadGraphicSlice9( ["assets/gfx/ui/buttons/button_blue.png"], p_width, p_height, ["6,6,11,11"], 18, 18 );
http://screencast.com/t/2Zw9EY7MoWt and here is the result
So im going to hunt down why it isn't setting the proper height (it should take up the whole bottom right corner. looks like its defaulting to the standard button height.
from flixel-ui.
Thanks so much for looking into this for me, I've been kind of busy the
last few days!
On Thu, Sep 26, 2013 at 6:24 PM, gltovar [email protected] wrote:
ok so now setting the buttons size in the xml is fixed i just tried doing
it manually though code:
this.loadGraphicSlice9( ["assets/gfx/ui/buttons/button_blue.png"],
p_width, p_height, ["6,6,11,11"], 18, 18 );http://screencast.com/t/2Zw9EY7MoWt and here is the result
So im going to hunt down why it isn't setting the proper height (it should
take up the whole bottom right corner. looks like its defaulting to the
standard button height.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/19#issuecomment-25211987
.
www.fortressofdoors.com -- Games, Art, Design
from flixel-ui.
Open source collaboration for the win! Great work gltovar.
from flixel-ui.
Okay, so line 288 looks like I might have a logic error. What it's supposed to do is look at the asset and determine whether it looks like a stacked asset with multiple frames, or is just one frame. To do that, it checks if the object's height (all.height) is greater than the target button frame height (H).
However, this fails to account for the fact that we're 9-slice-scaling, which means the source asset is probably going to be pretty dang small. So if the standard source rectangle is, say, 10x10, and I want a button that's 300x300, 30 < 300 and the algorithm will guess wrong.
Checking vs. the source width and height should work correctly, however.
So.... I might have to just stop trying to be smart here, and demand that the user supply metadata if they're using a 9-slice asset.
from flixel-ui.
I think I can have my cake and eat it too!
So, from now on, if you only have one asset provided, it throws an error if src_w and src_h aren't defined as that's an ambiguous situation.
HOWEVER, during the loading phase, Flixel-UI does have enough information to know what to do. It knows when you're using an "all" asset, so it can calculate the proper src_w and src_h at that time and pass it along, if the user hasn't supplied his/her own values.
from flixel-ui.
Working on some patches. Hopefully this will fix some things.
from flixel-ui.
Okay, think I've fixed it. RPG Interface is working again, and I've fixed the offending line of code. Hopefully this fixes your issues (and artifacts) without causing new problems....
Please confirm whether this is fixed for you and I'll close this issue.
from flixel-ui.
sure thing i'll check it out shortly. thanks =]
from flixel-ui.
It is looking good =] thanks so much
the last part of the issue i was having was using the method incorrecly because of a glitch in the code hinting in sublime text: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=14227 it was masking some of the actually parameters because it was thinking the commas in the string literal for the slicing were satisfying other parameters
leading to this:
this.loadGraphicSlice9( ["assets/gfx/ui/buttons/button_blue.png"], p_width, p_height, ["6,6,11,11"],18, 18 );
instead of this:
this.loadGraphicSlice9( ["assets/gfx/ui/buttons/button_blue.png"], p_width, p_height, ["6,6,11,11"],FlxUI9SliceSprite.TILE_NONE,-1,false, 18, 18 );
and one of the 18's was being used for tile mode or maybe ratio. (i think)
I am glad to have helped fix this issue, and thanks again so much for the help!
from flixel-ui.
Cool, let's close this!
from flixel-ui.
Related Issues (20)
- FlxInputText on JS crashes with when trying to make text go multiline HOT 4
- FlxUITabMenu not working HOT 2
- Unable to backspace last character on JS target in FlxInputText and FlxUIInputText HOT 1
- XML Issues HOT 7
- Suggestion: XML Schema for UI format
- FlxUICursor: Potential typo warning from Haxe
- Potential typo detected (expected similar values are flixel.addons.ui.SortMethod.ID)
- FlxInputText is not getting focus HOT 2
- Space doesn't work on FlxInputText in html5 HOT 4
- FlxInputText caret does not got below first line
- idk what is this but is from psych engine 0.7.1h source code compile HOT 1
- Chromium browsers on Android only shows numeric input
- FlxUIButton creates incrementally larger graphic keys
- FlxSlider / FlxUISlider hitbox issue HOT 1
- QUESTION: Haxe Version HOT 2
- [BUG] FlxUIDropDownMenu not working correctly HOT 7
- Missing documentation on FlxUICheckBox's and FlxUITabMenu's "new" functions.
- How to make an slider? HOT 5
- Better errors when using flixel-addons classes
- Rendering artifacts are shown when an flxsprite's angle is not 0 or 180 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flixel-ui.