Care to help a newbie?

Started by
14 comments, last by Utwo 22 years, 9 months ago
I think that when he''s just started to learn C++ he shouldn''t try the DX, its too compilcated. He should try out Allegro (I myself am using it and im very happy with it). Allegro is very portable. It works under Windoze, Dos, Unix, Linux and BeOs

Example of a small Allegro program

#include

int main( int argc, cha *argv) {
allegro_init();
set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);
textout(screen, font, "Hello World", 100, 100, makecol(255, 255,255);
readkey();
return 0;
}

though you may have problems building Allegro for Dev-C++,
The best thing about Allegro s that you dont have to worry about the windows stuff. You even can use OpenGl with Allegro, so that Allegro manages all the sound and input while OpenGl does all the 3D stuff. Allegro has some GUI functions too and there are some good GUI libraryes for Allegro too...

hmmm.... this post of mine seems to be an ad for Allegro :rolleyes:
Advertisement
I saw that there''s a MoveTo and LineTo procedure in the GDI, above. I didn''t know that - I just ported my Bresenham procedure from DJGPP. Wasn''t too hard, but hey! Now I''m happy - no more bulky Bresenham algorithm

coSyn
No one seemed to respond to the one person asking how to draw a single pixel If memory serves (been a while since i''ve used this), its

SetPixel(hdc, x, y, color);

GDI has just about everything for (2D) graphics, its just SLLLOOOOOWWWWW.

-Dan
quote:Original post by Verso
That was my first question when I switched from Visual Basic to c++; "all I want to do is be able to plot just one little pixel!" I, being relatively new to c++ myself, am still figuring it all out, but here''s what I think is going on; Graphics programmers used to program in dos, where you could call system interrupts to basically take over every aspect of the computer. This included setting the video card mode and writing directly to video memory. Then there was windows. Now, if you try to call interrupts or write to memory, you get a "general protection fault," basically, the Blue Screen of Death. This is Windows "protecting" the system. So now''a days, your only option is to cooperate with Windows, which means the GDI (slow Windows graphics), DirectX, or OpenGL (I''m sure there are more ways, but again, what do I know?).

My ill-credited recomendation would be to learn OpenGL, OR Win32 programming, and from there to DX (again, an awsome book - tricks of the windows game programming guru). With OpenGL, you can use GLUT to take care of stuff like switching screen modes, creating windows, etc, so it''s easier on beginning programmers. The only reason I switched to DX later was simply because I went to Barnes and Nobles to find an OpenGL book, and there was only one... sitting next to a whole row of DX books. In other words, it generally seems more supported.

(BTW, I know I shouldn''t post this as it contains "DirectX" and "OpenGL" within the same paragraph - people seem a little edgy around here...)



You can use system interrupts in windows 9x, but I''m not sure about NT. Ever played old dos games in a dos window? Some of them use standard VGA interrupts, others use other standards. You don''t need to use DX to write to the gfx card-it''s just needed to hit those high resolutions w/ high color depths. (Also it''s needed to use those neat hardware acceleration features of DDraw)

I see none of you have any idea of the Borland versioning...I have a copy of the Borland 4.5 and it''s for windows 3.1(!) and this guy has version 3.1... My suggestion is if you like borland better than dev-c++ then you can download v5.0 of the borland c++ compiler free. But I''ve never used dev-c++, do I don''t know which is better.
Why do you want to plot pixels? What kind of game use pixel graphic? I think you should ask how to read and plot a bitmap instead.

Good Luck with your learning!



Zeblar Nagrim, Lord of Chaos
Thanks for all of the help guys. I''m currently looking at Win32 programming, and I''ve begun to create some windows (with menus, icons and everything!). I still haven''t poured any actual "content" into those windows yet, but I''ll get there soon enough.

I''ve decided my first serious project will be to design a professional-looking, PC version of Mad Libs. You know, those books where you fill in blanks with words corresponding to different word types (nouns, pronouns, verbs, etc.), which complete a story. You then read the story, and laugh at the result.

The game will have a nice interface, tons of stories to choose from, and the ability to save and/or print the results.

I figure this should be low enough for me to aim right now.

Again, thanks for all of your help, people.
---signature---" Actually, at the time, I didn't give a damn about the FoxNews issue... just that you would come swooping in with your Super Mith cape flapping behind you and debunk it just because it didn't happen in your living room." - InnocuousFox

This topic is closed to new replies.

Advertisement