Comments (4)
Could you please elaborate on your request? It's not super clear.
I'm not sure where such a feature would belong in the current API -- it seems like it has nothing to do with hudhook
and it depends on imgui
instead.
For the record, font size can be controlled already by the clients, see this, but again it is not strictly dependent on hudhook
and it is a feature from imgui
.
If you mean changing the font size across widgets in the same frame, I don't think that is supported by imgui
outside of pushing/popping preinitialized fonts. Fonts are rasterized to a texture at initialization time, and that texture then gets sampled when drawing text.
from hudhook.
ImGui::GetBackgroundDrawList()->AddText(esp_text, 19, ImVec2(ESPLeft, ESPTop - 20.f), ImColor(var::enemyColor[0], var::enemyColor[1], var::enemyColor[2]), Enemy->Name);
This C++ code does not use any push or either pop for font, and second parameter being passed is text size. I was assuming that asking here is much better idea, rather go to imgui-rs that is being abandoned for months.
imgui-rs/imgui-rs#787
from hudhook.
// 200 IQ conversion mechanism
pub fn f32_to_u8(value: f32) -> u8 {
// Scale and clamp the value to the range [0, 255]
let scaled = (value * 255.0).clamp(0.0, 255.0);
scaled as u8
}
unsafe {
let custom_font = ui.push_font(font_id);
// Get the entity name and create a CString
let text = entity.name().unwrap();
let c_text = CString::new(text).unwrap(); // Convert to C-compatible string
let font_handle = igGetFont();
// Get the pointer to the C string
let start: *const c_char = c_text.as_ptr(); // Use CString to ensure null termination
// The end pointer is not necessary when using CString, as you can pass the string slice
let end: *const c_char = start.add(c_text.as_bytes().len());
// Call the function
sys::ImDrawList_AddText_FontPtr(
sys::igGetBackgroundDrawList_Nil(),
font_handle,
SETTINGS.deref().name_text_thickness,
ImVec2::from([espleft, esptop - 80.0f32]),
if LOCAL_PLAYER.team().unwrap() == entity.team().unwrap() {
ImColor32::from_rgba(f32_to_u8(SETTINGS.deref().ally_name_text_color[0]), f32_to_u8(SETTINGS.deref().ally_name_text_color[1]), f32_to_u8(SETTINGS.deref().ally_name_text_color[2]), f32_to_u8(SETTINGS.deref().ally_name_text_color[3])).to_bits()
} else {
ImColor32::from_rgba(f32_to_u8(SETTINGS.deref().enemy_name_text_color[0]), f32_to_u8(SETTINGS.deref().enemy_name_text_color[1]), f32_to_u8(SETTINGS.deref().enemy_name_text_color[2]), f32_to_u8(SETTINGS.deref().enemy_name_text_color[3])).to_bits()
},
start,
end,
0.0f32,
std::ptr::null() // Assuming you don't want to specify a clipping rectangle
);
custom_font.pop();
}
When I drag slider that is bound to name_text_thickness I am able to change text size during this function call. What resolves my problem.
from hudhook.
That seems to be part of imgui-rs.
from hudhook.
Related Issues (20)
- Automated testing harness
- Add performance metrics
- Bump to `windows` 0.53
- Write a coobook
- An issue with version 0.6.5 HOT 8
- Support uploading images of any width HOT 1
- DX8 HOT 2
- Question about loading and using font HOT 3
- Plan for 0.7 HOT 4
- Backend assertion failure (possibly from wrong mouse event handling) HOT 12
- need ways to filter certain windows message, without blocking everything HOT 1
- hudhook pipeline doesn't report `delta_time` to imgui runtime HOT 1
- Bump imgui-rs to 0.12
- index out of bounds error when loading texture using new RenderContext API (DX9) HOT 2
- Unexpected DirectX9 behavior HOT 5
- loading more then 8 textures doesn't work HOT 2
- RivaTuner overlay conflict HOT 4
- DXGIGetDebugInterface not available on some platforms
- Switch to std `LazyLock` / `LazyCell`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hudhook.