Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Countdown-Alert release  (Read 4590 times)

0 Members and 1 Guest are viewing this topic.

BruceJohnJennerLawso

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • My Code on Github
Countdown-Alert release
« on: February 16, 2014, 12:10:33 am »
Greetings fellow developers,

After my first try at developing a game engine in SFML, I decided to undertake a much smaller project to get my feet wet in SFML, as well as replacing a pair of heavily outdated C++ programs, which I used as an alarm clock & notification timer, respectively.

The project was hacked together in a relatively short time, but appears to work quite well for me. Hopefully someone else will find it useful as well. The project can be found at:

https://github.com/BruceJohnJennerLawso/Countdown-Alert/tree/master

Release 1.00 available here:

https://github.com/BruceJohnJennerLawso/Countdown-Alert/releases/tag/1.00

Any criticism/comments are welcome.
« Last Edit: February 16, 2014, 12:19:25 am by BruceJohnJennerLawso »
Quote
The computer is mightier than the pen, the sword, and usually the programmer.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Countdown-Alert
« Reply #1 on: February 16, 2014, 12:19:23 am »
Haven't had time to check things out fully (on my phone), but from what I saw you might want to read up on OOP and no, namespaces don't encapsulate things properly. The main issue is that your objects are mostly globals and you should try not to use globals. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

BruceJohnJennerLawso

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • My Code on Github
Re: Countdown-Alert release
« Reply #2 on: February 16, 2014, 12:22:59 am »
Admittedly, it definitely would read much better if it were object oriented, but I mostly wanted to get something working regardless of how pretty it was.

Hmm yeah, globals are bad, although I don't see the issue as being too bad in a small program like this. A button class probably would help to clean things up a fair bit I guess...
Quote
The computer is mightier than the pen, the sword, and usually the programmer.

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Countdown-Alert release
« Reply #3 on: February 17, 2014, 02:17:32 pm »
It's pretty obvious that you're coming from a C background. I think you should read a good, modern C++ book to learn about the new, wonderful features of the language. There's a list of recommended books here: http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list

It'll be a strange transition if you're really used to defines, macros, malloc etc, but features such as templates and smart pointers more than make up for it. :)
Current Projects:
Technoport

BaneTrapper

  • Full Member
  • ***
  • Posts: 213
  • Do you even see this, i dont need it.
    • View Profile
    • Email
Re: Countdown-Alert release
« Reply #4 on: February 17, 2014, 02:30:10 pm »
Not to sound grumpy, but i had no clue whats the project about on glimpsing your post.
Went on to download to see if it is a fellow game dev and i end up finding i am missing OpenAL32.dll witch is ok.
On deeper reading i figured out its a clock application ^^ suggesting to "point it out" what your project is.
Also writing to report i cannot run the application. Win 7 32bit user.
BaneTrapperDev@hotmail.com Programing, Coding
Projects: Not in development(unfinished/playable):
http://en.sfml-dev.org/forums/index.php?topic=11073.msg76266#msg76266
UP and in Development: The Wanderer - Lost in time
http://en.sfml-dev.org/forums/index.php?topic=14563.0

BruceJohnJennerLawso

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • My Code on Github
Re: Countdown-Alert release
« Reply #5 on: February 17, 2014, 11:14:11 pm »
@The Terminator, actually Ive never coded in C before, only C++. It just looks like it, because the project is butt ugly; I really needed to throw together something effective fast, & the style could wait until later. I am generally familiar with most of the features in C++, but if you think something in particular would help here besides OOP, please let me know ;)

@BaneTrapper, sorry for the vagueness, I'll have to redo the explanation once I'm a little more clear-minded ::)
The openal32.dll file actually was packaged in the release too, not sure how you were missing it. I should ask whether I am allowed to include that with my releases? It is included with the SFML binaries, but I dont think the average end user will have it handy on their computers.

About issues running the program, are you trying to compile the source code, or use the zipped version under release 1.00? Do you have a C++ compiler (& by extension the standard library) installed?

Thanks for the bug report too. :)
Quote
The computer is mightier than the pen, the sword, and usually the programmer.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Countdown-Alert release
« Reply #6 on: February 18, 2014, 01:07:45 am »
The openal32.dll file actually was packaged in the release too, not sure how you were missing it. I should ask whether I am allowed to include that with my releases? It is included with the SFML binaries, but I dont think the average end user will have it handy on their computers
According to the SFML license file, openal32.dll is under the LGPL license ("Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.")
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Countdown-Alert release
« Reply #7 on: February 18, 2014, 10:14:56 am »
I am generally familiar with most of the features in C++, but if you think something in particular would help here besides OOP, please let me know ;)
A few points, some of them have already been mentioned:
  • Avoid #define for constants, use const instead
  • Avoid global variables
  • Avoid manual memory management, use RAII instead. This also fixes the tons of memory leaks...
  • Declare variables as locally as possible (e.g. iterators inside for loops, local variables when they're first used).
  • Don't pass containers by value unless you want to copy/move them
  • Replace if (x) return true; else return false; with return x;
  • Use the correct types (std::size_t instead of int for indices).
  • Avoid undefined behavior such as this->~TTxt_File(); -- never call destructors explicitly
  • It's useless to clear containers or to set member variables in the destructor (RAII cleans up automatically, and it's not allowed to inspect member variables after destruction anyway).
  • switch for bool expressions is questionable, why not if?
  • You're having far too many parentheses, it looks like you don't know the operator priorities
  • The naming convention is inconsistent
  • Use const-correctness, methods that don't modify the object should be const-qualified
  • Don't write using namespace std; if you don't really need it
  • Use type inference for iterator declarations
C++ is more than just the language features, it's crucial to know common idioms and best practices to develop efficiently and write maintainable code. I strongly advise to read a book in that direction. It needn't be a beginner book, but something like Effective C++ or Exceptional C++ would be a good idea. You might want to wait for their C++11 versions, since the way how C++ code is written has changed in several parts...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

BruceJohnJennerLawso

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • My Code on Github
Re: Countdown-Alert release
« Reply #8 on: February 23, 2014, 02:58:37 am »
Update on progress so far:

-Colour, and audio files are now customizable through the alert menu.
-hh:mm:ss input now added

Once the documentation is done, I will be releasing v1.1

 8)
Quote
The computer is mightier than the pen, the sword, and usually the programmer.

BruceJohnJennerLawso

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
    • My Code on Github
Re: Countdown-Alert release
« Reply #9 on: February 25, 2014, 05:16:45 am »
Quote
The computer is mightier than the pen, the sword, and usually the programmer.

 

anything