Imgui: ImGui::Text with float values?

Created on 31 Mar 2017  路  1Comment  路  Source: ocornut/imgui

How could I possibly convert a float value to string and show that in ImGui::Text, and if this is not possible/if there's another way of doing it, could someone possibly give me a pseudo code or an example?

My code, which is completely wrong, I know.

float viewy;
float viewx;

void xD
{
viewy = interface->model.y;
viewx = interface->model.x;

ImGui::Text(viewy);
ImGui::Text(viewx);
}

Most helpful comment

Hello,

ImGui::Text() uses printf() style format string, so for example you can do:

ImGui::Text("view = %f, %f", interface->model.x, interface->model.y);

There are numerous examples of doing this in imgui_demo.cpp, and numerous documentations about printf-style format strings on the internet. Please refer to them.

>All comments

Hello,

ImGui::Text() uses printf() style format string, so for example you can do:

ImGui::Text("view = %f, %f", interface->model.x, interface->model.y);

There are numerous examples of doing this in imgui_demo.cpp, and numerous documentations about printf-style format strings on the internet. Please refer to them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

noche-x picture noche-x  路  3Comments

bogdaNNNN1 picture bogdaNNNN1  路  3Comments

inflex picture inflex  路  3Comments

bizehao picture bizehao  路  3Comments

spaderthomas picture spaderthomas  路  3Comments