#include <gl/glut.h>
#include <time.h>
#include <Windows.h>
#include <stdio.h>
#include <math.h>
float hour;
float minute;
float second;
int week;
float lastSecond;
GLuint textList;
char* weekStr[] = { "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期天" };
void getTime()
{
time_t now;
struct tm timenow;
time(&now);
localtime_s(&timenow, &now);
lastSecond = second;
hour = timenow.tm_hour;
minute = timenow.tm_min;
second = timenow.tm_sec;
week = timenow.tm_wday;
}
void selectFont(int size, const char* face)
{
HFONT hFont = CreateFontA(size, 0, 0, 0, FW_MEDIUM, 0, 0, 0,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, face);
HFONT hOldFont = (HFONT)SelectObject(wglGetCurrentDC(), hFont);
DeleteObject(hOldFont);
glDeleteLists(textList, 256);
textList =
OpenGL显示时钟
最新推荐文章于 2022-08-10 12:55:29 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)