Partially load this texture from platform-specific features

This method should fill width, height and pixels.

Property definitions

gamnit $ TextureAsset :: load_from_platform
	# Partially load this texture from platform-specific features
	#
	# This method should fill `width`, `height` and `pixels`.
	private fun load_from_platform is abstract
lib/gamnit/textures.nit:330,2--333,43

gamnit :: display_linux $ TextureAsset :: load_from_platform
	redef fun load_from_platform
	do
		var path = "assets" / path

		var surface = new SDLSurface.load(path.to_cstring)
		if surface.address_is_null then
			error = new Error("Failed to load texture at '{path}'")
			return
		end

		self.width = surface.w.to_f
		self.height = surface.h.to_f
		var format = if surface.format.amask > 0u32 then gl_RGBA else gl_RGB
		var pixels = surface.pixels

		load_from_pixels(pixels, surface.w, surface.h, format)

		surface.free
	end
lib/gamnit/display_linux.nit:126,2--144,4

gamnit :: display_ios $ TextureAsset :: load_from_platform
	redef fun load_from_platform
	do
		var error = glGetError
		assert error == gl_NO_ERROR else print_error error

		# Find file
		var ns_path = ("assets"/path).to_nsstring
		var path_in_bundle = asset_path(ns_path)
		if path_in_bundle.address_is_null then
			self.error = new Error("Texture at '{path}' not found")
			return
		end

		# Load texture
		var glk_texture = glkit_load(path_in_bundle, premultiply_alpha)
		if glk_texture.address_is_null then
			self.error = new Error("Failed to load texture at '{self.path}'")
			return
		end

		gl_texture = glk_texture.name
		width = glk_texture.width.to_f
		height = glk_texture.height.to_f
		loaded = true

		error = glGetError
		assert error == gl_NO_ERROR
	end
lib/gamnit/display_ios.nit:52,2--79,4