Advertisement

How to make a calculator in c++ with imgui OpenGL

Started by September 01, 2020 09:33 PM
14 comments, last by SyncViews 4 years, 3 months ago

Hi there,

I wanted to make a calculator in OpenGL with imgui in c++ but have no idea how to. I have seen videos but nothing is ever there. So do you know how I can make multiple buttons and a display/output box. I want to make it like this but in opengl with imgui.

Why don't you follow that tutorial first, then move on to opengl afterwards? Might be a good way to learn some C++, and you'll need that later on.

I'm telling you; if you first learn how to program, picking up a GUI library and eventually making a calculator is going to be much easier than just making a calculator without any experience.

Advertisement

The imgui demo program has multiple buttons and text display (output). Did you try doing the same? What is your code? What specific problems did you have?

Not sure there is a video, reading example code, documentation, and other written material to apply to a different problem is pretty important.

@undefined the video shows how to make buttons with net framework, which I know. I wanted to make buttons and a display box where the output would be.

You could have shared your code, so probably we can look at it. It is always better to have seen any kind of tutorial videos or blogs where such kind of exercise has done. You can also check for githubs, whether anyone has shared some kind of practice. I have tried to build such a calculator for my paper writing website, though I used python coding. I suggest, you can go for some github codes search.

Hi,

By my count this is the third post on this that you have made (althought I'd swear that I'm missing one):

https://www.gamedev.net/forums/topic/707855-how-to-make-a-calculator/​ (25Aug2020)
https://www.gamedev.net/forums/topic/707897-how-to-make-a-display-box-in-opengl-imgui/​ (30Aug2020)

In all three posts you've been told the same thing basic. While we are very willing to help, you must but some effort in and show what you have done, and where you are having issues. Constantly repeating the question with the same lack of information every five days or so, is doing no one any good.

Advertisement

thurizas said:

Hi,

By my count this is the third post on this that you have made (althought I'd swear that I'm missing one):

You did; I got four in total now:

https://gamedev.net/forums/topic/707645-how-to-make-buttons-in-imgui-in-opengl-with-glfw/​​ (2020-08-01)
https://gamedev.net/forums/topic/707855-how-to-make-a-calculator/​​ (2020-08-26)
https://gamedev.net/forums/topic/707897-how-to-make-a-display-box-in-opengl-imgui/​​ (2020-08-31)
https://gamedev.net/forums/topic/707922-how-to-make-a-calculator-in-c-with-imgui-opengl/​ (2020-09-01)

On one hand, I feel like we should cut him some slack - he's 11. On the other hand, he's had plenty of constructive input for very vague problem descriptions.

@shaanveer I think the best for you to do is to overcome this hurdle with needing others to provide your code, or needing a video tutorial.

You should start tinkering with code. Reading, understanding etc. And you should remember that C++ and Dear ImGui is complicated stuff. Especially to somebody who isn't yet an experienced programmer. Do C++ lessons, then look into OpenGL and finally use Dear Imgui.

And it has been said many, many times before; there's no right language. The important part is that you get started with something, and learn. I've suggested GoDot, but after giving it a lot of thought I think you should really just do beginner Python tutorials, or if you insist; C++ tutorials. Not video ones necessarily. I can recommend this.

And then return here when you have concrete issues. That is; when you don't know why a particular piece of code misbehaves, or you want to know what the difference between a struct and a class is etc. Not to ask for ready code or draw-by-numbers tutorials.

Let's to make for him a very simple example with ImGUI with one button and one label. A caption of the button will be “Click Me” and when we press the button the label will display “The button was clicked”. I would make the example but I practice with WebGL/TypeScript and Blender/GIMP now:

8Observer8 said:
I would make the example but I practice with WebGL/TypeScript and Blender/GIMP now:

I'm so confused right now.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

fleabay said:
I'm so confused right now.

Why?

This topic is closed to new replies.

Advertisement