diff --git a/bindings/sdl/libsdl/src/main/kotlin/libsdl/Constants.kt b/bindings/sdl/libsdl/src/main/kotlin/libsdl/Constants.kt deleted file mode 100644 index 89f05881..00000000 --- a/bindings/sdl/libsdl/src/main/kotlin/libsdl/Constants.kt +++ /dev/null @@ -1,16 +0,0 @@ -package libsdl - -const val SDL_INIT_TIMER: Int = 0x00000001 -const val SDL_INIT_AUDIO: Int = 0x00000010 -const val SDL_INIT_VIDEO: Int = 0x00000020 // SDL_INIT_VIDEO implies SDL_INIT_EVENTS -const val SDL_INIT_JOYSTICK: Int = 0x00000200 // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS -const val SDL_INIT_HAPTIC: Int = 0x00001000 -const val SDL_INIT_GAMECONTROLLER: Int = 0x00002000 // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK -const val SDL_INIT_EVENTS: Int = 0x00004000 -const val SDL_INIT_SENSOR: Int = 0x00008000 -const val SDL_INIT_NOPARACHUTE: Int = 0x00100000 // compatibility; this flag is ignored. - -val SDL_INIT_EVERYTHING: Int = SDL_INIT_TIMER or SDL_INIT_AUDIO or SDL_INIT_VIDEO or SDL_INIT_EVENTS or SDL_INIT_JOYSTICK or SDL_INIT_HAPTIC or SDL_INIT_GAMECONTROLLER or SDL_INIT_SENSOR - - -const val SDL_ALPHA_OPAQUE: Byte = 255.toByte() \ No newline at end of file diff --git a/bindings/sdl/libsdl/src/main/kotlin/snake/main.kt b/bindings/sdl/libsdl/src/main/kotlin/snake/main.kt index aa26f7a8..ac418f96 100644 --- a/bindings/sdl/libsdl/src/main/kotlin/snake/main.kt +++ b/bindings/sdl/libsdl/src/main/kotlin/snake/main.kt @@ -67,7 +67,7 @@ class SdlUI(width: Int, height: Int): AutoCloseable { private val pixelHeight = height * Sprites.h init { - if (libSDL2Library.SDL_Init(SDL_INIT_EVERYTHING) != 0) { + if (libSDL2Library.SDL_Init(SDL_INIT_EVERYTHING.toInt()) != 0) { println("SDL_Init Error: ${libSDL2Library.SDL_GetError()}") throw Error() } @@ -94,7 +94,7 @@ class SdlUI(width: Int, height: Int): AutoCloseable { fun draw(game: Game) { libSDL2Library.SDL_RenderClear(renderer) - libSDL2Library.SDL_SetRenderDrawColor(renderer, (200 / 2).toByte(), (230 / 2).toByte(), (151 / 2).toByte(), SDL_ALPHA_OPAQUE) + libSDL2Library.SDL_SetRenderDrawColor(renderer, (200 / 2).toByte(), (230 / 2).toByte(), (151 / 2).toByte(), SDL_ALPHA_OPAQUE.toByte()) val grassW = 256 val grassScaledW = 400 // scale grass up to reduce its resolution so that it's similar to snake sprites