Using the win32-console the not-so-usual way

This is a discussion on Using the win32-console the not-so-usual way within the Tech Board forums, part of the Community Boards category; Hey, I'm sharing a little application I have worked on these last days. Nothing exceptional, especially for the ones who ...

  1. #1
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404

    Using the win32-console the not-so-usual way

    Hey,

    I'm sharing a little application I have worked on these last days. Nothing exceptional, especially for the ones who aren't new to programming. But it might be interesting for the newer ones. Especially for those who tought you couldn't do anything "interesting" with the "console". Or those who have never used system specific functions.

    Here's the link to the web page
    win32console-labyrinth

    I had the idea while browsing MSDN. I though about "hey, I don't know if it would work" and decided to write a little program (only as a proof of concept).

    [By the way, don't look too much at the code, especially the design, it's bad from start to finish. I'm quite new to C++ (but not C).].
    I hate real numbers.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    LOL.... Wow, that looks..... just from the screenshot.... like it would be messy code....

    Looks like you had fun writing it, though.

  3. #3
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404
    LOL.... Wow, that looks..... just from the screenshot.... like it would be messy code....
    You saw that just from the screenshot ?

    Did you try running the application ?

    On a side note, it took more time looking at the documentation than actually writing the code. It wasn't that fun to write, I just wanted to see if it would actually work.
    I hate real numbers.

  4. #4
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    I didn't compile it, but I did look through the source code briefly just now. It does look kind of..... involved.

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,488
    Good one. Consoles are always fun with me. But I can guarantee you will have more if you give ncurses a shot.

    Noticed you had a pretty bit of fun with exceptions You should probably drop most of them and replace with more traditional error checking methods. Or, better yet, since you are lerning C++ try to give them a little bit more of personality and create your own exception handling classes.

    Also... consider declaring enums outside class definitions. It works very well if you couple that with namespaces.

    I liked it overall. Small, organized and easy to understand code.
    Last edited by Mario F.; 07-11-2008 at 07:31 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    Chinese pâté foxman's Avatar
    Join Date
    Jul 2007
    Location
    Canada
    Posts
    404
    Quote Originally Posted by Mario F. View Post
    But I can guarantee you will have more if you give ncurses a shot..
    Well I found the services provided by the Windows API fairly exhaustive. The only bad thing -- and the good one, too -- is that the most interesting stuff is fairly low-level. But since I have never worked with ncurses, I couldn't really tell.

    Noticed you had a pretty bit of fun with exceptions You should probably drop most of them and replace with more traditional error checking methods. Or, better yet, since you are lerning C++ try to give them a little bit more of personality and create your own exception handling classes.
    I do feel there's something not totally correct with the way I have used exception, but I'm not really sure what should I have done instead. I mean, in the 2 principal functions (Labyrinthe::Labyrinthe (loading the labyrint) and Jeu::Jeu(setting up the input and screen buffer)), there was quite a good amount of "special case" or "potential error" that I needed to check for the program not to crash, so... well, that's how I explain the fact there's a lot of "exception throwing places".

    But thanks for the comments.
    I hate real numbers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Adding a console window to a Win32 app
    By VirtualAce in forum Game Programming
    Replies: 7
    Last Post: 02-01-2009, 12:09 PM
  2. Console program to Win32
    By Ducky in forum Windows Programming
    Replies: 3
    Last Post: 02-25-2008, 11:46 AM
  3. making a stealthy win32 console application?
    By killdragon in forum C++ Programming
    Replies: 3
    Last Post: 09-08-2004, 02:50 PM
  4. confusion win32 -console app
    By GanglyLamb in forum C Programming
    Replies: 2
    Last Post: 06-11-2003, 10:12 AM
  5. win32 apps compiled with GCC start console window!
    By Citrus538 in forum Windows Programming
    Replies: 5
    Last Post: 02-18-2002, 09:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21