rust - 如何更改 Piston2D / PistonWindow / GlutinWindow 中的光标图标?
问题描述
像正常、忙碌或文本选择。我想创建一个桌面 Windows 应用程序,我需要更改它的图标。
解决方案
Piston 本身并不直接提供更改光标图标的功能。但是,在某些情况下,活塞会暴露底层窗口,这确实提供了该功能。
例如你提到GlutinWindow
的,我假设它glutin_window::GlutinWindow
来自pistoncore-glutin_window
板条箱。glutin::window::Window
它通过访问字段间接提供对底层的访问ctx
。
底层证券glutin::window::Window
确实有一个set_cursor_icon()
你可以指定的地方CursorIcon
。
use glutin_window::GlutinWindow;
use glutin::window::CursorIcon;
let wnd: GlutinWindow = ...;
wnd.ctx.window().set_cursor_icon(CursorIcon::Default);
wnd.ctx.window().set_cursor_icon(CursorIcon::Wait);
wnd.ctx.window().set_cursor_icon(CursorIcon::Text);
推荐阅读
- c - 向指针添加值
- c# - 将 Android 应用程序连接到 ASP.NET Web 服务:java.net.MalformedURLException:找不到协议
- c++ - 如何在现代 C++ 中使用生成器初始化 const 容器?
- java - 当用户名重复时以这种方式处理异常以返回消息
- c# - 在诊断完全分析编译后如何运行方法?
- python - 如何使用python编码ÿ?
- haskell - 什么是阴谋集团地狱?
- javascript - React history.push() 不渲染新组件
- scala - 在 scala spark2 到 hbase 中运行 saveAsNewAPIHadoopDataset 时出现空指针异常
- multithreading - Springboot 多线程定时运行