drw.c

来自「a source code for banker s algorithm」· C语言 代码 · 共 41 行

C
41
字号
#include<windows.h>
#include<glut.h>
#include<gl.h>
#define screenH 480

void myInit(void)
{
	glClearColor(1.0,1.0,1.0,1.0);
	glColor3f(0.0f,0.0f,1.0f);
	glPointSize(4.0);
	gluOrtho2d(0.0,640.0,0.0,480.0)
}

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

void drawDot(int p,int q)
{
	glBegin(GL_POINTS);
	glVertex2i(p,q)
	glEnd();
	glFlush();
}

void myMouse(int x int y)
{
	drawDot(x,screenH - y);
}
void main(void)
{
	glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
	glutInitWindowSize(640,480);
	glutInitWindowPosition(100,100);
	glutCreateWindow("massive");
	glutDisplayfunc(myDisplay);
	glutPassiveMotionFunc(myMouse);
	myInit();
	glutMainLoop();
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?