examples: tetris: remove GLFW dependency
parent
9bcbb3868f
commit
39bd058acf
|
@ -1,17 +1,2 @@
|
||||||
<img src='https://raw.githubusercontent.com/vlang/v/master/examples/tetris/screenshot.png' width=300>
|
<img src='https://raw.githubusercontent.com/vlang/v/master/examples/tetris/screenshot.png' width=300>
|
||||||
|
|
||||||
Tetris has a temporary dependency on GLFW.
|
|
||||||
|
|
||||||
FreeType is needed to display the score and some text. A smaller stb library is going to be used instead.
|
|
||||||
|
|
||||||
## macOS
|
|
||||||
`brew install glfw freetype`
|
|
||||||
|
|
||||||
## Ubuntu
|
|
||||||
`sudo apt install libglfw3 libglfw3-dev libfreetype6-dev libssl-dev`
|
|
||||||
|
|
||||||
## Arch (and Manjaro)
|
|
||||||
`sudo pacman -S glfw-x11 freetype2`
|
|
||||||
|
|
||||||
## Windows
|
|
||||||
Copy `thirdparty/glfw/glfw3.dll` & `thirdparty/freetype/win64/freetype.dll` to this directory.
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import rand
|
||||||
import time
|
import time
|
||||||
import gx
|
import gx
|
||||||
import gg2 as gg
|
import gg2 as gg
|
||||||
import glfw
|
|
||||||
import sokol
|
import sokol
|
||||||
import sokol.sapp
|
import sokol.sapp
|
||||||
import math
|
import math
|
||||||
|
@ -236,7 +235,7 @@ fn (mut g Game) run() {
|
||||||
g.move_tetro()
|
g.move_tetro()
|
||||||
g.delete_completed_lines()
|
g.delete_completed_lines()
|
||||||
}
|
}
|
||||||
glfw.post_empty_event() // force window redraw
|
//glfw.post_empty_event() // force window redraw
|
||||||
time.sleep_ms(timer_period)
|
time.sleep_ms(timer_period)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +413,7 @@ fn on_event(e &sapp.Event, game mut Game) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (game mut Game) key_down(key sapp.KeyCode) {
|
fn (mut game Game) key_down(key sapp.KeyCode) {
|
||||||
// global keys
|
// global keys
|
||||||
match key {
|
match key {
|
||||||
.escape {
|
.escape {
|
||||||
|
|
Loading…
Reference in New Issue