Flippin' eck

This commit is contained in:
minjaesong
2021-12-13 23:22:17 +09:00
parent 83f78edc2a
commit 254bf814a9
28 changed files with 171 additions and 87 deletions

View File

@@ -326,6 +326,27 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
batch?.projectionMatrix = camera?.combined
}
/**
* Vertically flipped version of [FrameBuffer.inAction]
*/
inline fun FrameBuffer.inActionF(camera: OrthographicCamera?, batch: SpriteBatch?, action: (FrameBuffer) -> Unit) {
//this.begin()
FrameBufferManager.begin(this)
camera?.setToOrtho(false, this.width.toFloat(), this.height.toFloat())
camera?.position?.set((this.width / 2f).round(), (this.height / 2f).round(), 0f) // TODO floor? ceil? round?
camera?.update()
batch?.projectionMatrix = camera?.combined
action(this)
//this.end()
FrameBufferManager.end()
camera?.setToOrtho(true, App.scr.wf, App.scr.hf)
camera?.update()
batch?.projectionMatrix = camera?.combined
}
infix fun Color.mul(other: Color): Color = this.cpy().mul(other)