Giter Club home page Giter Club logo

Comments (2)

soywiz avatar soywiz commented on June 12, 2024 1

I believe we might have like a boolean in the RenderContext providing a smoothing,
and then make the one from the view also nullable Boolean.

Then at each view we can do something like view.smoothing ?: context.smoothing to determine how to render it.

In any case, if you are making a pixel art game, have you considered having a PixelatedScene with a lower resolution, so it is pixel perfect, and then let the engine scale it? If you are doing pixel perfect, smoothing might work for you?

BTW: That circle looks like blurred when smoothed, but that's a separate issue, probably related to SDFs and retina. Probably this #2116

from korge.

davjhan avatar davjhan commented on June 12, 2024

RE: PixelatedScene

I didn't know this was a thing! I just tried it, and here's what it looks like to render on a virtualSize 1/4 the windowSize:

suspend fun main() = Korge(
    virtualSize = Size(128, 128),
    windowSize = Size(512, 512),
    backgroundColor = Colors["#ffffff"]
) {
	val sceneContainer = sceneContainer()
	sceneContainer.changeTo({ MyScene() })
}

class MyScene : PixelatedScene(
    sceneWidth = 128,
    sceneHeight = 128,
) {
	override suspend fun SContainer.sceneMain() {
            circle(30, fill = Colors.BLUE)
	}
}

Screenshot 2024-02-02 at 3 03 22 PM

As you can see, there still is anti-aliasing applied near the curves of the circle. Some devs may like this look, but if one wants to turn it off, they'll have to do set the antialiased = false on each view, much like with smothing. Ideally, this is also a a configurable setting on PixelScene.

circle(30, fill = Colors.BLUE){
    antialiased = false
}

Screenshot 2024-02-02 at 3 09 00 PM


Regardless, I think this feature request still stands, as some developers may prefer the visual style where all sprites are pixel graphics, but positions can be floats, and pixels can be rotated (e.g. Terraria or Vampire Survivors)

from korge.

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.