Defold, scale making sprites dissapear - sprite

I'm trying to scale my sprite, but it keeps dissapearing. I used go.set_scale(4) which makes it dissapear. There doesn't seem to be anything on the defold page and I have even tried using manuel scaling with the properties options. Why can't I scale the sprite?
Do I need to make them tiles? Those scale fine.

I'm betting that the game object/sprite isn't positioned at z-value 0 and when scaled 4 times it probably ends up outside the default -1 to 1 range that is visible in the render script: https://defold.com/manuals/components/#component-z-value

Related

Cbuilder XE3 scales (expands) form when edited in RAD IDE

I have some applications, but not all, that "magically" scale up forms by a factor of 1.23 when I open the forms in the RAD IDE. For example, a form width of 947 pixels suddenly jumps to 1166 pixels. It is suspiciously-close to a pixel ratio of 120/96 (a ratio of 1.25), but the scaling is consistently closer to 1.23 (as judged by larger integer ratios derived from, for example, the form width and height).
I can look at the .dfm file and see the original numbers, whereas in the IDE, the values have been altered (e.g. height and width expanded, control positions adjusted, and font sizes increased).
I know that scaling and dpi is a minefield, but I've not (to my knowledge) changed any related settings.
For both the affect and non-affected projects, forms have the Scaled property set to "true" and the PixelsPerInch property is set to 96. My development machine has its screen resolution set to 100%. This is the setup that is supposed to avoid these issues.
I have searched through the project and IDE configuration files in a fruitless effort to find out what might be different about a project that has this issue, vs one that does not.
The affected (and unaffected) projects are all ones that have been in development for years - it is only in the last week that I have observed this behaviour. To my knowledge (I am sole developer), I have not made any code/configuration changes that relate to scaling, dpi, etc.
Does anyone have any idea what might be happening?
Although I am using CBuilder XE3, I've tagged this question with Delphi XE3 as well since I'm thinking that this is a RAD Studio issue.
EDIT 1: I've also noticed that for each modified control, the IDE throws in the following additional lines (i.e. in addition to modifying Top, Left, Width, Height, and Font.Height):
Margins.Left = 4
Margins.Top = 4
Margins.Right = 4
Margins.Bottom = 4
and for TImages, it also adds
ExplicitWidth = <nnn>
ExplicitHeight = <nnn>
EDIT 2: Curiously, when the IDE scales the form it does not flag the form as modified - i.e. the form appears unmodified until a "real" change is made (for example, repositioning a control). If the form is opened a second time after saving with the modified scale, no further scaling occurs - it seems to be a one-time effect, but there does not seem to be a "unasked-for-scaling-accomplished" flag in any configuration file :)

LWUIT Container Style, importing from resource editor

I'm building a Container using code and now I want to set the Styleusing one UnselectedStyle from the Resource Editor.
I'm doing this because, I don't find the way to add a LinearBackground color and a RoundBorder to my Container. When I put the two properties to the Style, the background color has gone.
So I finally add this Style using the UIManager.getInstance().addThemeProps(String name ThemeFromResource); and later the setUIID(String nameStyle). Is working fine...my Containergets the Style, but the app lose the navigation, the back Commandhas gone.
How can do this? I would like to do with my first way...creating the lineargradient and the border and adding it to the style, but I don't find the way.
I would strongly suggest against doing that.
Border's override other forms of background, round border tries to respect some of them but is REALLY inefficient about that. It effectively draws the background on a mutable image then draws the round border on another mutable image, gets the RGB for both and performs a NOT operation to crop the background into a round image. This (as you might understand) is REALLY expensive in terms of performance, while the image is then cached it is still expensive in the longer term.
You should use image borders which are MUCH faster.

google maps: hide labels on the fly + infoBubble masive use + background for streetview panorama,

