Code Monkey home page Code Monkey logo

Comments (34)

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

sure i'll do that one, one sec.

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

Interesting. Let me know if it's still broken in latest updates, then I'll try to repro.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

I assume this is flash target? or CPP?

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

flash at the moment, haven't tried a cpp target yet

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

what's your "button" definition, if I may ask? Is it custom or are you using an included definition?

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

okay thanks. And confirmed the latest updates don't fix it?

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

Thanks for bearing with me. I'm trying to repro now.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

Okay, think I've repro'd. Let's narrow this thing down.

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

good thoughts, might be related to the recent refactoring in flixel animation system!

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

what's strange is the RPG Interface in flixel-demos still seems to compile just fine. Does that work for you?

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

gamedevsam avatar gamedevsam commented on August 18, 2024

Open source collaboration for the win! Great work gltovar.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

Working on some patches. Hopefully this will fix some things.

from flixel-ui.

larsiusprime avatar larsiusprime commented on August 18, 2024

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.

gltovar avatar gltovar commented on August 18, 2024

sure thing i'll check it out shortly. thanks =]

from flixel-ui.

gltovar avatar gltovar commented on August 18, 2024

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.

larsiusprime avatar larsiusprime commented on August 18, 2024

Cool, let's close this!

from flixel-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.