Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subtraction ImVec2 #2832

Closed
CesaragsUC opened this issue Oct 6, 2019 · 3 comments
Closed

Subtraction ImVec2 #2832

CesaragsUC opened this issue Oct 6, 2019 · 3 comments

Comments

@CesaragsUC
Copy link

Hi, i get problem when i tried subtract two ImVec2.
i saw a source that this operator work, but i think that somethings has ben changed, since the code that i using as base use old version of imgui.

ImVec2 center = ImVec2(pos1.x + screen.x / 2, pos1.y + screen.y / 2); ImGui::GetWindowDrawList()->AddCircleFilled(center + ImVec2(x_1, y_1), 2, ImColor(255, 0, 0));

https://imgur.com/GOvKWCP

@ocornut
Copy link
Owner

ocornut commented Oct 6, 2019

Hello,

Please carefully read and fill the Issue Template next time you ask a question.

Operators for ImVec2 are not declared by default, because the expectation for custom engine is to setup cast operators in imconfig.h and let the user use their own math types and operators.
If you want to use ImVec2 maths operator you can use:

#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"

@ocornut ocornut closed this as completed Oct 6, 2019
@CesaragsUC
Copy link
Author

sorry, thx its working now

@divital-coder
Copy link

nice thing figuring it out ,

ocornut added a commit that referenced this issue Feb 15, 2023
…ATH_OPERATORS) implementation from imgui_internal.h in imgui.h. (#6164, #6137, #5966, #2832)
kjblanchard pushed a commit to kjblanchard/imgui that referenced this issue May 5, 2023
Intrets pushed a commit to Intrets/imgui that referenced this issue Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants