Struct tidy

This commit is contained in:
Martin White 2020-07-26 21:16:54 +01:00
parent 93e058eaa0
commit a359196348
Signed by: mart
GPG Key ID: 8B70828450F0EE0D

View File

@ -141,22 +141,6 @@ namespace Raylib {
float height; float height;
} }
// // Texture2D type
// // NOTE: Data stored in GPU memory
// typedef struct Texture2D {
// unsigned int id; // OpenGL texture id
// int width; // Texture base width
// int height; // Texture base height
// int mipmaps; // Mipmap levels, 1 by default
// int format; // Data format (PixelFormat type)
// } Texture2D;
// // Texture type, same as Texture2D
// typedef Texture2D Texture;
// // TextureCubemap type, actually, same as Texture2D
// typedef Texture2D TextureCubemap;
// // RenderTexture2D type, for texture rendering // // RenderTexture2D type, for texture rendering
// typedef struct RenderTexture2D { // typedef struct RenderTexture2D {
// unsigned int id; // OpenGL Framebuffer Object (FBO) id // unsigned int id; // OpenGL Framebuffer Object (FBO) id
@ -388,21 +372,21 @@ namespace Raylib {
[Flags] [Flags]
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "", has_type_id = false)]
public enum ConfigFlag { public enum ConfigFlag {
FLAG_RESERVED , //= 1, // Reserved FLAG_RESERVED, // Reserved
FLAG_FULLSCREEN_MODE , //= 2, // Set to run program in fullscreen FLAG_FULLSCREEN_MODE, // Set to run program in fullscreen
FLAG_WINDOW_RESIZABLE , //= 4, // Set to allow resizable window FLAG_WINDOW_RESIZABLE, // Set to allow resizable window
FLAG_WINDOW_UNDECORATED , //= 8, // Set to disable window decoration (frame and buttons) FLAG_WINDOW_UNDECORATED, // Set to disable window decoration (frame and buttons)
FLAG_WINDOW_TRANSPARENT , //= 16, // Set to allow transparent window FLAG_WINDOW_TRANSPARENT, // Set to allow transparent window
FLAG_MSAA_4X_HINT , //= 32, // Set to try enabling MSAA 4X FLAG_MSAA_4X_HINT, // Set to try enabling MSAA 4X
FLAG_VSYNC_HINT , //= 64, // Set to try enabling V-Sync on GPU FLAG_VSYNC_HINT, // Set to try enabling V-Sync on GPU
FLAG_WINDOW_HIDDEN , //= 128, // Set to create the window initially hidden FLAG_WINDOW_HIDDEN, // Set to create the window initially hidden
FLAG_WINDOW_ALWAYS_RUN //= 256 // Set to allow windows running while minimized FLAG_WINDOW_ALWAYS_RUN // Set to allow windows running while minimized
} }
// Trace log type // Trace log type
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "", has_type_id = false)]
public enum TraceLogType { public enum TraceLogType {
LOG_ALL, // = 0, // Display all logs LOG_ALL, // Display all logs
LOG_TRACE, LOG_TRACE,
LOG_DEBUG, LOG_DEBUG,
LOG_INFO, LOG_INFO,
@ -557,7 +541,7 @@ namespace Raylib {
[CCode (cprefix = "GAMEPAD_BUTTON_", has_type_id = false)] [CCode (cprefix = "GAMEPAD_BUTTON_", has_type_id = false)]
public enum GamepadButton { public enum GamepadButton {
// This is here just for error checking // This is here just for error checking
UNKNOWN = 0, UNKNOWN,
// This is normally a DPAD // This is normally a DPAD
LEFT_FACE_UP, LEFT_FACE_UP,
LEFT_FACE_RIGHT, LEFT_FACE_RIGHT,
@ -588,7 +572,7 @@ namespace Raylib {
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "", has_type_id = false)]
public enum GamepadAxis { public enum GamepadAxis {
// This is here just for error checking // This is here just for error checking
GAMEPAD_AXIS_UNKNOWN = 0, GAMEPAD_AXIS_UNKNOWN,
// Left stick // Left stick
GAMEPAD_AXIS_LEFT_X, GAMEPAD_AXIS_LEFT_X,
GAMEPAD_AXIS_LEFT_Y, GAMEPAD_AXIS_LEFT_Y,
@ -601,66 +585,66 @@ namespace Raylib {
} }
// Shader location point type // Shader location point type
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "LOC_", has_type_id = false)]
public enum ShaderLocationIndex { public enum ShaderLocationIndex {
LOC_VERTEX_POSITION = 0, VERTEX_POSITION,
LOC_VERTEX_TEXCOORD01, VERTEX_TEXCOORD01,
LOC_VERTEX_TEXCOORD02, VERTEX_TEXCOORD02,
LOC_VERTEX_NORMAL, VERTEX_NORMAL,
LOC_VERTEX_TANGENT, VERTEX_TANGENT,
LOC_VERTEX_COLOR, VERTEX_COLOR,
LOC_MATRIX_MVP, MATRIX_MVP,
LOC_MATRIX_MODEL, MATRIX_MODEL,
LOC_MATRIX_VIEW, MATRIX_VIEW,
LOC_MATRIX_PROJECTION, MATRIX_PROJECTION,
LOC_VECTOR_VIEW, VECTOR_VIEW,
LOC_COLOR_DIFFUSE, COLOR_DIFFUSE,
LOC_COLOR_SPECULAR, COLOR_SPECULAR,
LOC_COLOR_AMBIENT, COLOR_AMBIENT,
LOC_MAP_ALBEDO, // LOC_MAP_DIFFUSE MAP_ALBEDO, // LOC_MAP_DIFFUSE
LOC_MAP_METALNESS, // LOC_MAP_SPECULAR MAP_METALNESS, // LOC_MAP_SPECULAR
LOC_MAP_NORMAL, MAP_NORMAL,
LOC_MAP_ROUGHNESS, MAP_ROUGHNESS,
LOC_MAP_OCCLUSION, MAP_OCCLUSION,
LOC_MAP_EMISSION, MAP_EMISSION,
LOC_MAP_HEIGHT, MAP_HEIGHT,
LOC_MAP_CUBEMAP, MAP_CUBEMAP,
LOC_MAP_IRRADIANCE, MAP_IRRADIANCE,
LOC_MAP_PREFILTER, MAP_PREFILTER,
LOC_MAP_BRDF MAP_BRDF
} }
// #define LOC_MAP_DIFFUSE LOC_MAP_ALBEDO // #define LOC_MAP_DIFFUSE LOC_MAP_ALBEDO
// #define LOC_MAP_SPECULAR LOC_MAP_METALNESS // #define LOC_MAP_SPECULAR LOC_MAP_METALNESS
// Shader uniform data types // Shader uniform data types
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "UNIFORM_", has_type_id = false)]
public enum ShaderUniformDataType { public enum ShaderUniformDataType {
UNIFORM_FLOAT = 0, FLOAT,
UNIFORM_VEC2, VEC2,
UNIFORM_VEC3, VEC3,
UNIFORM_VEC4, VEC4,
UNIFORM_INT, INT,
UNIFORM_IVEC2, IVEC2,
UNIFORM_IVEC3, IVEC3,
UNIFORM_IVEC4, IVEC4,
UNIFORM_SAMPLER2D SAMPLER2D
} }
// Material map type // Material map type
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "MAP_", has_type_id = false)]
public enum MaterialMapType { public enum MaterialMapType {
MAP_ALBEDO = 0, // MAP_DIFFUSE ALBEDO, // MAP_DIFFUSE
MAP_METALNESS = 1, // MAP_SPECULAR METALNESS, // MAP_SPECULAR
MAP_NORMAL = 2, NORMAL,
MAP_ROUGHNESS = 3, ROUGHNESS,
MAP_OCCLUSION, OCCLUSION,
MAP_EMISSION, EMISSION,
MAP_HEIGHT, HEIGHT,
MAP_CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP CUBEMAP, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP IRRADIANCE, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP PREFILTER, // NOTE: Uses GL_TEXTURE_CUBE_MAP
MAP_BRDF BRDF
} }
// #define MAP_DIFFUSE MAP_ALBEDO // #define MAP_DIFFUSE MAP_ALBEDO
@ -670,7 +654,7 @@ namespace Raylib {
// NOTE: Support depends on OpenGL version and platform // NOTE: Support depends on OpenGL version and platform
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "", has_type_id = false)]
public enum PixelFormat { public enum PixelFormat {
UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha) UNCOMPRESSED_GRAYSCALE, // 8 bit per pixel (no alpha)
UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels) UNCOMPRESSED_GRAY_ALPHA, // 8*2 bpp (2 channels)
UNCOMPRESSED_R5G6B5, // 16 bpp UNCOMPRESSED_R5G6B5, // 16 bpp
UNCOMPRESSED_R8G8B8, // 24 bpp UNCOMPRESSED_R8G8B8, // 24 bpp
@ -696,91 +680,91 @@ namespace Raylib {
// Texture parameters: filter mode // Texture parameters: filter mode
// NOTE 1: Filtering considers mipmaps if available in the texture // NOTE 1: Filtering considers mipmaps if available in the texture
// NOTE 2: Filter is accordingly set for minification and magnification // NOTE 2: Filter is accordingly set for minification and magnification
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "FILTER_", has_type_id = false)]
public enum TextureFilterMode { public enum TextureFilterMode {
FILTER_POINT = 0, // No filter, just pixel aproximation POINT, // No filter, just pixel aproximation
FILTER_BILINEAR, // Linear filtering BILINEAR, // Linear filtering
FILTER_TRILINEAR, // Trilinear filtering (linear with mipmaps) TRILINEAR, // Trilinear filtering (linear with mipmaps)
FILTER_ANISOTROPIC_4X, // Anisotropic filtering 4x ANISOTROPIC_4X, // Anisotropic filtering 4x
FILTER_ANISOTROPIC_8X, // Anisotropic filtering 8x ANISOTROPIC_8X, // Anisotropic filtering 8x
FILTER_ANISOTROPIC_16X, // Anisotropic filtering 16x ANISOTROPIC_16X, // Anisotropic filtering 16x
} }
// Cubemap layout type // Cubemap layout type
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "CUBEMAP_", has_type_id = false)]
public enum CubemapLayoutType { public enum CubemapLayoutType {
CUBEMAP_AUTO_DETECT = 0, // Automatically detect layout type AUTO_DETECT, // Automatically detect layout type
CUBEMAP_LINE_VERTICAL, // Layout is defined by a vertical line with faces LINE_VERTICAL, // Layout is defined by a vertical line with faces
CUBEMAP_LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces LINE_HORIZONTAL, // Layout is defined by an horizontal line with faces
CUBEMAP_CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces CROSS_THREE_BY_FOUR, // Layout is defined by a 3x4 cross with cubemap faces
CUBEMAP_CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces CROSS_FOUR_BY_THREE, // Layout is defined by a 4x3 cross with cubemap faces
CUBEMAP_PANORAMA // Layout is defined by a panorama image (equirectangular map) PANORAMA // Layout is defined by a panorama image (equirectangular map)
} }
// Texture parameters: wrap mode // Texture parameters: wrap mode
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "WRAP_", has_type_id = false)]
public enum TextureWrapMode { public enum TextureWrapMode {
WRAP_REPEAT = 0, // Repeats texture in tiled mode REPEAT, // Repeats texture in tiled mode
WRAP_CLAMP, // Clamps texture to edge pixel in tiled mode CLAMP, // Clamps texture to edge pixel in tiled mode
WRAP_MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode MIRROR_REPEAT, // Mirrors and repeats the texture in tiled mode
WRAP_MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode MIRROR_CLAMP // Mirrors and clamps to border the texture in tiled mode
} }
// Font type, defines generation method // Font type, defines generation method
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "FONT_", has_type_id = false)]
public enum FontType { public enum FontType {
FONT_DEFAULT = 0, // Default font generation, anti-aliased DEFAULT, // Default font generation, anti-aliased
FONT_BITMAP, // Bitmap font generation, no anti-aliasing BITMAP, // Bitmap font generation, no anti-aliasing
FONT_SDF // SDF font generation, requires external shader SDF // SDF font generation, requires external shader
} }
// Color blending modes (pre-defined) // Color blending modes (pre-defined)
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "BLEND_", has_type_id = false)]
public enum BlendMode { public enum BlendMode {
BLEND_ALPHA = 0, // Blend textures considering alpha (default) ALPHA, // Blend textures considering alpha (default)
BLEND_ADDITIVE, // Blend textures adding colors ADDITIVE, // Blend textures adding colors
BLEND_MULTIPLIED // Blend textures multiplying colors MULTIPLIED // Blend textures multiplying colors
} }
// Gestures type // Gestures type
// NOTE: It could be used as flags to enable only some gestures // NOTE: It could be used as flags to enable only some gestures
[Flags] [Flags]
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "GESTURE_", has_type_id = false)]
public enum GestureType { public enum GestureType {
GESTURE_NONE = 0, NONE,
GESTURE_TAP = 1, TAP,
GESTURE_DOUBLETAP = 2, DOUBLETAP,
GESTURE_HOLD = 4, HOLD,
GESTURE_DRAG = 8, DRAG,
GESTURE_SWIPE_RIGHT = 16, SWIPE_RIGHT,
GESTURE_SWIPE_LEFT = 32, SWIPE_LEFT,
GESTURE_SWIPE_UP = 64, SWIPE_UP,
GESTURE_SWIPE_DOWN = 128, SWIPE_DOWN,
GESTURE_PINCH_IN = 256, PINCH_IN,
GESTURE_PINCH_OUT = 512 PINCH_OUT
} }
// Camera system modes // Camera system modes
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "CAMERA_", has_type_id = false)]
public enum CameraMode { public enum CameraMode {
CAMERA_CUSTOM = 0, CUSTOM,
CAMERA_FREE, FREE,
CAMERA_ORBITAL, ORBITAL,
CAMERA_FIRST_PERSON, FIRST_PERSON,
CAMERA_THIRD_PERSON THIRD_PERSON
} }
// Camera projection modes // Camera projection modes
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "CAMERA_", has_type_id = false)]
public enum CameraType { public enum CameraType {
CAMERA_PERSPECTIVE = 0, PERSPECTIVE,
CAMERA_ORTHOGRAPHIC ORTHOGRAPHIC
} }
// Type of n-patch // Type of n-patch
[CCode (cprefix = "", has_type_id = false)] [CCode (cprefix = "", has_type_id = false)]
public enum NPatchType { public enum NPatchType {
NPT_9PATCH = 0, // Npatch defined by 3x3 tiles NPT_9PATCH, // Npatch defined by 3x3 tiles
NPT_3PATCH_VERTICAL, // Npatch defined by 1x3 tiles NPT_3PATCH_VERTICAL, // Npatch defined by 1x3 tiles
NPT_3PATCH_HORIZONTAL // Npatch defined by 3x1 tiles NPT_3PATCH_HORIZONTAL // Npatch defined by 3x1 tiles
} }
@ -1365,21 +1349,57 @@ namespace Raylib {
// Texture Loading and Drawing Functions (Module: textures) // Texture Loading and Drawing Functions (Module: textures)
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Probable class here... // Texture2D type
public class Image { // NOTE: Data stored in GPU memory
[SimpleType]
[CCode (cname = "Texture2D")]
public struct Texture2D {
uint id; // OpenGL texture id
int width; // Texture base width
int height; // Texture base height
int mipmaps; // Mipmap levels, 1 by default
int format; // Data format (PixelFormat type)
} }
// // Image type, bpp always RGBA (32bit) // // Texture type, same as Texture2D
// // NOTE: Data stored in CPU memory (RAM) // typedef Texture2D Texture;
// typedef struct Image {
// void *data; // Image raw data
// int width; // Image base width
// int height; // Image base height
// int mipmaps; // Mipmap levels, 1 by default
// int format; // Data format (PixelFormat type)
// } Image;
// // TextureCubemap type, actually, same as Texture2D
// typedef Texture2D TextureCubemap;
// Image type, bpp always RGBA (32bit)
// NOTE: Data stored in CPU memory (RAM)
[SimpleType]
[CCode (cname = "Image")]
public struct ImageT {
void *data; // Image raw data
int width; // Image base width
int height; // Image base height
int mipmaps; // Mipmap levels, 1 by default
int format; // Data format (PixelFormat type)
}
//[CCode (cname = "struct bar", free_function = "bar_close", has_type_id = false)]
//[Compact]
//public class Bar {
// [CCode (cname = "bar_open")]
// public static Bar? open (string filename);
//}
// Probable class here...
[Compact]
[CCode (cname = "struct Image", free_function = "UnloadImage", has_type_id = false)]
public class Image {
[CCode (cname = "LoadImage")]
public Image.from_file(string file_name) { }
[CCode (cname = "LoadImageRaw")]
public Image.from_file_raw(string file_name, int width, int height, int format, int header_size) { }
[CCode (cname = "ExportImage")]
public void export(string file_name);
}
// Image loading functions // Image loading functions
// NOTE: This functions do not require GPU access // NOTE: This functions do not require GPU access
@ -1453,7 +1473,8 @@ namespace Raylib {
// Texture loading functions // Texture loading functions
// NOTE: These functions require GPU access // NOTE: These functions require GPU access
// Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM) // Texture2D LoadTexture(const char *fileName); // Load texture from file into GPU memory (VRAM)
// Texture2D LoadTextureFromImage(Image image); // Load texture from image data [CCode (cname = "LoadTextureFromImage")]
public Texture2D load_texture_from_image(ImageT image); // Load texture from image data
// TextureCubemap LoadTextureCubemap(Image image, int layoutType); // Load cubemap from image, multiple image cubemap layouts supported // TextureCubemap LoadTextureCubemap(Image image, int layoutType); // Load cubemap from image, multiple image cubemap layouts supported
// RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer) // RenderTexture2D LoadRenderTexture(int width, int height); // Load texture for rendering (framebuffer)
// void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM) // void UnloadTexture(Texture2D texture); // Unload texture from GPU memory (VRAM)