Help with C++ Game Design patterns

This is a discussion on Help with C++ Game Design patterns within the Game Programming forums, part of the General Programming Boards category; I was taking my old design, and trying to make a better tile game framework to use. I am kind ...

  1. #1
    Registered User
    Join Date
    Oct 2006
    Location
    New York
    Posts
    123

    Help with C++ Game Design patterns

    I was taking my old design, and trying to make a better tile game framework to use. I am kind of stuck with some advice or ideas to implement a better way for my input handle class to move or do w.e manipulation for the stage class. Any ideas of what I could do to make my stage and command-input handler class work together?
    Attached Files Attached Files

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,406
    O_o

    Your "stage" is incredibly narrow. An array/list of layers to be drawn in any order is barely more complicated, yet such a form is far more versatile.

    Code:
    State * sStage = new Stage(/**/);
    // ...
    Layer * sLayer = sState->createCompatibleLayer();
    // ...
    sLayer->drawStuff(); // `sStage' draws every layer on "flip"
    Your "inputhandle" seems a pointless form of packing multiple events into a single frame to be later queried. You can pack a series of events which logically group Boolean values into a set over a specified slice of time with transforms provided by the client.

    Code:
    Whatever sCodes = [/* ordered code representing virtual keys */];
    Whatever sKeys = ['w', 'a', 's', 'd'];
    InputHandler * sKeyboard = new InputHandler(/**/);
    // ...
    sKeyboard->filter(sCodes, sKeys, 4);
    // ...
    InputHandlerWrapper sKeysDown(sKeyboard, KEYS_DOWN);
    //
    while(sPlayingGame)
    {
        if(InputHandlerWrapper['w']) // ...
        if(InputHandlerWrapper['a']) // ...
        if(InputHandlerWrapper['s']) // ...
        if(InputHandlerWrapper['d']) // ...
    }
    Soma
    “Often out of periods of losing come the greatest strivings toward a new winning streak.” -- Fred Rogers
    “Salem Was Wrong!” -- Pedant Necromancer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Patterns and anti-patterns
    By Neo1 in forum C++ Programming
    Replies: 3
    Last Post: 10-23-2013, 06:30 PM
  2. Useful Design Patterns?
    By h_howee in forum Game Programming
    Replies: 3
    Last Post: 03-31-2010, 04:16 PM
  3. Design patterns in C
    By sashaKap in forum C Programming
    Replies: 2
    Last Post: 04-26-2009, 09:32 AM
  4. Game Design
    By plutoismyhome in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 09-30-2007, 02:22 PM
  5. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 02:41 AM

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