PistonDevelopers / Piston-Tutorials

Tutorials for Piston
545 stars 89 forks source link

Sudoku tutorial: multiple digits drawn in a cell of the grid #225

Closed JimmyHypi closed 4 years ago

JimmyHypi commented 4 years ago

Hi, in the Sudoku tutorial, when drawing a character from the keyboard weird things happen: Instead of writing different characters in different cells the graphics engine concatenates the different images of the characters taken from the glyphs and prints them all in every cell. This is what happens. Empty Grid with selected cell: image

Type "1" on the keyboard: image

Select another cell: image

Type "3" on the keyboard: image

Repeat: image

And again: image

Looks like there's a buffer somewhere not emptying? Does anybody have an idea of what it can be? The code is the same as in the tutorial. Appreciate any help, thanks.

bvssvni commented 4 years ago

It's weird because cargo run seems to work fine here. Does the bug happens in your own project only?

xumasan commented 4 years ago

Hi. In my project, this problem is happened. Maybe, it happens bellow step.

  1. Clone this repository and delete Cargo.lock
  2. change the line in main.rs from ".opengl(opengl)" to ".graphics_api(opengl)".
  3. cargo run
JimmyHypi commented 4 years ago

So apparently as of right now, there's no "opengl()" (in main.rs) function available, I tried to downgrade the version of the crate in the "Cargo.toml" file to what it is in your dependencies, but there was no way to make it work. So what I did is to copy and paste the Cargo.lock file in the repository and keep the "opengl(opengl)" function and it worked, but I haven't checked the differences between the two lock files to be honest, that's really weird.

DerekCrosson commented 4 years ago

So apparently as of right now, there's no "opengl()" (in main.rs) function available, I tried to downgrade the version of the crate in the "Cargo.toml" file to what it is in your dependencies, but there was no way to make it work. So what I did is to copy and paste the Cargo.lock file in the repository and keep the "opengl(opengl)" function and it worked, but I haven't checked the differences between the two lock files to be honest, that's really weird.

Try changing your code to this:

let settings = WindowSettings::new("Sudoku", [512; 2])
      .graphics_api(opengl)
      .exit_on_esc(true);