|
| MushroomWobbit (21) | |
| I'm trying to make the tic tac toe console game from the beginners exorcises article, but i don't know any way to control the console. is there a way that i can make a very simple text based GUI that will let me highlight the different squares of the game board? and clear/redraw the screen, when i need to to? from what Ive read i shouldn't use any calls to system.. I'm using Code::Blocks as my IDE, and I'm on windows. any one know what i should do? i know i could prolly just get around it and ask the user for the coordinates, but i don't like that :< also id like to have a way of controlling the color of the text as well... and maybe formating the text that comes out... | |
Last edited on | |
| Bazzy (3181) | ||
Try PDcurses http://pdcurses.sourceforge.net/
| ||
| MushroomWobbit (21) | |||
| okay i'll look into that, how exactly do i use it? and what i ment were these types of things i shouldnt use
i think i read about a system() call that clears the screan but i read an article that says its evil.. | |||
Last edited on | |||
| NGen (161) | |
Use cin.get ( ) or something else along those lines instead of system ( "PAUSE" ). System is just overkill for anything, really. | |
Last edited on | |
| MushroomWobbit (21) | |
| @NGen i already knew that, and I'm trying to find out about ways of controlling the console, like clearing the screen, and changing the color of things, and the spacing between things. I'm new to c++ and i have no idea how to use PDcurses, it isn't a built in thing like #include <iostream> i don't think. | |
| firedraco (2048) | |
| Nope, it's not built in. Anyway, to change the spaces, you can use stream manipulators like setprecision() or fixed. For colors/stuff, that can vary by console/OS, so you are basically stuck using a 3rd party library like PDcurses. | |
| chrisname (1342) | |||
| N/PDCurses is good though. You'll need to download it; it will come with instructions on where to place it. If it doesn't; I'll tell you anyway: 1. Open CodeBlocks 2. Navigate to Settings -> Compiler and Debugger... 3. Find the "Search Directories" tab; and add the path where you placed the header (".h") files of PDCurses; e.g. C:\Program Files\CodeBlocks\PDCurses C:\Program Files\CodeBlocks\PDCurses\win32 4. Find the "Linker Settings" tab. Click "add" In Link Libraries and type the parths to the libraries, e.g. C:\Program Files\CodeBlocks\PDCurses\win32\panel.a C:\Program Files\CodeBlocks\PDCurses\win32\pdcurses.a 5. Then try the following code:
6. Read http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ Change <ncurses.h> to <curses.h> and all the example code should compile and work, even under windows. | |||
Last edited on | |||
| MushroomWobbit (21) | |
| i downloaded it but it seems to be a DLL file im confused now D: the file i got in the zip were: curses.h panel.h pdcurses.dll pdcurses.lib what do i do with those? | |
Last edited on | |
| Bazzy (3181) | |
| Why should a library confuse you? The only things you need to work with it are #including its header and linking to it curses.h is the file you need to include pdcurses.dll is for dynamic linking pdcurses.lib is for static linking | |
Last edited on | |
| chrisname (1342) | |
| So you have pdcurses.dll? You'll need to #include <curses.h> and then load the DLL; http://www.codeproject.com/KB/DLL/loadingdll.aspx That's the best I can do, I'm afraid, unless you download and install cygwin and use that... Edit: This simplifies things; you just have to statically link pdcurses.lib Otherwise you'd have to dynamically link pdcurses.dll; meaning if you were to distribute anything the DLL would HAVE to go along with it, in the same folder or, AFAIK, the system32 folder. | |
Last edited on | |
| MushroomWobbit (21) | |
| @bazzy it confuses me because I'm new to c++, i don't understand the workings of includes and what any of those linking things mean :( @chrisname i don't really understand this linking stuff... and that talks about VC++ I'll try to figure it out in code blocks tho.. thank you for putting up with my questions.. | |
| Bazzy (3181) | |||
If you link statically, all the contents of the library will be present in your binary file ( which will be heavier but more portable ) If you link statically, you must have the DLL in the computer to run the program. ( The binary file size would be smaller but you have to make sure that the library is installed in the computer ) chrisname already told you what you need to do, replace the names of the files he gave you to those you have the file downloaded:
The easiest way of installing curses to work with CodeBlocks on Windows is this: http://pdcurses.slashon.com/ - download the library from there - | |||
| Duoas (2964) | |
| Where to get and how to install PDCurses http://www.cplusplus.com/forum/beginner/11546/page1.html#msg54550 Basics of programming with PDCurses http://www.cplusplus.com/forum/beginner/5796/page1.html#msg25862 The basics of working with multiple source files http://www.cplusplus.com/forum/unices/2313/page1.html#msg8761 A simple example of a working PDCurses program and how to compile it on Windows with MinGW: http://www.cplusplus.com/forum/general/497/page1.html#msg1734 Good luck! | |
| chrisname (1342) | |
| I knew Duoas would come to the rescue.., | |
Registered users can post in this forum.
