Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 775607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:19:03+00:00 2026-05-14T19:19:03+00:00

If you were going to develop a game in say, Ruby, and you were

  • 0

If you were going to develop a game in say, Ruby, and you were provided with a game framework, would you rather act on key up/down events by overloading a method on the main window like so:

class MyGameWindow < Framework::GameWindow
    def button_down(id)
        case id
            when UpArrow
                do_something
            when DownArrow
                do_something
        end
    end
end

Or have an event class with which you can make a method and assign a handle to it, like so:

class MyGameWindow < Framework::GameWindow
    def initialize
        key_down.add_handler(method(:do_something))
    end
    def do_something
        puts "blah blah"
    end
end

Please give your views, which do you think would be better in a game developement area, and thanks in advance, ell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T19:19:04+00:00Added an answer on May 14, 2026 at 7:19 pm

    My preference is for polling. Events (on Windows, anyway) have a nasty habit of getting lost. I’ve battled long and hard with key and mouse button releases getting lost, so now my preference is just to check the state of everything every tick and do set operations to note which ones are changed.

    To get closer to your question, I would tend to expect that you do not want to put your input handling in your window class. Rather- create another class which does the input handling (and feed the events to it if you prefer event-driven) and then just let it do its thing. In this setup, your window receives the events but the only thing it does with them is pass them off to the set of objects that might be able to deal with them.

    The problem with doing the event handling in the window is that you’re then another step (or more) removed from the thing that cares about the results of the input processing. I would tend to push the input processor and the input requirer closer together in the object graph, but again- the main window doesn’t really care about (most) events itself, it should just pass those things on to the objects that do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am going to develop a facebook game as topic for my thesis. I
I am going to develop a Tic-Tac-Toe game using Java(or maybe other OO Languages).
I'm going to develop a web application using SmartGWT. I've heard about Vaadin framework.
I am going to develop a ball game where i have to touch two/more
I am going to develop a 2-d ball game where two balls (circles) collide.
I would like to develop a simple point&click game in C# with the default
we're going to develop a game with internet multiplayer support. since it's an interactive
I'm going to develop a game where there are multiple clients and they have
I'm going to develop a java web start application, which need to access protected
I am going to develop Android application which needs to read x,y,z coordinates of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.