void displayStrings_CS(unsigned char *vram, int scrnx, int x, int y, char color, unsigned char *strings) { extern char charset[4096]; TASK *task = task_now(); char *hzset = (char *) *((int *) 0xfe8), *font; int k, t; //如果是英文模式 if(0 == task->lanmode) { for(; *strings != 0x00; strings++) { displayfont(vram, scrnx, x, y, color, charset + *strings * 16); //charset中有256个字符,每个字符占16个字节,编码顺序与ASCII码一样,所以如果要显示字母“A”,只需要在charset这个地址基础上加上65*16即可,也可以写成"A"*16 x += 8; //一个字符占用八个像素的宽度 //这个部分是自己写的,如果像素数超过了scrnx,即屏宽,那么要向下移动16个像素,并把x归0 if(x + 8 > scrnx) { y += 16; x = 0; } } } else if(1 == task->lanmode) { for(; *strings != 0x00; strings++) { //如果现在的是宽字符的第一个字节,那么就先不打印;如果是半角字符就直接打印出来 if(0 == task->lanbyte1) { if(0x81 <= *strings && *strings <= 0xfe) { task->lanbyte1 = *strings; } else { displayfont(vram, scrnx, x, y, color, hzset + *strings * 16); } } else { k = task->lanbyte1 - 0xa1; t = *strings - 0xa1; task->lanbyte1 = 0; font = hzset + 16 * 256 + 32 * (k * 94 + t); display_widefont(vram, scrnx, x - 8, y, color, font); display_widefont(vram, scrnx, x - 8, y + 8, color, font + 16); } x += 8; } } return ; }
void display(void) { glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); displayfont(); if (trackballMove) { glPushMatrix(); glLoadMatrixd(TRACKM); glRotatef(angle, axis[0], axis[1], axis[2]); glGetDoublev(GL_MODELVIEW_MATRIX, TRACKM); glPopMatrix(); } openglPath(); //we must disable the opengl's depth test, then the software depth test will work //glDisable(GL_DEPTH_TEST); //glDisable(GL_LIGHTING); softPath(); //glEnable(GL_LIGHTING); //glEnable(GL_DEPTH_TEST); glutSwapBuffers(); }
void displayStrings_CS(unsigned char *vram, int scrnx, int x, int y, char color, unsigned char *strings) { extern char charset[4096]; for(; *strings != 0x00; strings++) { displayfont(vram, scrnx, x, y, color, charset + *strings * 16); //charset中有256个字符,每个字符占16个字节,编码顺序与ASCII码一样,所以如果要显示字母“A”,只需要在charset这个地址基础上加上65*16即可,也可以写成"A"*16 x += 8; //一个字符占用八个像素的宽度 //这个部分是自己写的,如果像素数超过了scrnx,即屏宽,那么要向下移动16个像素,并把x归0 if(x + 8 > scrnx) { y += 16; x = 0; } } }