GabrielFrigo4 / SDL-Sharp

SDL2 for C#
Other
17 stars 3 forks source link

Return of SDL.CreateWindow can't be checked for null #40

Closed Shadowblitz16 closed 2 years ago

Shadowblitz16 commented 2 years ago

Return of SDL.CreateWindow can't be checked for null because it returns a struct which can't be null. Try returning a Window?

Shadowblitz16 commented 2 years ago

Looks like CreateRenderer and other method can't return null either

GabrielFrigo4 commented 2 years ago

Well, in fact, it can't be verified as 'null', but I think it can be verified as 'IntPtr.Zero', I'll take a look and see some tests and return with a more solid answer

Shadowblitz16 commented 2 years ago

@GabrielFrigo4 the problem is it returns a struct so if nullables as errors is on you can't

I would recommend returning a struct?

GabrielFrigo4 commented 2 years ago

Well, as far as I know Allowing these structures to be nullable may not work, so I added a method to these structures that returns true if the IntPtr or void* is null or false if not (var.IsNull)

Shadowblitz16 commented 2 years ago

ok ty.