OS: Windows 7
IDE: Code::Blocks 16
Programmer type: passionate newbie
Hi, I'm familiar with C++ from basics to classes. But I have no experience in graphics. And it sounds to have hundreds of libraries each consists of thousands of function. So, I'm confused and I don't know how to start. However, all what I need right now is a way to set the colors of specific pixels on the console window. I could do that using SetPixel() WinAPI except that:
1: It's extremely slow.
2: I don't know how to use it to permanently color pixels (all colors goes once the user scrolls the client area or resizes the window or do anything that redraw the window)
Possible forms of the question:
-How to quickly set pixel colors in the console window?
-What's a better replacements of SetPixel() WinAPI?
-What's a good reference to start learning graphics?
Please note that I'm looking for simple solutions. But all answers are appreciated.
Before Windows Vista every Windows program had to keep track of what was drawn in the program's client area and redraw when needed (Windows sent the program a WM_PAINT message).
With Vista, and beyond, redrawing parts or all of a window that need repainting was taken over by the OS when desktop composition was enabled.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969540%28v=vs.85%29.aspx
From Vista to Win 7 a program could turn off or turn on DWM (Desktop Window Manager). With Win 8/10 desktop composition is always on.
If you want to learn Windows programming, especially graphics I would really suggest getting Visual Studio 2015 Community. It is free, yet is a full featured IDE. The Windows SDKs (Software Development Kits) needed to mash together a Windows app are either included or easily downloaded.
Visual C++ is not installed on a default install, you have to do a manual install. I also recommend if you do decide to install VS2015 you download the full ISO.
Another advantage of VS2015 is you can create 32-bit and 64-bit apps just by changing a single setting.
VS2015 does work on Win 7. I originally installed it when I was running Win 7.
Interesting references! Thank you @FurryGuy.
I already have Visual Studio 2010 installed (and I can't upgrade because no enough disk space on drive C:) but I love Code::Blocks and right now I don't want to dig deep into windows programming. I just wanna add some effects to my console application. And I already did it but my two main problems are:
1- all pixel colors goes when redrawing the window.
2- The SetPixel function is relatively slow.
But you are right! Sound that it's not that simple.
Have you looked at the Windows Api Console functions....
Yes. That's why I love the console window. it's simple and yet, It fit in with all my needs. I'm actually making a text-based user interface library for console windows. and I believe it's good enough for creating amazing and integrated applications.