Karl Zylinski vor 1 Monat
Ursprung
Commit
b009becd96
2 geänderte Dateien mit 18 neuen und 6 gelöschten Zeilen
  1. 11 3
      karl2d.doc.odin
  2. 7 3
      karl2d.odin

+ 11 - 3
karl2d.doc.odin

@@ -160,8 +160,16 @@ create_texture :: proc(width: int, height: int, format: Pixel_Format) -> Texture
 // The `options` parameter can be used to specify things things such as premultiplication of alpha.
 load_texture_from_file :: proc(filename: string, options: Load_Texture_Options = {}) -> Texture
 
-// TODO should we have an error here or rely on check the handle of the texture?
-load_texture_from_bytes :: proc(bytes: []u8, width: int, height: int, format: Pixel_Format) -> Texture
+// Load a texture from a byte slice and upload it to the GPU so you can draw it to the screen.
+// Supports PNG, BMP, TGA and baseline PNG. Note that progressive PNG files are not supported!
+//
+// The `options` parameter can be used to specify things things such as premultiplication of alpha.
+load_texture_from_bytes :: proc(bytes: []u8, options: Load_Texture_Options = {}) -> Texture
+
+// Load raw texture data. You need to specify the data, size and format of the texture yourself.
+// This assumes that there is no header in the data. If your data has a header (you read the data
+// from a file on disk), then please use `load_texture_from_bytes` instead.
+load_texture_from_bytes_raw :: proc(bytes: []u8, width: int, height: int, format: Pixel_Format) -> Texture
 
 // Get a rectangle that spans the whole texture. Coordinates will be (x, y) = (0, 0) and size
 // (w, h) = (texture_width, texture_height)
@@ -585,7 +593,7 @@ Keyboard_Key :: enum {
 	Left_Bracket    = 91,
 	Backslash       = 92,
 	Right_Bracket   = 93,
-	Grave_Accent    = 96,
+	Backtick        = 96,
 
 	// Function keys, modifiers, caret control etc
 	Space           = 32,

+ 7 - 3
karl2d.odin

@@ -800,8 +800,10 @@ load_texture_from_file :: proc(filename: string, options: Load_Texture_Options =
 	}
 }
 
-
-// TODO should we have an error here or rely on check the handle of the texture?
+// Load a texture from a byte slice and upload it to the GPU so you can draw it to the screen.
+// Supports PNG, BMP, TGA and baseline PNG. Note that progressive PNG files are not supported!
+//
+// The `options` parameter can be used to specify things things such as premultiplication of alpha.
 load_texture_from_bytes :: proc(bytes: []u8, options: Load_Texture_Options = {}) -> Texture {
 	load_options := image.Options {
 		.alpha_add_if_missing,
@@ -821,7 +823,9 @@ load_texture_from_bytes :: proc(bytes: []u8, options: Load_Texture_Options = {})
 	return load_texture_from_bytes_raw(img.pixels.buf[:], img.width, img.height, .RGBA_8_Norm)
 }
 
-// TODO should we have an error here or rely on check the handle of the texture?
+// Load raw texture data. You need to specify the data, size and format of the texture yourself.
+// This assumes that there is no header in the data. If your data has a header (you read the data
+// from a file on disk), then please use `load_texture_from_bytes` instead.
 load_texture_from_bytes_raw :: proc(bytes: []u8, width: int, height: int, format: Pixel_Format) -> Texture {
 	backend_tex := rb.load_texture(bytes[:], width, height, format)