Adding Buttons in DOS [closed]
How can I add a button in a c++ dos evironment? One where when you click it, it creates a response from the game. (If there is a library and an A file, I can add those)
... in which case I would suggest Allegro 4.2 for DOS. But that only works in 80386 and higher CPUs, not 16-bit computers.
Would this help ?
http://www.stanq.com/dosbuttons.html Or we have Allegro I would recommend Allegro
You can have a look of a review of allegro here on my blog. And get the UI Button and other widget manual here
To learn allegro you can read: Game Programming All In One by Jonathan S. Harbour. . It is a good one for beginners.
Command line is pretty much text only. If you want to use the mouse, or any kind of non-text GUI you will need a library and the library you use depends entirely on what you want to do.
You should use a UI library if you want to create UI type things. MFC, QT or Win32 API are one's I know about for windows. In the Console, I think it would be very hard to create buttons.
You will need to get the coordinates of the mouse click and determine if they are within the with button. If they are within the button, you should change the button's color to indicate a press, then perform some action (or execute through a function pointer).
This is how most GUI frameworks handle buttons.
(You may want to move away from DOS and use a Graphics Framework for Windows.)
精彩评论