Giter Site home page Giter Site logo

termbox-tetris's Introduction

Termbox Tetris

forthebadge forthebadge forthebadge forthebadge

An unnamed tetromino game (please don't sue me) in the terminal using termbox2

Buy Me A Coffee

A GIF of the game

termbox-tetris's People

Contributors

zacharygraber avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

termbox-tetris's Issues

Visual Artifacting / Corruption

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.

Screenshots

Environment:

  • OS: Ubuntu 20.04.1 LTS running on top of WSL 2, in Windows Terminal
  • Compile flags/command: gcc -Wall -Wextra -pedantic ./tetris.c -lm -lpthread

More Robust Handling of Window Resize Events

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.

Implement Terminal-Size-Aware Scaling

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.

Add Support for Extended Colors

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.

Add Compile Instructions

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!

[Core Feature] - Scoring and Levels

Core Feature

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.