mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-06 06:25:54 +01:00
Trim trailing white spaces. Changes some NULL to nullptr.
This commit is contained in:
parent
49fa47fc19
commit
5de45fb1d9
@ -570,8 +570,8 @@ typedef ImU64 ImTextureID; // Default: store up to 64-bits (any pointer or inte
|
|||||||
// Store a ImTextureID _or_ a ImTextureData*.
|
// Store a ImTextureID _or_ a ImTextureData*.
|
||||||
struct ImTextureRef
|
struct ImTextureRef
|
||||||
{
|
{
|
||||||
ImTextureRef() { _TexData = NULL; _TexID = ImTextureID_Invalid; }
|
ImTextureRef() { _TexData = nullptr; _TexID = ImTextureID_Invalid; }
|
||||||
ImTextureRef(ImTextureID tex_id) { _TexData = NULL; _TexID = tex_id; }
|
ImTextureRef(ImTextureID tex_id) { _TexData = nullptr; _TexID = tex_id; }
|
||||||
inline ImTextureID GetTexID() const { return _TexData ? _TexData->TexID : _TexID; }
|
inline ImTextureID GetTexID() const { return _TexData ? _TexData->TexID : _TexID; }
|
||||||
|
|
||||||
// Members (either are set, never both!)
|
// Members (either are set, never both!)
|
||||||
@ -589,7 +589,7 @@ struct ImTextureRef
|
|||||||
We intentionally do not provide an `ImTextureRef` constructor for this: we don't expect this to be frequently useful to the end-user, and it would be erroneously called by many legacy code.
|
We intentionally do not provide an `ImTextureRef` constructor for this: we don't expect this to be frequently useful to the end-user, and it would be erroneously called by many legacy code.
|
||||||
- There is no constructor to create a `ImTextureRef` from a `ImTextureData*` as we don't expect this to be useful to the end-user, and it would be erroneously called by many legacy code.
|
- There is no constructor to create a `ImTextureRef` from a `ImTextureData*` as we don't expect this to be useful to the end-user, and it would be erroneously called by many legacy code.
|
||||||
- If you want to bind the current atlas when using custom rectangles, you can use `io.Fonts->TexRef`.
|
- If you want to bind the current atlas when using custom rectangles, you can use `io.Fonts->TexRef`.
|
||||||
- Binding generators for languages such as C (which don't have constructors), should provide a helper, e.g. `inline ImTextureRef ImTextureRefFromID(ImTextureID tex_id) { ImTextureRef tex_ref = { ._TexData = NULL, .TexID = tex_id }; return tex_ref; }`
|
- Binding generators for languages such as C (which don't have constructors), should provide a helper, e.g. `inline ImTextureRef ImTextureRefFromID(ImTextureID tex_id) { ImTextureRef tex_ref = { ._TexData = nullptr, .TexID = tex_id }; return tex_ref; }`
|
||||||
|
|
||||||
**Please read documentations or tutorials on your graphics API to understand how to display textures on the screen before moving onward.**
|
**Please read documentations or tutorials on your graphics API to understand how to display textures on the screen before moving onward.**
|
||||||
|
|
||||||
@ -780,7 +780,7 @@ style.FontScaleDpi = 2.0f;
|
|||||||
|
|
||||||
To change font size:
|
To change font size:
|
||||||
```cpp
|
```cpp
|
||||||
ImGui::PushFont(NULL, 42.0f); // This will be multiplied by style.FontScaleDpi
|
ImGui::PushFont(nullptr, 42.0f); // This will be multiplied by style.FontScaleDpi
|
||||||
```
|
```
|
||||||
To change font and font size:
|
To change font and font size:
|
||||||
```cpp
|
```cpp
|
||||||
|
|||||||
@ -96,7 +96,7 @@ atlas->AddFont(...);
|
|||||||
|
|
||||||
v1.92 introduces a newer, dynamic font system. It requires backend to support the `ImGuiBackendFlags_HasTextures` feature:
|
v1.92 introduces a newer, dynamic font system. It requires backend to support the `ImGuiBackendFlags_HasTextures` feature:
|
||||||
- Users of icons, Asian and non-English languages do not need to pre-build all glyphs ahead of time. Saving on loading time, memory, and also reducing issues with missing glyphs. Specifying glyph ranges is not needed anymore.
|
- Users of icons, Asian and non-English languages do not need to pre-build all glyphs ahead of time. Saving on loading time, memory, and also reducing issues with missing glyphs. Specifying glyph ranges is not needed anymore.
|
||||||
- `PushFont(NULL, new_size)` may be used anytime to change font size.
|
- `PushFont(nullptr, new_size)` may be used anytime to change font size.
|
||||||
- Packing custom rectangles is more convenient as pixels may be written to immediately.
|
- Packing custom rectangles is more convenient as pixels may be written to immediately.
|
||||||
- Any update to fonts previously required backend specific calls to re-upload the texture, and said calls were not portable across backends. It is now possible to scale fonts etc. in a way that doesn't require you to make backend-specific calls.
|
- Any update to fonts previously required backend specific calls to re-upload the texture, and said calls were not portable across backends. It is now possible to scale fonts etc. in a way that doesn't require you to make backend-specific calls.
|
||||||
- It is possible to plug a custom loader/backend to any font source.
|
- It is possible to plug a custom loader/backend to any font source.
|
||||||
|
|||||||
@ -548,7 +548,7 @@ WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
create_info.System = "win32";
|
create_info.System = "win32";
|
||||||
create_info.RawWindow = (void*)glfwGetWin32Window(window);
|
create_info.RawWindow = (void*)glfwGetWin32Window(window);
|
||||||
create_info.RawInstance = (void*)::GetModuleHandle(NULL);
|
create_info.RawInstance = (void*)::GetModuleHandle(nullptr);
|
||||||
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -505,29 +505,29 @@ WGPUSurface CreateWGPUSurface(const WGPUInstance& instance, SDL_Window* window)
|
|||||||
#if defined(SDL_PLATFORM_MACOS)
|
#if defined(SDL_PLATFORM_MACOS)
|
||||||
{
|
{
|
||||||
create_info.System = "cocoa";
|
create_info.System = "cocoa";
|
||||||
create_info.RawWindow = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, NULL);
|
create_info.RawWindow = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_COCOA_WINDOW_POINTER, nullptr);
|
||||||
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
||||||
}
|
}
|
||||||
#elif defined(SDL_PLATFORM_LINUX)
|
#elif defined(SDL_PLATFORM_LINUX)
|
||||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0)
|
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0)
|
||||||
{
|
{
|
||||||
create_info.System = "wayland";
|
create_info.System = "wayland";
|
||||||
create_info.RawDisplay = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, NULL);
|
create_info.RawDisplay = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER, nullptr);
|
||||||
create_info.RawSurface = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, NULL);
|
create_info.RawSurface = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr);
|
||||||
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
||||||
}
|
}
|
||||||
else if (!SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11"))
|
else if (!SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11"))
|
||||||
{
|
{
|
||||||
create_info.System = "x11";
|
create_info.System = "x11";
|
||||||
create_info.RawWindow = (void*)SDL_GetNumberProperty(propertiesID, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
|
create_info.RawWindow = (void*)SDL_GetNumberProperty(propertiesID, SDL_PROP_WINDOW_X11_WINDOW_NUMBER, 0);
|
||||||
create_info.RawDisplay = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL);
|
create_info.RawDisplay = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_X11_DISPLAY_POINTER, nullptr);
|
||||||
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
||||||
}
|
}
|
||||||
#elif defined(SDL_PLATFORM_WIN32)
|
#elif defined(SDL_PLATFORM_WIN32)
|
||||||
{
|
{
|
||||||
create_info.System = "win32";
|
create_info.System = "win32";
|
||||||
create_info.RawWindow = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
create_info.RawWindow = (void*)SDL_GetPointerProperty(propertiesID, SDL_PROP_WINDOW_WIN32_HWND_POINTER, nullptr);
|
||||||
create_info.RawInstance = (void*)::GetModuleHandle(NULL);
|
create_info.RawInstance = (void*)::GetModuleHandle(nullptr);
|
||||||
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
return ImGui_ImplWGPU_CreateWGPUSurfaceHelper(&create_info);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -508,9 +508,9 @@ static bool ImGui_ImplFreeType_FontBakedLoadGlyph(ImFontAtlas* atlas, ImFontConf
|
|||||||
|
|
||||||
// Load metrics only mode
|
// Load metrics only mode
|
||||||
const float advance_x = (slot->advance.x / FT_SCALEFACTOR) / rasterizer_density;
|
const float advance_x = (slot->advance.x / FT_SCALEFACTOR) / rasterizer_density;
|
||||||
if (out_advance_x != NULL)
|
if (out_advance_x != nullptr)
|
||||||
{
|
{
|
||||||
IM_ASSERT(out_glyph == NULL);
|
IM_ASSERT(out_glyph == nullptr);
|
||||||
*out_advance_x = advance_x;
|
*out_advance_x = advance_x;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user