Giter VIP home page Giter VIP logo

Comments (6)

player-03 avatar player-03 commented on July 22, 2024

Under the hood, it uses Capabilities.screenDPI, and I'm guessing that's the problem.

According to word of Joshua, Capabilities.screenDPI "roughly estimates the density you might want to apply to your UI," because "users with higher resolution screens may expect things to look smaller."

He also mentions that Display.dpi calculates it as accurately as possible, with no adjustments made after the fact.

from advanced-layout.

player-03 avatar player-03 commented on July 22, 2024

Just added an option to choose between the two: c860b19

from advanced-layout.

iffy avatar iffy commented on July 22, 2024

@player-03 wow, thank you! What version of lime do I need? I'm trying with openfl 8.4.1 and lime 7.0.0 and getting this error:

/Users/matt/lib/advanced-layout/com/player03/layout/Scale.hx:265: characters 46-57 : Class<lime.system.Display> has no field dpi

Here's everything:

$ haxelib list
actuate: [1.8.7]
advanced-layout: 0.7.0 [dev:/Users/matt/lib/advanced-layout]
box2d: [1.2.3]
haxeui-core: [0.0.4]
haxeui-openfl: [git]
haxeui: [1.8.21]
hscript: [2.2.0]
hxcpp: 3.4.188 [4.0.4]
layout: [1.2.1]
lime-samples: [6.2.0]
lime: 2.9.1 6.4.0 [7.0.0]
openfl-samples: [6.0.0]
openfl: 3.6.1 8.2.2 8.3.0 8.4.0 [8.4.1]
sqlite: [1.0.9]

from advanced-layout.

player-03 avatar player-03 commented on July 22, 2024

Oops! Somehow I didn't notice that the variable wasn't static. This should be fixed as of 6f5048d.

from advanced-layout.

iffy avatar iffy commented on July 22, 2024

I think I'm not calling screenDPI(...) correctly. Neither changing baseDPI nor smart seems to have any effect. Am I calling screenDPI(...) on the right instance in my code?

import layout.Layout;
...
Layout.stageLayout.scale.screenDPI(Std.int(Capabilities.screenDPI));

For reference, here's what I'm seeing:

screenDPI(144, false)
screendpi144_false

screenDPI(144, true)
screendpi144_true

screenDPI(72, false)
screendpi72_false

screenDPI(72, true)
screendpi72_true

from advanced-layout.

player-03 avatar player-03 commented on July 22, 2024

Layout.stageLayout.scale.screenDPI() is correct, but you definitely don't want to pass Capabilities.screenDPI as the first argument. Since it divides Capabilities.screenDPI by whatever baseDPI is, you'll end up with a scale of 1 no matter what. (Also, I just noticed that your original code does the same thing. Should have looked more closely!)

Any of your other four examples ought to work, or at least ought to have some effect. I mean, they worked for me when I added the following code to the end of DisplayingABitmap's Main class:

//Uncomment for a smaller bitmap:
//Layout.stageLayout.scale.screenDPI(144);

//Uncomment for a larger bitmap:
//Layout.stageLayout.scale.screenDPI(72);

bitmap.simpleScale();
bitmap.centerX();
bitmap.centerY();

from advanced-layout.

Related Issues (5)

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.