Hey all, I have found some source code for setting up a function for printing coloured text in a DOS window. However Im unsure about the x, y co-ords.
The function has some parameters passed into it including the x-y coords, the way I want to use this function is like a standard cout, so it just prints certain text in a different colour. I understand this code looking at it with an explanation, however I am unsure about modifying it. I may be jumping the boat a bit here. But if I miss out the x- y coords will it still work. Im gonna try it anyway, but just wondering if an expert can give me some advice.
void DrawColorString(string szText, int X, int Y, WORD color)
{
HANDLE OutputH;
COORD position = {X, Y};
Please ignore my last I have done it. Really need more faith in myself. Just first time I've changed other peoples functions without knowing weather it will work 100%. I feel quite good about myself. I know it aint much but to me it is, lol.
dream_coder wrote:Please ignore my last I have done it. Really need more faith in myself. Just first time I've changed other peoples functions without knowing weather it will work 100%. I feel quite good about myself. I know it aint much but to me it is, lol.
its the little things that make it all worth while
True. Just need to find a way to change the text back to the original color as that function only seems to let me change it to Red, Green or Blue. I have an idea about this. Going to try and implement it tomorrow night, will let you know if its a success or not. Just cant believe Im spending time on changing the colour of text when I could be doing more vital stuff for my Text RPG, still never mind, its a learning experience.
OK Ive just got the text to change back to its original color. WHich as a bit of a nightmare. I found a tutorial for it on MSDN but it used a totally differnt routine to the once I was using. So I had to bastardise the code a bit to get it to work with my function. Just need to read up a bit on pointers now, as the code uses it and Ive had a complete memory loss about them as it is years since Ive touched them. Also got the "->" which im not sure on. But gonna swot up a bit, as I dont like using code that I dont understand. Gonna post my function in the code snippets section.