小编Zen*_*moa的帖子

试图让类型 `PointerState` 未初始化

我想尝试使用 Piston 在 Rust 中制作游戏。这是我第一次使用这个库。我从官方文档中获取了这段代码来测试它。但是,当我的鼠标触摸应用程序窗口时,它会立即关闭,我不明白为什么。

extern crate glutin_window;
extern crate graphics;
extern crate opengl_graphics;
extern crate piston;

use glutin_window::GlutinWindow as Window;
use opengl_graphics::{GlGraphics, OpenGL};
use piston::event_loop::{EventSettings, Events};
use piston::input::{RenderArgs, RenderEvent, UpdateArgs, UpdateEvent};
use piston::window::WindowSettings;

pub struct App {
    gl: GlGraphics, // OpenGL drawing backend.
    rotation: f64,  // Rotation for the square.
}

impl App {
    fn render(&mut self, args: &RenderArgs) {
        use graphics::*;

        const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];
        const RED: [f32; 4] = [1.0, 0.0, 0.0, …
Run Code Online (Sandbox Code Playgroud)

rust rust-piston

2
推荐指数
1
解决办法
640
查看次数

标签 统计

rust ×1

rust-piston ×1