mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 06:24:06 +09:00
Turns out, <ImageBuffer>.image creates new Image instance which will NEVER be reclaimed (which causes OutOfMemoryError) unless manually destroy()ed. Former-commit-id: 34840cf63e52e5635ec8acd5fb1bb78923c61063 Former-commit-id: aca4388320fae022a4744f75c1b0f66b544bdafb
33 lines
970 B
Kotlin
33 lines
970 B
Kotlin
package net.torvald.terrarum.gameactors
|
|
|
|
import net.torvald.terrarum.Terrarum
|
|
import net.torvald.terrarum.gamecontroller.mouseX
|
|
import net.torvald.terrarum.gamecontroller.mouseY
|
|
import org.newdawn.slick.GameContainer
|
|
import org.newdawn.slick.Graphics
|
|
import org.newdawn.slick.Image
|
|
|
|
/**
|
|
* Created by minjaesong on 2017-01-07.
|
|
*/
|
|
class TapestryObject(image: Image, val artName: String, val artAuthor: String) : FixtureBase(physics = false) {
|
|
|
|
// physics = false only speeds up for ~2 frames with 50 tapestries
|
|
|
|
init {
|
|
image.filter = Image.FILTER_NEAREST
|
|
makeNewSprite(image.width, image.height, image)
|
|
setHitboxDimension(image.width, image.height, 0, 0)
|
|
setPosition(Terrarum.appgc.mouseX, Terrarum.appgc.mouseY)
|
|
// you CAN'T destroy the image
|
|
}
|
|
|
|
override fun update(gc: GameContainer, delta: Int) {
|
|
super.update(gc, delta)
|
|
}
|
|
|
|
override fun drawBody(g: Graphics) {
|
|
super.drawBody(g)
|
|
}
|
|
}
|