GithubHelp home page GithubHelp logo

sdl_2048's Introduction

2048

  • Game 2048 cổ điển

Hướng dẫn cài đặt

  • Cài đặt Codeblock và SDL2, SDL_image, SDL_ttf.
  • Chạy file project sdl2048.cbp

Mô tả

Lấy ý tưởng từ game 2048, sử dụng 4 phím [UP], [DOWN], [LEFT], [RIGHT] để di chuyển các ô số và gom lại để đạt được 2048

Các chức năng

  • Màn hình chính của game với board 4x4
  • Hiện điểm hiện tại
  • Lưu điểm cao
  • Có thể chuyển qua New Game trong khi đang chơi hoặc tự động chuyển khi thua
  • Thông báo thắng/thua

Video: https://www.youtube.com/watch?v=UwLhSaLMO64

Kỹ thuật đã sử dụng

  • Xử lí sự kiện chuột, bàn phím

  • Sử dụng các extension của thư viện để tạo màn hình game

  • Render chữ lên màn hình với SDL_ttf

  • Sinh số giả ngẫu nhiên

  • Các thư viện chuẩn của C++

  • Cách cấp phát động và quản lí bộ nhớ

  • Tách file và quản lý file trong project

Kết luận

2048 là tựa game kinh điển đã xuất hiện cách đây khá lâu, và giờ em đã được thử sức làm lại nó với C++ và SDL_2. Mặc dù chưa được hoàn chỉnh các chức năng nhưng em nhận thấy được rằng ngôn ngữ trong lập trình không quá quan trọng, quan trọng là cần hiểu vấn đề cặn kẽ và sử dụng các công cụ một cách hợp lý.

sdl_2048's People

Contributors

nghinn1012 avatar

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.