examples: tetris: remove GLFW dependency

pull/5154/head
Alexander Medvednikov 2020-06-01 13:04:46 +02:00
parent 9bcbb3868f
commit 39bd058acf
2 changed files with 2 additions and 18 deletions

View File

@ -1,17 +1,2 @@
<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.

View File

@ -8,7 +8,6 @@ import rand
import time
import gx
import gg2 as gg
import glfw
import sokol
import sokol.sapp
import math
@ -236,7 +235,7 @@ fn (mut g Game) run() {
g.move_tetro()
g.delete_completed_lines()
}
glfw.post_empty_event() // force window redraw
//glfw.post_empty_event() // force window redraw
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
match key {
.escape {