I am using the google maps and place around 800 markers from a db...
Now I have several question for the fine tuning of that map...
http://camodesign.de/stickermap/geomap.php
I am using a styled map - now I'd like to apply a button to hide/show the labels for streets etc... but when I set a style via "map.setOptions({styles: MyStylesArrayShowLabel});" that kills all my markers that have a already been placed. Is there a way to set the style on the fly without destroying the markers?
I have set a background for the map via "mapOptions" to avoid those ugly grey tiles. Is there a way to do this for the streetview pano too?
I had set a full screen panorama of 100% width and height but the streetview seems only
to use 60% even when the rest of the screen show grey. Here I don't really have a clue - is it a bug just on my browser?
(+) was trying to use the info bubble instead of the info window for more style
possibilities but the script was hanging and working too long.. after minutes it put out the result correct... seems the bubble had some problems on massive marker use?
had any one similar experiences with it?
Glad for any other suggestions?
(all markers [excluded the home marker/infowindow] are generated from a db via SQL and PHP)

how can one resize portions of a css-sprite?

I'd like to improve upon jQuery's dialog code by using CSS-sprites, and thus also add animations of the dialog borders.
To do this, i'd like all the artwork to be in 1 png file, a css sprite.
My problem is that in order to support a dialog that maximizes to 2 or 3 monitors, i think i'd have to put 5000px wide / high border graphics in the css sprite file. Because i can't find a way to resize a selected portion of a css sprite image.
Basically i want to resize from the sprite image a region (t,l,w,h) to a DIV or IMG on my page with a different width and height.
I'd like to know, is this even possible? It seems background-position does not support this at all.
I've tried the first solution in How can I scale an image in a CSS sprite, but could not get it to work using that.
I've tried using the new background-size property in conjunction with background-position, but that also does not produce the results i want.
Spent another few hours twiddling with css, but could not get sprites to work for dialogs.
But my animated dialogs don't need many frames (not unless you want to put actual video as a dialog backdrop online), so for the dialog theme i'm designing now i have 8 312x312 png's as frames, 8 requests, 386kb total. Just enough to create a glowing animation for when the dialog is in a "highlighted" state. It's do-able.
I'm using the technique from How can I scale an image in a CSS sprite
See http://mediabeez.ws in about a month for the opensource release of animated dialogs.
I will be developing and testing this standalone component when it's used by my own homegrown CMS, so it will have the ability do be themed, dragged and dropped, things like that.

More iPhone 4 resolution scaling fun

So I have two images set to fill the screen - one at 320x480 (iPhone 3) and the other at 640x960 (iPhone 4).
img.png (320x480)
img#2x.png (640x960)
In Interface Builder, I have img.png set to fill the view (it shouldn't be filling the iPhone 4 view, though, right?), and when I build and run, it is notably too small.
So, when I do the opposite, setting img#2x.png as the img, a giant blue question mark fills the view. The project still builds and the image fills the screen, but is very pixelated as if it has been rescaled. It shouldn't have been rescaled, though, as it is the higher resolution.
Now using...
img.png (640x960)
img#2x.png (320x480)
I've also tried switching which file takes the #2x suffix, but that has not helped either. With the smaller file taking the #2x suffix, and setting the image view to img.png, it shows up way larger than the view canvas, but way too small when on the phone. With the smaller file still having the #2x suffix, I tried switching the view to the new img#2x.png and once again got the oversized, pixelated question mark in IB and a low res full-screen image when deployed to the phone.
I also made sure that my view size was set to 640x960 in the size inspector. What else should I be doing?
Don't use #2x when specifying the image name. Just use the base name of the image (so in your case, just img). iOS will do the magic behind the scenes to use the 2x version if it's on a retina display and the regular version otherwise (including when you use a xib to lay out your interface).
The displayed dimensions of the image will always be the dimensions of the non-2x image. The retina display just displays 2 pixels for every 1 which is why the scale is 2.0 and you have to double the dimensions of the original image. So your view size in IB should be 320x480.
Edit
If IB is being finicky, especially in Xcode 4, just try deleting the xib and starting over. Sometimes it gets a bit corrupted and doesn't know what to do with itself. I've had to do this on one or two occasions, and it seems that it worked for the OP as well.

Resources