i havent been on here in so long coz of school.. but i wanted to see if anybody on here does programming in c++.. i got some assignment and my teacher hasnt really taught us anything, so i have like no clue where to start.. this is basically what the assignment is:
Write a windows program that neatly displays an equalateral (and equal angled) pentegon, a square, and an equilateral triangle in a window.
1) The title bar of the window will include your full name and your FAU email address.
2) When the user presses an arrow key the pentegon and only the pentegon will move slightly in the direction of the arrow.
3) When the user presses page-up the triangle will grow in size. (It will remain an equilateral triangle, and it's center will not move. )
4) When the user presses page-down the triangle will shrink in size. (It will remain an equilateral triangle, and it's center will not move. )
5) When the space bar is pressed all three graphic objects will change to a new random color
i know its simple but i just came out of C so im not familiar with the c++ set up yet.. thanks fellas
This is a very simple starter exercise even though it looks formidable at first sight - There are about a million ways to do it - one way is to use OpenGL
that helps a little but im still having trouble trying to figuring it all out.. im trying to work off a sample code my professor gave us, but he hasnt explained enough for me to know what it all means so im just kinda guessing at it.. which isnt working out to well
i'd have said openGL as well but how does that have anything to do w/ c++??? seems a pretty tough first assignment to have anything graphical in a straight programming class. whatever happened to hello world..? lol
lol @ hello world, i remember those days. my background was in firmware C/C++ so i can't help you when you comes to GUI stuff, sorry.
have you tried using google to see if there's any sample code/excercises that you can read and/or adapt (not copy of course) for your own benefit to help you with your assignment? sometimes i find something of use when i'm stuck on something.
would u all believe on my way home from that class, the filler neck like right under the radiator cap on my gs bursts..how gay, gotta wait till thursday for the part, cost like 160 all together... but this is what i got so far, that ive figured out, yea the opengl didnt really help to much but eh... im working on trying to get the pentagon to move with a case VK_UP now
you are very close to the finish line - you only need a few lines of extra code to make it work. Think of it this way - when you press a key - you are not making a box "grow" literally - you are just changing its coordinates....
LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HDC hDC;
PAINTSTRUCT Ps;
HPEN hPen;
HPEN hPen2;
HPEN hPen3;
int red=20,green=20,blue=200;
int red2=0,green2=0,blue2=0;
int red3=0,green3=0,blue3=0;
int tx1=300,tx2=200,tx3=100,ty1=450,ty2=270,ty3=450;
int px1=600,px2=505,px3=410,px4=446,px5=564,py1=339,py2=270,py3=339,py4=451,py5=451;
POINT triangle[3]={{tx1,ty1},{tx2,ty2},{tx3,ty3}};//triangle location
static POINT Point2[5]={{px1,py1},{px2,py2},{px3,py3},{px4,py4},{px5,py5}};//pentagon location
ive successfully got it to changed colours repeatedly but with my VK_PRIOR param, i cant get the window to remain in the changed form, so when the page up is hit again it continues to increase in size.. my screen keeps going back to the original shapes.. and does anyone know how to get the rand() function to initialize the randomated number for my colors to an int
Last edited by madLyrical on September 14th, 2008, 12:20 am, edited 1 time in total.
WM_PAINT is the only place where you should "draw" - all other handlers should be used to change the parameters only and should not be used for drawing. Whenever Invalidate() is called the WM_PAINT will automatically be executed.