the complete struct of GPU_Image is this: typedef struct GPU_Image { struct GPU_Renderer* renderer; GPU_Target* context_target; GPU_Target* target; Uint16 w, h; GPU_bool using_virtual_resolution; GPU_FormatEnum format; int num_layers; int bytes_per_pixel; Uint16 base_w, base_h; Uint16 texture_w, texture_h; GPU_bool has_mipmaps; float anchor_x; float anchor_y; SDL_Color color; GPU_bool use_blending; GPU_BlendMode blend_mode; GPU_FilterEnum filter_mode; GPU_SnapEnum snap_mode; GPU_WrapEnum wrap_mode_x; GPU_WrapEnum wrap_mode_y; void* data; int refcount; GPU_bool is_alias; } GPU_Image;
it is true you don't have to write all of them in Nim if you only need to access the width and height, but you also cannot ignore fields that came before width and height. this is minimal fields you need to write in Nim if you only need to access the width and height: type image* = object renderer: pointer context_target: pointer target: pointer w*, h*: uint16 ptrImage* = ptr image Nim's object has strong relationship with C struct, so it works like C struct, not like javascript or python object