Hi there,
I’m playing around with SDL and am currently stuck.
package main
import kotlinx.cinterop.CPointer
import sdl.*
fun main(args: Array<String>) {
SDL_Init(SDL_INIT_VIDEO)
val window = SDL_CreateWindow("test", 10, 10, 800, 600, SDL_WINDOW_OPENGL)
val surface: CPointer<SDL_Surface>? = SDL_GetWindowSurface(window)
if (surface != null) {
// the error is there -v
SDL_FillRect(surface, null, SDL_MapRGB(surface.pointed.format, 255, 255, 255))
}
SDL_Delay(5000)
SDL_DestroyWindow(window)
SDL_Quit()
}
the compiler always quits with “unresolved reference: pointed” and I don’t understand why.
In the docs there is
val <T : CPointed> CPointer<T>.pointed : T
https://kotlinlang.org/api/latest/jvm/stdlib/kotlinx.cinterop/-c-pointer/index.html#extension-properties
and SDL_Surface is a subtype of CPointed.
What am I missing?