Thread: Tetrix game project [C / SDL library]

  1. #1
    Registered User
    Join Date
    May 2018
    Posts
    2

    Tetrix game project [C / SDL library]

    I hope this is the correct section because this is my first post and sorry for my bad english .
    I attacched my project to show you my problem. I created all structure i needed and i created a preview of tetrix field but I don't know how to detect if a field's box is occupied by a block.
    Can you explain me the algorythm to resolve my problem?
    Attached Files Attached Files

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,490
    1. You need to start doodling lots of diagrams like this, and figuring out what it means for two shapes to overlap (or not).Tetrix game project [C / SDL library]-20180601_165716-jpg

    2. You need to have done this before writing any code.

    Any programming assignment that takes longer than one keyboard session needs some design work up front, and some ongoing design work as you progress.
    Software development process - Wikipedia

    You don't need to go overboard for a relatively simple program such as this, but a few sketches and notes on paper will save you tons of effort down the line.

    You should also get into the habit of prototyping some of the difficult things (eg object collision detection) in advance. Simply picking the low hanging fruit, then wondering what to do next is a recipe for disappointment.

    Don't forget this either.
    Version control - Wikipedia
    By testing and committing regularly, you'll never be too far from a working version. Being able to 'diff' working and non-working is a powerful tool.

    There's no end of tales of woe on forums relating to "It used to work, but I've forgotten all the changes I made and now it doesn't work "
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    May 2018
    Posts
    2
    thank you Salem for you reply. You're right, I have so many shortcomings in the software development process because I'm an autodidact and i haven't read a book for SDL coding. I think I understand with your answer. Tomorrow I'll try to complete the project and I'll update you in case of problems.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Try the free C++ GUI library for your hobby project.
    By jinhao in forum Projects and Job Recruitment
    Replies: 24
    Last Post: 12-13-2011, 02:42 PM
  2. Try the free C++ GUI library for your hobby project.
    By jinhao in forum General Discussions
    Replies: 9
    Last Post: 12-08-2011, 11:53 PM
  3. Borland C++: load a library into a certain project
    By themsaman in forum C Programming
    Replies: 1
    Last Post: 08-25-2010, 09:26 PM
  4. Nana C++ Library, my opensource project
    By jinhao in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 12-24-2008, 11:48 PM
  5. help, linker errors when adding library file to project
    By ngcfan525 in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2003, 02:27 PM

Tags for this Thread