Click here to Skip to main content
15,914,481 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conneting to a computer using socket Pin
bubuzzz8-Dec-09 22:07
bubuzzz8-Dec-09 22:07 
GeneralRe: Conneting to a computer using socket Pin
CPallini8-Dec-09 22:13
mveCPallini8-Dec-09 22:13 
GeneralRe: Conneting to a computer using socket Pin
Moak12-Dec-09 4:27
Moak12-Dec-09 4:27 
AnswerRe: Conneting to a computer using socket Pin
Moak9-Dec-09 2:31
Moak9-Dec-09 2:31 
GeneralRe: Conneting to a computer using socket Pin
bubuzzz10-Dec-09 21:51
bubuzzz10-Dec-09 21:51 
QuestionGenerating Tables in WORD Pin
Chandrasekharan P8-Dec-09 20:15
Chandrasekharan P8-Dec-09 20:15 
AnswerRe: Generating Tables in WORD Pin
CPallini8-Dec-09 21:05
mveCPallini8-Dec-09 21:05 
QuestionCopy File Folder Message Pin
NVCprog8-Dec-09 19:37
NVCprog8-Dec-09 19:37 
QuestionRe: Copy File Folder Message Pin
sashoalm8-Dec-09 21:14
sashoalm8-Dec-09 21:14 
AnswerRe: Copy File Folder Message Pin
Madhu Nair8-Dec-09 21:40
Madhu Nair8-Dec-09 21:40 
AnswerRe: Copy File Folder Message Pin
Rajesh R Subramanian8-Dec-09 22:37
professionalRajesh R Subramanian8-Dec-09 22:37 
GeneralRe: Copy File Folder Message Pin
NVCprog9-Dec-09 17:13
NVCprog9-Dec-09 17:13 
GeneralRe: Copy File Folder Message Pin
NVCprog11-Dec-09 18:56
NVCprog11-Dec-09 18:56 
QuestionHow to get exe Pin
jannathali8-Dec-09 19:17
jannathali8-Dec-09 19:17 
AnswerRe: How to get exe Pin
Cedric Moonen8-Dec-09 20:28
Cedric Moonen8-Dec-09 20:28 
Questionhow does an uninstall exe delete itself? Pin
includeh108-Dec-09 19:02
includeh108-Dec-09 19:02 
AnswerRe: how does an uninstall exe delete itself? Pin
o m n i8-Dec-09 20:47
o m n i8-Dec-09 20:47 
GeneralRe: how does an uninstall exe delete itself? Pin
includeh108-Dec-09 21:36
includeh108-Dec-09 21:36 
GeneralRe: how does an uninstall exe delete itself? Pin
David Crow9-Dec-09 2:17
David Crow9-Dec-09 2:17 
AnswerRe: how does an uninstall exe delete itself? Pin
David Crow9-Dec-09 2:19
David Crow9-Dec-09 2:19 
QuestionInheritance!!! Pin
Nilesh Hamane8-Dec-09 18:58
Nilesh Hamane8-Dec-09 18:58 
AnswerRe: Inheritance!!! Pin
Cedric Moonen8-Dec-09 20:26
Cedric Moonen8-Dec-09 20:26 
AnswerRe: Inheritance!!! Pin
cheetach8-Dec-09 20:28
cheetach8-Dec-09 20:28 
QuestionCombination C and OpenGL: Making a loop to draw circles [modified] Pin
Chidori-chan8-Dec-09 18:46
Chidori-chan8-Dec-09 18:46 
I'm in the process of making a simple 2D game and I'd like to put my three rows of circles into three loops where 15 are drawn and translated over 28 units for each time, but I've been running into some issues. Could I get ya'll to take a look at my code and explain what I'm doing wrong? Here's my code:





int Circle1 [20];


    for
    (Circle1=0; Circle1<15; Circle1++)
{
   
    glPushMatrix();
    glTranslatef(d+28,455,1);
        random_generator(0,3);
        if (randomValue == 0)
{
    glColor3f(0,.5,0);

}
        else if (randomValue == 1)
{
    glColor3f(.5,0,0);

}
        else
{
    glColor3f(0,0,.5);

}
    glLineWidth(1.0);
    drawCircle(14,200);
    glPopMatrix();
}


when I compile it I get errors for the


(Circle1=0; Circle1<15; Circle1++)



line of code saying:

In function 'displayFunction':
error: incompatible types when assigning to type 'int[20]' from type 'int'
warning: comparison between point and integer
error: lvalue required as increment operand


Ultimately I'm making a game in which you use a cannon to shoot the same color circles, you'll have a five minute timer to get rid of them all. There will be three rows of circles, with one of three randomly generated colors (red, blue or green). I got my random color generation working, but since I had it on every circle in the drawfunction the colors were changing everytime the screen refreshed. So I need to put the random color generation in my main function and use an array to point at my drawCircle function. However I thought it might be easier if I drew my circles with a for loop. It's 15 circles per row and I had been planning on doing three loops so I only had to worry about the x component.

What I was trying to do with that piece of code was to draw my 15 cicles, keep the y component and translate the x component over 28 units for each circle so you have:

OOOOOOOOOOOOOOO


a row of fifteen side by side circles

modified on Wednesday, December 9, 2009 3:01 AM

AnswerRe: Combination C and OpenGL: Making a loop to draw circles Pin
LunaticFringe8-Dec-09 19:43
LunaticFringe8-Dec-09 19:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.