Giter Site home page Giter Site logo

tetris's Introduction

Tetris

This is a tetris clone. I implemented it using c++ and sdl.
Feel free to use any part of my work.
The directory resources contains files used by the game. If you don't like
any of those, you can easily change them (I used very suggestive names).

How to install it

First, your need to install:
g++ sdl sdl_image sdl_ttf sdl_mixer
For arch run:

sudo pacman -S g++ sdl sdl_image sdl_ttf sdl_mixer

For fedora run:

sudo yum install g++ sdl sdl_image sdl_ttf sdl_mixer

Then change directory to tetris.
``` make ```

How to run it

Change directory to tetris.

./tetris

How to report a bug

If you find any bug, please contact me (I did my best to find all, but I
may have missed some) by submitting an issue at

https://github.com/berendeanicolae/tetris/issues

Thank you!

tetris's People

Contributors

berendeanicolae avatar

Watchers

 avatar  avatar

tetris's Issues

Show me the next tetrimino

Being some kind of tetris fan myself, I'd like to see which tetrimino comes next so I can plan where to put the current tetrimino in order to fill some lines, it's rather hard to play tetris knowing only the current tetrimino.

Resources

Place the resources here on github, don;t provide an external link for them, nobody will bother checking out your game if it's hard to compile and run...

Game::play and obvious comments

Game::play is a way too big method, I think it coudl be split up in somethign more readable, at least those initialization and clean-up parts.

Also you have comments like: //Variables or //Methods, these are useless, I recommend you get rid of them and read about docblocks instead (search for Doxygen after you've read about docblocks).

SDL_INIT_EVERYTHING

I doubt you need everything, because I couldn't find SDL_Joystick or SDL_CD in your source...

Don't init everything, you'll save some resources.

Right shifts for division

My advice would be not to use right shifts for division:
board_x=(screen->w-(boxh+1)*width+1)>>1;

It makes your code ureadable, I had to actually test what that does, which is not good for someone reading your code.

Makefile

I saw that you give instructions about compiling in the readme.
This is ok, but I recommend reading about Makefiles and make, with this you can automate the compiling part and you'll only need to give instructions on how to run & use the game, not compile it.

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.