This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "mcpServers": { | |
| "weather": { | |
| "disabled": false, | |
| "timeout": 60, | |
| "command": "uv", | |
| "args": [ | |
| "--directory", | |
| "/home/lin/computer_science/usage/MCP/weather", | |
| "run", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import time | |
| async def say_after(delay, what): | |
| await asyncio.sleep(delay) | |
| # 挂起task, 执行asyncio.sleep(), 并向定时器注册 | |
| return f"{what} - {delay}" | |
| #async def修饰的method调用时返回coroutine object, 而非立即执行 | |
| #必须显示 asyncio.run() 或 await 来包装成task入列等待执行 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| //宏定义 | |
| #define W 1000 | |
| #define H 1000 | |
| #define GUARD(Deter , Source) { \ | |
| if ((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s" , (Source) , SDL_GetError()); \ | |
| return -1; \ | |
| } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| //宏定义 | |
| #define W 1000 | |
| #define H 1000 | |
| #define GUARD(Deter , Source) { \ | |
| if ((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s" , (Source) , SDL_GetError()); \ | |
| return -1; \ | |
| } } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| #define W 1000 | |
| #define H 1000 | |
| #define GUARD(Deter , Source) { \ | |
| if ((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s", (Source), SDL_GetError()); \ | |
| return -1; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| #define W 1000 | |
| #define H 1000 | |
| #define GUARD(Deter , Source) { \ | |
| if ((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s", (Source), SDL_GetError()); \ | |
| return -1; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //遍历修改像素颜色,达到绘画的效果 | |
| #include <SDL.h> | |
| #define W 1000 | |
| #define H 1000 | |
| #define GUARD(Deter , Source) { \ | |
| if((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s", (Source), SDL_GetError()); \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| #define W 500 | |
| #define H 500 | |
| #define GUARD(Deter , Source) { \ | |
| if((Deter)) \ | |
| { \ | |
| SDL_Log("%s failed: %s", (Source), SDL_GetError()); \ | |
| return -1; \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| #undef main | |
| #define W 1200 | |
| #define H 800 | |
| int main() | |
| { | |
| //SDL_Init函数 返回值为int ——返回0表示创建成功 , 返回负数表示创建失败 可以使用SDL_GetError()来捕捉错误信息 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <SDL.h> | |
| #undef main | |
| int main() | |
| { | |
| //1.初始化 | |
| //SDL_Init函数 返回值为int ——返回0表示创建成功 , 返回负数表示创建失败 可以使用SDL_GetError()来捕捉错误信息 | |
| //SDL库提供了参数宏,SDL_INTT_VIDEO初始化图形设置,SDL_INIT_AUDIO初始化音频设置,SDL_TIMER初始化计时器等等 | |
| if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) |
NewerOlder