Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Auf Cursor-Position zoomen / Zoom to cursor position

  • #1, by thomas-frings 4 years ago Zitieren
    Ist es möglich mit dem Shader-Zoom auf den Mauscursor zu zoomen? Über Lua ist es möglich auf eine Person zu zoomen, aber nicht auf den Cursor. Liege ich damit falsch?

    Is it possible to zoom to the mouse cursor with the shader zoom? Via Lua it is possible to zoom on a person, but not on the cursor.
  • #2, by SimonS 4 years ago Zitieren
    Wenn man das macht muss man einige Randbedingungen abwälzen.
    Aber man kann sich da einfach an der shaderZoomObject orientieren:

    local c_scale = 2.0
    local c_position=getCursorPos()
    local c_scroll=game.ScrollPosition
    c_position.x=c_position.x-c_scroll.x
    c_position.y=c_position.y-c_scroll.y
    c_position.x=c_position.x-(c_res.x/c_scale/2)
    c_position.y=c_position.y-(c_res.y/c_scale/1.2)
    c_position.x = math.min(math.max(0,c_position.x), game.CurrentScene.Sprite:getSize().x - c_res.x/c_scale)
    c_position.y = math.min(math.max(0,c_position.y), game.CurrentScene.Sprite:getSize().y - c_res.y/c_scale)
    shaderViewport(c_scale, c_position.x, c_position.y, 0, 2000, easeQuadInOut)