Click here to Skip to main content
16,014,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to enable the port in menubar? Pin
anuchelvi12-Sep-04 19:15
anuchelvi12-Sep-04 19:15 
AnswerRe: How to enable the port in menubar? Pin
Iain Clarke, Warrior Programmer13-Sep-04 3:28
Iain Clarke, Warrior Programmer13-Sep-04 3:28 
GeneralCListCtrl Pin
Neelesh K J Jain12-Sep-04 18:44
Neelesh K J Jain12-Sep-04 18:44 
GeneralEncrypt/Decrypt Pin
Timothy Grabrian12-Sep-04 17:13
professionalTimothy Grabrian12-Sep-04 17:13 
GeneralRe: Encrypt/Decrypt Pin
Michael Dunn12-Sep-04 19:23
sitebuilderMichael Dunn12-Sep-04 19:23 
GeneralRe: Encrypt/Decrypt Pin
Alexander M.,13-Sep-04 5:12
Alexander M.,13-Sep-04 5:12 
QuestionHow to use combobox with UNICODE? Pin
Member 135496212-Sep-04 11:17
Member 135496212-Sep-04 11:17 
GeneralPolyline Editor in Open Gl Pin
csp200512-Sep-04 10:24
csp200512-Sep-04 10:24 
hi i have this program to do and i am kind of sttucked on the keyboard action

can someone wrote for me the KeyboardFunc with a switch statment and this is the program





a program that allows the user to enter and edit pictures made up of as many as
60 polylines. The user interacts with the screen by pressing the keyboard keys and
pointing and clicking the mouse. The functionality of the program should include the
following “actions”:
Begin (‘b’) – create a new polyline
Delete (‘d’) – delete the next point pointed to
Move (‘m’) – drag the point pointed to to a new location
Insert (‘i’) – insert a new point in the polyline
Refresh (‘r’) – erase the screen and allow user to start from sctrach
Quit (‘q’) – exit from the program
A list of polylines can be maintained in an array such as GlintPointArray polys[60].
The verb begin, activated by pressing the ‘b’ key permits the user to create a new
polyline, which is stored in the first available ‘slot’ in array polys.
The verb delete requires that the program identify which point of the polyline lies
closest to the point currently designated by the mouse. Once that point is identified,
the “previous” and “next” vertices in the chosen polyline are found. The two line
segments connect to the chosen vertex are erased, and the previous and next vertices
are joined with a line segment.
The verb move finds the vertex closest to the currently designated point and waits for
the user to click the mouse a second time, at which point the vertex is moved to the
new point. EQUAL marks will be allocated if you allow the user to click and drag the
point interactively!
Your program should also allow the user to read in a file containing a list of polylines
into an array and allow the user to manipulate these points.



















and this is the mouse function


#include <windows.h>
#include <gl gl.h="">
#include <gl glu.h="">
#include <glut.h>
const int screenHeight=480;

class GLintPoint{
public:
GLint x,y;
};

void myInit(void)
{
glClearColor(0.0,1.0,1.0,0.0);
glColor3f(1.0,0.0f,1.0f);
glPointSize(9.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0,440.0,0.0,480.0);

}

void myMovedMouse(int mouseX, int mouseY)
{
GLint x = mouseX; //grab the mouse position
GLint y = screenHeight - mouseY; // flip it as usual
GLint brushSize = 5;
glRecti(x,y, x + brushSize, y + brushSize);
glFlush();
}

void myMouse(int abutton, int state, int x, int y)
{
static GLintPoint points[3];
static int numPoints = 0; // initial value is 0
if(abutton == GLUT_LEFT_BUTTON && state == GLUT_DOWN)
{
points[numPoints].x = x;
points[numPoints].y = screenHeight - y; // flip y coordinate
numPoints++; // have another point
if(numPoints == 3)
{
glBegin(GL_POLYGON);
glVertex2i(points[0].x, points[0].y);
glVertex2i(points[1].x, points[1].y);
glVertex2i(points[2].x, points[2].y);
glEnd();
//Recti(corner[0].x, corner[0].y, corner[1].x, corner[1].y);
numPoints = 0; // back to 0 corners
}
}
else if(abutton == GLUT_RIGHT_BUTTON && state == GLUT_DOWN)
glClear(GL_COLOR_BUFFER_BIT); // clear the window
glFlush();
}

void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}

void main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(480, 480);
glutInitWindowPosition(100, 150);
glutCreateWindow("my first attempt");

glutDisplayFunc(myDisplay);

glutMouseFunc(myMouse);

glutMotionFunc(myMovedMouse);

myInit();
glutMainLoop();
}
GeneralSegmentation fault?! Pin
Whiphub12-Sep-04 9:39
Whiphub12-Sep-04 9:39 
GeneralRe: Segmentation fault?! Pin
Antti Keskinen12-Sep-04 10:44
Antti Keskinen12-Sep-04 10:44 
GeneralSwitching mainframe menu (solution) Pin
Ravi Bhavnani12-Sep-04 8:23
professionalRavi Bhavnani12-Sep-04 8:23 
GeneralRe: Switching mainframe menu (solution) Pin
KaЯl13-Sep-04 3:55
KaЯl13-Sep-04 3:55 
QuestionHOw to convert from EMF to SWF. Pin
Azghar Hussain12-Sep-04 7:49
professionalAzghar Hussain12-Sep-04 7:49 
AnswerRe: HOw to convert from EMF to SWF. Pin
Christian Graus12-Sep-04 11:52
protectorChristian Graus12-Sep-04 11:52 
QuestionLink/C-calling convention ? Pin
0v3rloader12-Sep-04 6:46
0v3rloader12-Sep-04 6:46 
AnswerRe: Link/C-calling convention ? Pin
Antti Keskinen12-Sep-04 9:38
Antti Keskinen12-Sep-04 9:38 
GeneralRe: Link/C-calling convention ? Pin
0v3rloader12-Sep-04 22:59
0v3rloader12-Sep-04 22:59 
GeneralRe: Link/C-calling convention ? Pin
Antti Keskinen13-Sep-04 4:15
Antti Keskinen13-Sep-04 4:15 
GeneralRe: Link/C-calling convention ? Pin
0v3rloader14-Sep-04 1:47
0v3rloader14-Sep-04 1:47 
GeneralEnvironment macro Pin
Rome Singh12-Sep-04 6:31
Rome Singh12-Sep-04 6:31 
GeneralRe: Environment macro Pin
Andrew Walker12-Sep-04 14:46
Andrew Walker12-Sep-04 14:46 
GeneralRe: Environment macro Pin
Rome Singh13-Sep-04 5:12
Rome Singh13-Sep-04 5:12 
GeneralRe: Environment macro Pin
Andrew Walker13-Sep-04 12:52
Andrew Walker13-Sep-04 12:52 
QuestionWarning: no message line prompt for ID *???? Pin
jettocrack12-Sep-04 6:13
jettocrack12-Sep-04 6:13 
AnswerRe: Warning: no message line prompt for ID *???? Pin
Ravi Bhavnani12-Sep-04 7:13
professionalRavi Bhavnani12-Sep-04 7:13 

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.