Clang format changes
This commit is contained in:
parent
6ff1c25567
commit
1c5d10ad80
@ -31,5 +31,5 @@ SpacesInSquareBrackets: 'false'
|
||||
Standard: Auto
|
||||
TabWidth: '4'
|
||||
UseTab: Never
|
||||
|
||||
AlignEscapedNewlines: Left
|
||||
...
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,10 +21,11 @@ enum RasterizerFlags
|
||||
NoHinting = 1 << 0, // Disable hinting. This generally generates 'blurrier' bitmap glyphs when the glyph are rendered in any of the anti-aliased modes.
|
||||
NoAutoHint = 1 << 1, // Disable auto-hinter.
|
||||
ForceAutoHint = 1 << 2, // Indicates that the auto-hinter is preferred over the font's native hinter.
|
||||
LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
|
||||
MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
|
||||
Bold = 1 << 5, // Styling: Should we artificially embolden the font?
|
||||
Oblique = 1 << 6 // Styling: Should we slant the font, emulating italic style?
|
||||
LightHinting = 1 << 3, // A lighter hinting algorithm for gray-level modes. Many generated glyphs are fuzzier but better resemble their original shape. This is achieved by snapping glyphs to the
|
||||
// pixel grid only vertically (Y-axis), as is done by Microsoft's ClearType and Adobe's proprietary font renderer. This preserves inter-glyph spacing in horizontal text.
|
||||
MonoHinting = 1 << 4, // Strong hinting algorithm that should only be used for monochrome output.
|
||||
Bold = 1 << 5, // Styling: Should we artificially embolden the font?
|
||||
Oblique = 1 << 6 // Styling: Should we slant the font, emulating italic style?
|
||||
};
|
||||
|
||||
IMGUI_API bool BuildFontAtlas(ImFontAtlas *atlas, unsigned int extra_flags = 0);
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -85,27 +85,27 @@ extern "C" typedef HSteamUser (*GetHSteamUser_t)();
|
||||
|
||||
void CreateInterfaces()
|
||||
{
|
||||
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib());
|
||||
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
|
||||
g_AppID = g_IEngine->GetAppID();
|
||||
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
|
||||
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
|
||||
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
|
||||
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
|
||||
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
|
||||
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
|
||||
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
|
||||
g_ICvar = BruteforceInterface<ICvar>("VEngineCvar", sharedobj::vstdlib());
|
||||
g_IEngine = BruteforceInterface<IVEngineClient013>("VEngineClient", sharedobj::engine());
|
||||
g_AppID = g_IEngine->GetAppID();
|
||||
g_IEntityList = BruteforceInterface<IClientEntityList>("VClientEntityList", sharedobj::client());
|
||||
g_ISteamClient = BruteforceInterface<ISteamClient>("SteamClient", sharedobj::steamclient(), 17);
|
||||
g_IEventManager2 = BruteforceInterface<IGameEventManager2>("GAMEEVENTSMANAGER", sharedobj::engine(), 2);
|
||||
g_IGameEventManager = BruteforceInterface<IGameEventManager>("GAMEEVENTSMANAGER", sharedobj::engine(), 1);
|
||||
g_IBaseClient = BruteforceInterface<IBaseClientDLL>("VClient", sharedobj::client());
|
||||
g_ITrace = BruteforceInterface<IEngineTrace>("EngineTraceClient", sharedobj::engine());
|
||||
g_IInputSystem = BruteforceInterface<IInputSystem>("InputSystemVersion", sharedobj::inputsystem());
|
||||
|
||||
logging::Info("Initing SteamAPI");
|
||||
GetHSteamPipe_t GetHSteamPipe = reinterpret_cast<GetHSteamPipe_t>(dlsym(sharedobj::steamapi().lmap, "SteamAPI_GetHSteamPipe"));
|
||||
HSteamPipe sp = GetHSteamPipe();
|
||||
HSteamPipe sp = GetHSteamPipe();
|
||||
if (!sp)
|
||||
{
|
||||
logging::Info("Connecting to Steam User");
|
||||
sp = g_ISteamClient->CreateSteamPipe();
|
||||
}
|
||||
GetHSteamUser_t GetHSteamUser = reinterpret_cast<GetHSteamUser_t>(dlsym(sharedobj::steamapi().lmap, "SteamAPI_GetHSteamUser"));
|
||||
HSteamUser su = GetHSteamUser();
|
||||
HSteamUser su = GetHSteamUser();
|
||||
if (!su)
|
||||
{
|
||||
logging::Info("Connecting to Steam User");
|
||||
|
@ -78,30 +78,32 @@ AutoTauntListener listener;
|
||||
|
||||
InitRoutine init([]() {
|
||||
g_IEventManager2->AddListener(&listener, "player_death", false);
|
||||
EC::Register(EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener); }, "Shutdown_Autotaunt");
|
||||
EC::Register(EC::CreateMove,
|
||||
[]() {
|
||||
if (prev_slot != -1 && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && LOCAL_E->m_bAlivePlayer() && taunt_t.test_and_set(100))
|
||||
{
|
||||
if (in_taunt)
|
||||
{
|
||||
if (!HasCondition<TFCond_Taunting>(LOCAL_E))
|
||||
{
|
||||
hack::ExecuteCommand(format("slot", prev_slot + 1));
|
||||
prev_slot = -1;
|
||||
in_taunt = false;
|
||||
}
|
||||
else
|
||||
taunt_t.update();
|
||||
}
|
||||
else
|
||||
{
|
||||
hack::ExecuteCommand("taunt");
|
||||
in_taunt = true;
|
||||
taunt_t.update();
|
||||
}
|
||||
}
|
||||
},
|
||||
"Autotaunt_CM");
|
||||
EC::Register(
|
||||
EC::Shutdown, []() { g_IEventManager2->RemoveListener(&listener); }, "Shutdown_Autotaunt");
|
||||
EC::Register(
|
||||
EC::CreateMove,
|
||||
[]() {
|
||||
if (prev_slot != -1 && CE_GOOD(LOCAL_E) && CE_GOOD(LOCAL_W) && LOCAL_E->m_bAlivePlayer() && taunt_t.test_and_set(100))
|
||||
{
|
||||
if (in_taunt)
|
||||
{
|
||||
if (!HasCondition<TFCond_Taunting>(LOCAL_E))
|
||||
{
|
||||
hack::ExecuteCommand(format("slot", prev_slot + 1));
|
||||
prev_slot = -1;
|
||||
in_taunt = false;
|
||||
}
|
||||
else
|
||||
taunt_t.update();
|
||||
}
|
||||
else
|
||||
{
|
||||
hack::ExecuteCommand("taunt");
|
||||
in_taunt = true;
|
||||
taunt_t.update();
|
||||
}
|
||||
}
|
||||
},
|
||||
"Autotaunt_CM");
|
||||
});
|
||||
} // namespace hacks::tf::autotaunt
|
||||
|
@ -10,39 +10,40 @@ static settings::Float min_size{ "dominatemark.min-size", "15.0f" };
|
||||
static settings::Float max_size{ "dominatemark.max-size", "40.0f" };
|
||||
|
||||
static InitRoutine init([]() {
|
||||
EC::Register(EC::Draw,
|
||||
[]() {
|
||||
if (!*draw_dominate)
|
||||
return;
|
||||
if (CE_BAD(LOCAL_E))
|
||||
return;
|
||||
re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E));
|
||||
for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
|
||||
{
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i))
|
||||
{
|
||||
Vector draw_pos;
|
||||
float size;
|
||||
if (!ent->hitboxes.GetHitbox(0))
|
||||
continue;
|
||||
// Calculate draw pos
|
||||
auto c = ent->InternalEntity()->GetCollideable();
|
||||
draw_pos = ent->m_vecOrigin();
|
||||
draw_pos.z += c->OBBMaxs().z;
|
||||
// Calculate draw size
|
||||
size = *max_size * 1.5f - ent->m_flDistance() / 20.0f;
|
||||
size = fminf(*max_size, size);
|
||||
size = fmaxf(*min_size, size);
|
||||
EC::Register(
|
||||
EC::Draw,
|
||||
[]() {
|
||||
if (!*draw_dominate)
|
||||
return;
|
||||
if (CE_BAD(LOCAL_E))
|
||||
return;
|
||||
re::CTFPlayerShared *shared_player = &re::C_BasePlayer::shared_(RAW_ENT(LOCAL_E));
|
||||
for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
|
||||
{
|
||||
CachedEntity *ent = ENTITY(i);
|
||||
if (CE_GOOD(ent) && ent->m_bAlivePlayer() && re::CTFPlayerShared::IsDominatingPlayer(shared_player, i))
|
||||
{
|
||||
Vector draw_pos;
|
||||
float size;
|
||||
if (!ent->hitboxes.GetHitbox(0))
|
||||
continue;
|
||||
// Calculate draw pos
|
||||
auto c = ent->InternalEntity()->GetCollideable();
|
||||
draw_pos = ent->m_vecOrigin();
|
||||
draw_pos.z += c->OBBMaxs().z;
|
||||
// Calculate draw size
|
||||
size = *max_size * 1.5f - ent->m_flDistance() / 20.0f;
|
||||
size = fminf(*max_size, size);
|
||||
size = fmaxf(*min_size, size);
|
||||
|
||||
Vector out;
|
||||
if (draw::WorldToScreen(draw_pos, out))
|
||||
{
|
||||
static textures::sprite sprite = textures::atlas().create_sprite(447, 257, 64, 64);
|
||||
sprite.draw(int(out.x - size / 2.0f), int(out.y - size), int(size), int(size), colors::white);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dominatemark_draw");
|
||||
Vector out;
|
||||
if (draw::WorldToScreen(draw_pos, out))
|
||||
{
|
||||
static textures::sprite sprite = textures::atlas().create_sprite(447, 257, 64, 64);
|
||||
sprite.draw(int(out.x - size / 2.0f), int(out.y - size), int(size), int(size), colors::white);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"dominatemark_draw");
|
||||
});
|
||||
|
@ -130,7 +130,7 @@ DEFINE_HOOKED_METHOD(CreateMove, bool, void *this_, float input_sample_time, CUs
|
||||
#define TICKS_TO_TIME(t) (TICK_INTERVAL * (t))
|
||||
#define ROUND_TO_TICKS(t) (TICK_INTERVAL * TIME_TO_TICKS(t))
|
||||
volatile uintptr_t **fp;
|
||||
__asm__ volatile ("mov %%ebp, %0" : "=r"(fp));
|
||||
__asm__ volatile("mov %%ebp, %0" : "=r"(fp));
|
||||
bSendPackets = reinterpret_cast<bool *>(**fp - 8);
|
||||
|
||||
g_Settings.is_create_move = true;
|
||||
|
@ -9,4 +9,4 @@ namespace hooked_methods
|
||||
DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawModelState_t &state, const ModelRenderInfo_t &info, matrix3x4_t *bone)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace hooked_methods
|
||||
|
@ -219,4 +219,7 @@ k_EItemType ItemModelMapper::GetItemType(CachedEntity *entity)
|
||||
}
|
||||
|
||||
ItemManager g_ItemManager;
|
||||
static InitRoutine init([]() { EC::Register(EC::LevelInit, []() { g_ItemManager = ItemManager{}; }, "clear_itemtypes"); });
|
||||
static InitRoutine init([]() {
|
||||
EC::Register(
|
||||
EC::LevelInit, []() { g_ItemManager = ItemManager{}; }, "clear_itemtypes");
|
||||
});
|
||||
|
@ -213,23 +213,24 @@ void sendIdentifyRequest()
|
||||
logging::Info("[CO] Sending identify request for %u players", steamIds.size());
|
||||
try
|
||||
{
|
||||
cathookOnlineService.userIdentify(steamIds, (std::function<void(co::ApiCallResult, std::optional<co::identified_user_group>)>) [steamIds](co::ApiCallResult result, std::optional<co::identified_user_group> group) {
|
||||
if (result == co::ApiCallResult::OK)
|
||||
{
|
||||
processIdentifyResponse(steamIds, *group);
|
||||
}
|
||||
else
|
||||
{
|
||||
logging::Info("[CO] Something went wrong while identifying "
|
||||
"%u players: code %d",
|
||||
steamIds.size(), result);
|
||||
for (auto i : steamIds)
|
||||
cathookOnlineService.userIdentify(
|
||||
steamIds, (std::function<void(co::ApiCallResult, std::optional<co::identified_user_group>)>) [steamIds](co::ApiCallResult result, std::optional<co::identified_user_group> group) {
|
||||
if (result == co::ApiCallResult::OK)
|
||||
{
|
||||
identify_queue[i] = false;
|
||||
processIdentifyResponse(steamIds, *group);
|
||||
}
|
||||
identify_stale = true;
|
||||
}
|
||||
});
|
||||
else
|
||||
{
|
||||
logging::Info("[CO] Something went wrong while identifying "
|
||||
"%u players: code %d",
|
||||
steamIds.size(), result);
|
||||
for (auto i : steamIds)
|
||||
{
|
||||
identify_queue[i] = false;
|
||||
}
|
||||
identify_stale = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (std::exception &ex)
|
||||
{
|
||||
|
@ -242,7 +242,8 @@ CatCommand pl_set_state("pl_set_state", "cat_pl_set_state [playername] [state] (
|
||||
continue;
|
||||
std::string currname(info.name);
|
||||
std::replace(currname.begin(), currname.end(), ' ', '-');
|
||||
std::replace_if(currname.begin(), currname.end(), [](char x) { return !isprint(x); }, '*');
|
||||
std::replace_if(
|
||||
currname.begin(), currname.end(), [](char x) { return !isprint(x); }, '*');
|
||||
if (currname.find(name) != 0)
|
||||
continue;
|
||||
id = i;
|
||||
@ -308,7 +309,8 @@ static int cat_pl_set_state_completionCallback(const char *c_partial, char comma
|
||||
continue;
|
||||
std::string name(info.name);
|
||||
std::replace(name.begin(), name.end(), ' ', '-');
|
||||
std::replace_if(name.begin(), name.end(), [](char x) { return !isprint(x); }, '*');
|
||||
std::replace_if(
|
||||
name.begin(), name.end(), [](char x) { return !isprint(x); }, '*');
|
||||
names.push_back(name);
|
||||
}
|
||||
std::sort(names.begin(), names.end());
|
||||
|
@ -15,13 +15,13 @@ void EXPOSED_Epic_VACBypass_1337_DoNotSteal_xXx_$1_xXx_MLG()
|
||||
{
|
||||
((ICommandLine * (*) (void) ) dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-textmode");
|
||||
((ICommandLine * (*) (void) ) dlsym(sharedobj::tier0().lmap, "CommandLine_Tier0"))()->RemoveParm("-insecure");
|
||||
uintptr_t Host_IsSecureServerAllowed_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 74 ? C6 05");
|
||||
uintptr_t Host_IsSecureServerAllowed_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 74 ? C6 05");
|
||||
uintptr_t Host_IsSecureServerAllowed2_addr = gSignatures.GetEngineSignature("55 89 E5 83 EC ? E8 ? ? ? ? 8B 10 C7 44 24 ? ? ? ? ? 89 04 24 FF 52 ? 85 C0 0F");
|
||||
// +0x21 = allowSecureServers
|
||||
// logging::Info("1337 VAC bypass: 0x%08x",
|
||||
// Host_IsSecureServerAllowed_addr);
|
||||
static BytePatch HostSecureServer(Host_IsSecureServerAllowed_addr, {0x55, 0x89, 0xE5, 0x83, 0xEC, 0x18, 0x31, 0xC0, 0x40, 0xC9, 0xC3});
|
||||
static BytePatch HostSecureServer2(Host_IsSecureServerAllowed2_addr, {0x31, 0xC0, 0x40, 0xC3});
|
||||
static BytePatch HostSecureServer(Host_IsSecureServerAllowed_addr, { 0x55, 0x89, 0xE5, 0x83, 0xEC, 0x18, 0x31, 0xC0, 0x40, 0xC9, 0xC3 });
|
||||
static BytePatch HostSecureServer2(Host_IsSecureServerAllowed2_addr, { 0x31, 0xC0, 0x40, 0xC3 });
|
||||
HostSecureServer.Patch();
|
||||
HostSecureServer2.Patch();
|
||||
|
||||
|
@ -22,15 +22,15 @@ static hooked_methods::types::SDL_PollEvent *SDL_PollEvent{ nullptr };
|
||||
|
||||
void applySdlHooks()
|
||||
{
|
||||
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648));
|
||||
pointers::SDL_GL_SwapWindow = reinterpret_cast<hooked_methods::types::SDL_GL_SwapWindow *>(sharedobj::libsdl().Pointer(0xFD648));
|
||||
hooked_methods::original::SDL_GL_SwapWindow = *pointers::SDL_GL_SwapWindow;
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::methods::SDL_GL_SwapWindow;
|
||||
|
||||
pointers::SDL_PollEvent = reinterpret_cast<hooked_methods::types::SDL_PollEvent *>(sharedobj::libsdl().Pointer(0xFCF64));
|
||||
pointers::SDL_PollEvent = reinterpret_cast<hooked_methods::types::SDL_PollEvent *>(sharedobj::libsdl().Pointer(0xFCF64));
|
||||
hooked_methods::original::SDL_PollEvent = *pointers::SDL_PollEvent;
|
||||
*pointers::SDL_PollEvent = hooked_methods::methods::SDL_PollEvent;
|
||||
#if ENABLE_CLIP
|
||||
pointers::SDL_SetClipboardText = reinterpret_cast<hooked_methods::types::SDL_SetClipboardText *>(sharedobj::libsdl().Pointer(0xFCF04));
|
||||
pointers::SDL_SetClipboardText = reinterpret_cast<hooked_methods::types::SDL_SetClipboardText *>(sharedobj::libsdl().Pointer(0xFCF04));
|
||||
hooked_methods::original::SDL_SetClipboardText = *pointers::SDL_SetClipboardText;
|
||||
*pointers::SDL_SetClipboardText = hooked_methods::methods::SDL_SetClipboardText;
|
||||
#endif
|
||||
@ -38,8 +38,8 @@ void applySdlHooks()
|
||||
|
||||
void cleanSdlHooks()
|
||||
{
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
|
||||
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
|
||||
*pointers::SDL_GL_SwapWindow = hooked_methods::original::SDL_GL_SwapWindow;
|
||||
*pointers::SDL_PollEvent = hooked_methods::original::SDL_PollEvent;
|
||||
#if ENABLE_CLIP
|
||||
*pointers::SDL_SetClipboardText = hooked_methods::original::SDL_SetClipboardText;
|
||||
#endif
|
||||
|
File diff suppressed because one or more lines are too long
@ -68,13 +68,15 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code)
|
||||
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
||||
#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code
|
||||
// that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
|
||||
#pragma clang diagnostic ignored "-Wunused-macros" // warning : warning: macro is not used // we define snprintf/vsnprintf on Windows so they are available, but not always used.
|
||||
#if __has_warning("-Wzero-as-null-pointer-constant")
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg
|
||||
// ellipsis changes float to double.
|
||||
#endif
|
||||
#if __has_warning("-Wreserved-id-macro")
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||
@ -368,11 +370,13 @@ void ImGui::ShowDemoWindow(bool *p_open)
|
||||
ShowHelpMarker("Set to false to disable blinking cursor, for users who consider it distracting");
|
||||
ImGui::Checkbox("io.ConfigWindowsResizeFromEdges", &io.ConfigWindowsResizeFromEdges);
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse cursor feedback.");
|
||||
ShowHelpMarker("Enable resizing of windows from their edges and from the lower-left corner.\nThis requires (io.BackendFlags & ImGuiBackendFlags_HasMouseCursors) because it needs mouse "
|
||||
"cursor feedback.");
|
||||
ImGui::Checkbox("io.ConfigWindowsMoveFromTitleBarOnly", &io.ConfigWindowsMoveFromTitleBarOnly);
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
ShowHelpMarker("Instruct Dear ImGui to render a mouse cursor for you. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will "
|
||||
"be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
ImGui::TreePop();
|
||||
ImGui::Separator();
|
||||
}
|
||||
@ -543,7 +547,8 @@ static void ShowDemoWindowWidgets()
|
||||
"CTRL+A or double-click to select all.\n"
|
||||
"CTRL+X,CTRL+C,CTRL+V clipboard.\n"
|
||||
"CTRL+Z,CTRL+Y undo/redo.\n"
|
||||
"ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
||||
"ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See "
|
||||
"misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp).");
|
||||
|
||||
ImGui::InputInt("input int", &i0);
|
||||
ImGui::SameLine();
|
||||
@ -595,7 +600,8 @@ static void ShowDemoWindowWidgets()
|
||||
static float col2[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
||||
ImGui::ColorEdit3("color 1", col1);
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("Click on the colored square to open a color picker.\nClick and hold to use drag and drop.\nRight-click on the colored square to show options.\nCTRL+click on individual component to input value.\n");
|
||||
ShowHelpMarker("Click on the colored square to open a color picker.\nClick and hold to use drag and drop.\nRight-click on the colored square to show options.\nCTRL+click on individual "
|
||||
"component to input value.\n");
|
||||
|
||||
ImGui::ColorEdit4("color 2", col2);
|
||||
}
|
||||
@ -680,7 +686,8 @@ static void ShowDemoWindowWidgets()
|
||||
// Update selection state. Process outside of tree loop to avoid visual inconsistencies during the clicking-frame.
|
||||
if (ImGui::GetIO().KeyCtrl)
|
||||
selection_mask ^= (1 << node_clicked); // CTRL+click to toggle
|
||||
else // if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the selection
|
||||
else // if (!(selection_mask & (1 << node_clicked))) // Depending on selection behavior you want, this commented bit preserve selection when clicking on item that is part of the
|
||||
// selection
|
||||
selection_mask = (1 << node_clicked); // Click to single-select
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
@ -772,7 +779,8 @@ static void ShowDemoWindowWidgets()
|
||||
// Instead we are encoding a few strings with hexadecimal constants. Don't do this in your application!
|
||||
// Please use u8"text in any language" in your application!
|
||||
// Note that characters values are preserved even by InputText() if the font cannot be displayed, so you can safely copy & paste garbled characters into another application.
|
||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character ranges. Read misc/fonts/README.txt for details.");
|
||||
ImGui::TextWrapped("CJK text will only appears if the font was loaded with the appropriate CJK character ranges. Call io.Font->AddFontFromFileTTF() manually to load extra character "
|
||||
"ranges. Read misc/fonts/README.txt for details.");
|
||||
ImGui::Text("Hiragana: \xe3\x81\x8b\xe3\x81\x8d\xe3\x81\x8f\xe3\x81\x91\xe3\x81\x93 (kakikukeko)"); // Normally we would use u8"blah blah" with the proper characters directly in the string.
|
||||
ImGui::Text("Kanjis: \xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e (nihongo)");
|
||||
static char buf[32] = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e";
|
||||
@ -786,7 +794,8 @@ static void ShowDemoWindowWidgets()
|
||||
if (ImGui::TreeNode("Images"))
|
||||
{
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier to your own texture data. Hover the texture for a zoomed view!");
|
||||
ImGui::TextWrapped("Below we are displaying the font texture (which is the only texture we have access to in this demo). Use the 'ImTextureID' type as storage to pass pointers or identifier "
|
||||
"to your own texture data. Hover the texture for a zoomed view!");
|
||||
|
||||
// Here we are grabbing the font texture because that's the only one we have access to inside the demo code.
|
||||
// Remember that ImTextureID is just storage for whatever you want it to be, it is essentially a value that will be passed to the render function inside the ImDrawCmd structure.
|
||||
@ -1004,7 +1013,8 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
if (ImGui::TreeNode("Alignment"))
|
||||
{
|
||||
ShowHelpMarker("Alignment applies when a selectable is larger than its text content.\nBy default, Selectables uses style.SelectableTextAlign but it can be overriden on a per-item basis using PushStyleVar().");
|
||||
ShowHelpMarker("Alignment applies when a selectable is larger than its text content.\nBy default, Selectables uses style.SelectableTextAlign but it can be overriden on a per-item basis "
|
||||
"using PushStyleVar().");
|
||||
static bool selected[3 * 3] = { true, false, true, false, true, false, true, false, true };
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
@ -1075,7 +1085,8 @@ static void ShowDemoWindowWidgets()
|
||||
"label:\n"
|
||||
"\tlock cmpxchg8b eax\n";
|
||||
|
||||
ShowHelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. (This is not demonstrated in imgui_demo.cpp)");
|
||||
ShowHelpMarker("You can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputTextMultiline() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example. "
|
||||
"(This is not demonstrated in imgui_demo.cpp)");
|
||||
ImGui::Checkbox("Read-only", &read_only);
|
||||
ImGuiInputTextFlags flags = ImGuiInputTextFlags_AllowTabInput | (read_only ? ImGuiInputTextFlags_ReadOnly : 0);
|
||||
ImGui::InputTextMultiline("##source", text, IM_ARRAYSIZE(text), ImVec2(-1.0f, ImGui::GetTextLineHeight() * 16), flags);
|
||||
@ -1195,7 +1206,8 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
ImGui::Text("Color button with Picker:");
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\nWith the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only be used for the tooltip and picker popup.");
|
||||
ShowHelpMarker("With the ImGuiColorEditFlags_NoInputs flag you can hide all the slider/text inputs.\nWith the ImGuiColorEditFlags_NoLabel flag you can pass a non-empty label which will only "
|
||||
"be used for the tooltip and picker popup.");
|
||||
ImGui::ColorEdit4("MyColor##3", (float *) &color, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | misc_flags);
|
||||
|
||||
ImGui::Text("Color button with Custom Picker Popup:");
|
||||
@ -1288,7 +1300,8 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
ImGui::Combo("Display Mode", &display_mode, "Auto/Current\0None\0RGB Only\0HSV Only\0Hex Only\0");
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, but the user can change it with a right-click.\n\nColorPicker defaults to displaying RGB+HSV+Hex if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions().");
|
||||
ShowHelpMarker("ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, but the user can change it with a right-click.\n\nColorPicker defaults to displaying "
|
||||
"RGB+HSV+Hex if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions().");
|
||||
ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0");
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("User can right-click the picker to change mode.");
|
||||
@ -1315,7 +1328,8 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
ImGui::Text("Programmatically set defaults:");
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible.");
|
||||
ShowHelpMarker("SetColorEditOptions() is designed to allow you to set boot-time default.\nWe don't have Push/Pop functions because you can force options on a per-widget basis if needed, and "
|
||||
"the user can change non-forced ones with the options menu.\nWe don't have a getter to avoid encouraging you to persistently save values that aren't forward-compatible.");
|
||||
if (ImGui::Button("Default: Uint8 + HSV + Hue Bar"))
|
||||
ImGui::SetColorEditOptions(ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_DisplayHSV | ImGuiColorEditFlags_PickerHueBar);
|
||||
if (ImGui::Button("Default: Float + HDR + Hue Wheel"))
|
||||
@ -2067,7 +2081,8 @@ static void ShowDemoWindowLayout()
|
||||
|
||||
if (ImGui::TreeNode("Groups"))
|
||||
{
|
||||
ShowHelpMarker("Using ImGui::BeginGroup()/EndGroup() to layout items. BeginGroup() basically locks the horizontal position. EndGroup() bundles the whole group so that you can use functions such as IsItemHovered() on it.");
|
||||
ShowHelpMarker("Using ImGui::BeginGroup()/EndGroup() to layout items. BeginGroup() basically locks the horizontal position. EndGroup() bundles the whole group so that you can use functions "
|
||||
"such as IsItemHovered() on it.");
|
||||
ImGui::BeginGroup();
|
||||
{
|
||||
ImGui::BeginGroup();
|
||||
@ -2111,7 +2126,8 @@ static void ShowDemoWindowLayout()
|
||||
|
||||
if (ImGui::TreeNode("Text Baseline Alignment"))
|
||||
{
|
||||
ShowHelpMarker("This is testing the vertical alignment that gets applied on text to keep it aligned with widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces than lines with normal widgets.");
|
||||
ShowHelpMarker("This is testing the vertical alignment that gets applied on text to keep it aligned with widgets. Lines only composed of text or \"small\" widgets fit in less vertical spaces "
|
||||
"than lines with normal widgets.");
|
||||
|
||||
ImGui::Text("One\nTwo\nThree");
|
||||
ImGui::SameLine();
|
||||
@ -2239,7 +2255,8 @@ static void ShowDemoWindowLayout()
|
||||
|
||||
if (ImGui::TreeNode("Horizontal Scrolling"))
|
||||
{
|
||||
ShowHelpMarker("Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag.\n\nYou may want to explicitly specify content width by calling SetNextWindowContentWidth() before Begin().");
|
||||
ShowHelpMarker("Horizontal scrolling for a window has to be enabled explicitly via the ImGuiWindowFlags_HorizontalScrollbar flag.\n\nYou may want to explicitly specify content width by "
|
||||
"calling SetNextWindowContentWidth() before Begin().");
|
||||
static int lines = 7;
|
||||
ImGui::SliderInt("Lines", &lines, 1, 15);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||
@ -2298,7 +2315,8 @@ static void ShowDemoWindowLayout()
|
||||
if (ImGui::TreeNode("Clipping"))
|
||||
{
|
||||
static ImVec2 size(100, 100), offset(50, 20);
|
||||
ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
||||
ImGui::TextWrapped("On a per-widget basis we are occasionally clipping text CPU-side if it won't fit in its frame. Otherwise we are doing coarser clipping + passing a scissor rectangle to "
|
||||
"the renderer. The system is designed to try minimizing both execution and CPU/GPU rendering cost.");
|
||||
ImGui::DragFloat2("size", (float *) &size, 0.5f, 1.0f, 200.0f, "%.0f");
|
||||
ImGui::TextWrapped("(Click and drag)");
|
||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||
@ -2994,7 +3012,8 @@ static void ShowDemoWindowMisc()
|
||||
ImGui::Text("Current mouse cursor = %d: %s", ImGui::GetMouseCursor(), mouse_cursors_names[ImGui::GetMouseCursor()]);
|
||||
ImGui::Text("Hover to see mouse cursors:");
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will draw the right cursor for you, otherwise your backend needs to handle it.");
|
||||
ShowHelpMarker("Your application can render a different mouse cursor based on what ImGui::GetMouseCursor() returns. If software cursor rendering (io.MouseDrawCursor) is set ImGui will "
|
||||
"draw the right cursor for you, otherwise your backend needs to handle it.");
|
||||
for (int i = 0; i < ImGuiMouseCursor_COUNT; i++)
|
||||
{
|
||||
char label[32];
|
||||
@ -3385,7 +3404,9 @@ void ImGui::ShowStyleEditor(ImGuiStyle *ref)
|
||||
ImGui::PopFont();
|
||||
ImGui::DragFloat("Font scale", &font->Scale, 0.005f, 0.3f, 2.0f, "%.1f"); // Scale only this font
|
||||
ImGui::SameLine();
|
||||
ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
|
||||
ShowHelpMarker("Note than the default embedded font is NOT meant to be scaled.\n\nFont are currently rendered into bitmaps at a given size at the time of building the atlas. You "
|
||||
"may oversample them to get some flexibility with scaling. You can also render at multiple sizes and select which one to use at runtime.\n\n(Glimmer of hope: the "
|
||||
"atlas system should hopefully be rewritten in the future to make scaling more natural and automatic.)");
|
||||
ImGui::InputFloat("Font offset", &font->DisplayOffset.y, 1, 1, "%.0f");
|
||||
ImGui::Text("Ascent: %f, Descent: %f, Height: %f", font->Ascent, font->Descent, font->Ascent - font->Descent);
|
||||
ImGui::Text("Fallback character: '%c' (%d)", font->FallbackChar, font->FallbackChar);
|
||||
@ -3415,7 +3436,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle *ref)
|
||||
const ImFontGlyph *glyph = font->FindGlyphNoFallback((ImWchar)(base + n));
|
||||
draw_list->AddRect(cell_p1, cell_p2, glyph ? IM_COL32(255, 255, 255, 100) : IM_COL32(255, 255, 255, 50));
|
||||
if (glyph)
|
||||
font->RenderChar(draw_list, cell_size, cell_p1, ImGui::GetColorU32(ImGuiCol_Text), (ImWchar)(base + n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
|
||||
font->RenderChar(draw_list, cell_size, cell_p1, ImGui::GetColorU32(ImGuiCol_Text),
|
||||
(ImWchar)(base + n)); // We use ImFont::RenderChar as a shortcut because we don't have UTF-8 conversion functions available to generate a string.
|
||||
if (glyph && ImGui::IsMouseHoveringRect(cell_p1, cell_p2))
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
@ -3462,7 +3484,8 @@ void ImGui::ShowStyleEditor(ImGuiStyle *ref)
|
||||
ImGui::DragFloat("Curve Tessellation Tolerance", &style.CurveTessellationTol, 0.02f, 0.10f, FLT_MAX, "%.2f", 2.0f);
|
||||
if (style.CurveTessellationTol < 0.10f)
|
||||
style.CurveTessellationTol = 0.10f;
|
||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f, "%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||
ImGui::DragFloat("Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
|
||||
"%.2f"); // Not exposing zero here so user doesn't "lose" the UI (zero alpha clips all widgets). But application code could have a toggle to switch between zero and non-zero.
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
ImGui::EndTabItem();
|
||||
@ -3703,7 +3726,8 @@ struct ExampleAppConsole
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::TextWrapped("This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as timestamp, emitter, etc.");
|
||||
ImGui::TextWrapped("This example implements a console with basic coloring, completion and history. A more elaborate implementation may want to store entries along with extra data such as "
|
||||
"timestamp, emitter, etc.");
|
||||
ImGui::TextWrapped("Enter 'HELP' for help, press TAB to use text completion.");
|
||||
|
||||
// TODO: display items starting from the bottom
|
||||
@ -4213,7 +4237,8 @@ static void ShowExampleAppPropertyEditor(bool *p_open)
|
||||
return;
|
||||
}
|
||||
|
||||
ShowHelpMarker("This example shows how you may implement a property editor using two columns.\nAll objects/fields data are dummies here.\nRemember that in many simple cases, you can use ImGui::SameLine(xxx) to position\nyour cursor horizontally instead of using the Columns() API.");
|
||||
ShowHelpMarker("This example shows how you may implement a property editor using two columns.\nAll objects/fields data are dummies here.\nRemember that in many simple cases, you can use "
|
||||
"ImGui::SameLine(xxx) to position\nyour cursor horizontally instead of using the Columns() API.");
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(2, 2));
|
||||
ImGui::Columns(2);
|
||||
@ -4476,7 +4501,8 @@ static void ShowExampleAppSimpleOverlay(bool *p_open)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// Demonstrate using "##" and "###" in identifiers to manipulate ID generation.
|
||||
// This apply to all regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for details.
|
||||
// This apply to all regular items as well. Read FAQ section "How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on the purpose of labels/IDs." for
|
||||
// details.
|
||||
static void ShowExampleAppWindowTitles(bool *)
|
||||
{
|
||||
// By default, Windows are uniquely identified by their title.
|
||||
|
File diff suppressed because one or more lines are too long
@ -87,7 +87,8 @@ struct FontInfo
|
||||
uint32_t PixelHeight; // Size this font was generated with.
|
||||
float Ascender; // The pixel extents above the baseline in pixels (typically positive).
|
||||
float Descender; // The extents below the baseline in pixels (typically negative).
|
||||
float LineSpacing; // The baseline-to-baseline distance. Note that it usually is larger than the sum of the ascender and descender taken as absolute values. There is also no guarantee that no glyphs extend above or below subsequent baselines when using this distance. Think of it as a value the designer of the font finds appropriate.
|
||||
float LineSpacing; // The baseline-to-baseline distance. Note that it usually is larger than the sum of the ascender and descender taken as absolute values. There is also no guarantee that no
|
||||
// glyphs extend above or below subsequent baselines when using this distance. Think of it as a value the designer of the font finds appropriate.
|
||||
float LineGap; // The spacing in pixels between one row's descent and the next row's ascent.
|
||||
float MaxAdvanceWidth; // This field gives the maximum horizontal cursor advance for all glyphs in the font.
|
||||
};
|
||||
@ -96,7 +97,8 @@ struct FontInfo
|
||||
// NB: No ctor/dtor, explicitly call Init()/Shutdown()
|
||||
struct FreeTypeFont
|
||||
{
|
||||
bool InitFont(FT_Library ft_library, const ImFontConfig &cfg, unsigned int extra_user_flags); // Initialize from an external data buffer. Doesn't copy data, and you must ensure it stays valid up to this object lifetime.
|
||||
bool InitFont(FT_Library ft_library, const ImFontConfig &cfg,
|
||||
unsigned int extra_user_flags); // Initialize from an external data buffer. Doesn't copy data, and you must ensure it stays valid up to this object lifetime.
|
||||
void CloseFont();
|
||||
void SetPixelHeight(int pixel_height); // Change font pixel size. All following calls to RasterizeGlyph() will use this size
|
||||
const FT_Glyph_Metrics *LoadGlyph(uint32_t in_codepoint);
|
||||
|
@ -60,7 +60,8 @@ Index of this file:
|
||||
#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" // warning : zero as null pointer constant // some standard header variations use #define NULL 0
|
||||
#endif
|
||||
#if __has_warning("-Wdouble-promotion")
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg ellipsis changes float to double.
|
||||
#pragma clang diagnostic ignored "-Wdouble-promotion" // warning: implicit conversion from 'float' to 'double' when passing argument to function // using printf() is a misery with this as C++ va_arg
|
||||
// ellipsis changes float to double.
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral" // warning: format not a string literal, format string not checked
|
||||
@ -435,7 +436,8 @@ bool ImGui::ButtonBehavior(const ImRect &bb, ImGuiID id, bool *out_hovered, bool
|
||||
{
|
||||
hovered = true;
|
||||
SetHoveredID(id);
|
||||
if (CalcTypematicPressedRepeatAmount(g.HoveredIdTimer + 0.0001f, g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, 0.01f, 0.70f)) // FIXME: Our formula for CalcTypematicPressedRepeatAmount() is fishy
|
||||
if (CalcTypematicPressedRepeatAmount(g.HoveredIdTimer + 0.0001f, g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, 0.01f,
|
||||
0.70f)) // FIXME: Our formula for CalcTypematicPressedRepeatAmount() is fishy
|
||||
{
|
||||
pressed = true;
|
||||
FocusWindow(window);
|
||||
@ -1925,7 +1927,8 @@ template <typename TYPE, typename SIGNEDTYPE, typename FLOATTYPE> bool ImGui::Dr
|
||||
adjust_delta = -adjust_delta;
|
||||
|
||||
// Clear current value on activation
|
||||
// Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right side, keep the 300.
|
||||
// Avoid altering values and clamping when we are _already_ past the limits and heading in the same direction, so e.g. if range is 0..255, current value is 300 and we are pushing to the right
|
||||
// side, keep the 300.
|
||||
bool is_just_activated = g.ActiveIdIsJustActivated;
|
||||
bool is_already_past_limits_and_pushing_outward = has_min_max && ((*v >= v_max && adjust_delta > 0.0f) || (*v <= v_min && adjust_delta < 0.0f));
|
||||
bool is_drag_direction_change_with_power = is_power && ((adjust_delta < 0 && g.DragCurrentAccum > 0) || (adjust_delta > 0 && g.DragCurrentAccum < 0));
|
||||
@ -3817,8 +3820,9 @@ bool ImGui::InputTextEx(const char *label, char *buf, int buf_size, const ImVec2
|
||||
}
|
||||
}
|
||||
|
||||
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.
|
||||
// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage.
|
||||
// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't
|
||||
// modified on this frame. If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with
|
||||
// ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage.
|
||||
bool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);
|
||||
if (apply_edit_back_to_user_buffer)
|
||||
{
|
||||
@ -3983,7 +3987,8 @@ bool ImGui::InputTextEx(const char *label, char *buf, int buf_size, const ImVec2
|
||||
// - Display the text (this alone can be more easily clipped)
|
||||
// - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation)
|
||||
// - Measure text height (for scrollbar)
|
||||
// We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort)
|
||||
// We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them
|
||||
// by an extra refactoring effort)
|
||||
// FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8.
|
||||
IM_ASSERT(state != NULL);
|
||||
const ImWchar *text_begin = state->TextW.Data;
|
||||
@ -4089,8 +4094,9 @@ bool ImGui::InputTextEx(const char *label, char *buf, int buf_size, const ImVec2
|
||||
const ImWchar *text_selected_begin = text_begin + ImMin(state->Stb.select_start, state->Stb.select_end);
|
||||
const ImWchar *text_selected_end = text_begin + ImMax(state->Stb.select_start, state->Stb.select_end);
|
||||
|
||||
ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg, render_cursor ? 1.0f : 0.6f); // FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests.
|
||||
float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.
|
||||
ImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg,
|
||||
render_cursor ? 1.0f : 0.6f); // FIXME: current code flow mandate that render_cursor is always true here, we are leaving the transparent one for tests.
|
||||
float bg_offy_up = is_multiline ? 0.0f : -1.0f; // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.
|
||||
float bg_offy_dn = is_multiline ? 0.0f : 2.0f;
|
||||
ImVec2 rect_pos = draw_pos + select_start_offset - draw_scroll;
|
||||
for (const ImWchar *p = text_selected_begin; p < text_selected_end;)
|
||||
@ -4433,7 +4439,8 @@ static inline ImU32 ImAlphaBlendColor(ImU32 col_a, ImU32 col_b)
|
||||
|
||||
// Helper for ColorPicker4()
|
||||
// NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that.
|
||||
// I spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding alltogether.
|
||||
// I spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and
|
||||
// eventually gave up... probably more reasonable to disable rounding alltogether.
|
||||
void ImGui::RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, int rounding_corners_flags)
|
||||
{
|
||||
ImGuiWindow *window = GetCurrentWindow();
|
||||
@ -6078,7 +6085,8 @@ bool ImGui::BeginMenu(const char *label, bool enabled)
|
||||
tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f); // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?
|
||||
tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);
|
||||
moving_within_opened_triangle = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);
|
||||
// window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug
|
||||
// window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128));
|
||||
// window->DrawList->PopClipRect(); // Debug
|
||||
}
|
||||
}
|
||||
|
||||
@ -6811,7 +6819,8 @@ bool ImGui::TabItemEx(ImGuiTabBar *tab_bar, const char *label, bool *p_open, ImG
|
||||
const ImGuiStyle &style = g.Style;
|
||||
const ImGuiID id = TabBarCalcTabID(tab_bar, label);
|
||||
|
||||
// If the user called us with *p_open == false, we early out and don't render. We make a dummy call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an older ID.
|
||||
// If the user called us with *p_open == false, we early out and don't render. We make a dummy call to ItemAdd() so that attempts to use a contextual popup menu with an implicit ID won't use an
|
||||
// older ID.
|
||||
if (p_open && !*p_open)
|
||||
{
|
||||
PushItemFlag(ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus, true);
|
||||
|
Reference in New Issue
Block a user