zacharygraber / termbox-tetris Goto Github PK
View Code? Open in Web Editor NEWTetris in the terminal using termbox2
Tetris in the terminal using termbox2
We are currently checking the size of the window/terminal on launch to make sure there's enough space; however, we should re-check every time the window is resized as well. Resize events are captured by termbox, so this should be simple.
If the user resizes the terminal to be too small, it would likely be best to pause the game and display a message asking them to resize.
I discovered this nice little Tetris game to evaluate termbox2. Please add some compile instructions to the README.
I got it to work with this:
gcc -lm tetris.c -o tetris
Nice work!
Is your feature request related to a problem? Please describe.
With current configuration, the game can be small, only occupying roughly 20x20 characters in the terminal.
Describe the solution you'd like
A scale factor should be added to the game that controls how large the rendered squares are from draw_block(...)
. The game could also intelligently choose the largest possible scale factor (constrained by terminal character width/height) on startup and after any window resize events.
Describe alternatives you've considered
Most terminals worth their salt let you resize text anyway, but having this native would be cool.
Describe the bug
The screen gets filled with a small or large amount of garbled text, which doesn't go away until something (e.g. a game piece) moves overtop it.
To Reproduce
Reproducing is inconsistent, and I'm not yet sure what causes this to happen; however, I most often see it when clearing a line (i.e. when a line/row fills up and is cleared out).
Expected behavior
Obviously, this garbled text shouldn't show up. In fact, every call to render()
performs a tb_clear()
first, so I'm not sure how the junk persists on the screen even after that.
Environment:
gcc -Wall -Wextra -pedantic ./tetris.c -lm -lpthread
Like most Tetris games, the piece that's next up should be displayed somewhere (most likely in a box next to the board).
Is your feature request related to a problem? Please describe.
The game currently runs termbox2 in its default output mode, which only offers 6 colors other than black and white. Unfortunately, there are 7 tetrominoes, meaning that either 2 pieces have to share a color (undesirable), or one of the pieces needs to be white.
Describe the solution you'd like
Adding support for additional colors, for example via termbox's 256-color mode would alleviate this problem. Not all terminals support this mode, so it may be wise to include a compile/run flag that defaults the game to its regular 6-color mode.
Players should accumulate a score by clearing lines, etc., and certain score thresholds should increase the "level."
Successive levels will be more difficult, with pieces dropping quicker.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.