Use code from Visual Studio 2015 in Qt / Input-Output box
-
Hi. I've made a really basic iSpy game in Visual Studio 2015, using the console for input/output. Now that I know more c++ I've moved onto working on QT to display an image of a landscape, and then making a console-like input/output box to actually play the game. The problem I'm having is making this input/output box in the main window.
The questions I have are:
how would I make this console inside of the main window,
and how would I use the code from VS to make the game? Would I simply copy it over into my project and paste it where it should be?
Also, if you have a different direction you think I should take this project, feel free to say so.I'm super sorry about how vague so much of this is, but if you ask I'll do my best to explain in more detail. Thanks.
-
Hi,
Depending one what you want to do with that console maybe a QLineEdit + QPlainTextEdit combo would suite your needs.
Hope it helps
-
You said you're making your game under Qt, however you never specified or mentioned any graphical rendering engine, I assume you're not using OpenGL or any third party graphical rendering engine, or further more a third party Game Engine.
So, what I can think of when creating a console, is to maybe add a ListWidget (not ListView unless you know how to work with models, etc., etc.) and a textfield and a pushbutton.
So the structure for the input/output console would be like so (pardon my poor drawing skills):
So ultimately you will use the ListWidget to handle all the textual game information and even the information sent by the player, etc., etc. the QPushButton will serve as the actual event that will fire off the "trigger" that player has actually sent something, the TextEdit will simply act as the placeholder for player "commands" to send to the game.
Good Luck!
Cheers!
Edit
Didn't noticed this was questioned a month ago! My apologies if I caused necro-posting! just wanted to help!