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

  • Home
  • SEARCH
  • 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 590003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:28:58+00:00 2026-05-13T15:28:58+00:00

I have a game engine design written in C++ where a platform-independent game object

  • 0

I have a game engine design written in C++ where a platform-independent game object is contained within a platform-specific Application object.

The problem I’m trying to solve is the case where I need to pass OS-specific data from the Application to the game. In this case, I’d need to pass the main HWND from Windows for DirectX or an OpenGL context for the other platforms to the renderer I’m using. Unfortunately I have little control over the renderer, which can expect platform-specific data.

I realize I could initialize the renderer on the Application side, but I’d rather have the game decide when and where to do it. Generally, I have control over the Application side but not the game side. The game writer might choose to use a different renderer.

I’ve also entertained the idea of having some kind of “Property Manager” where I can pass data around through strings, but I don’t like that idea very much.

Any ideas?

  • 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-13T15:28:59+00:00Added an answer on May 13, 2026 at 3:28 pm

    Remember that you only need to know the target platform at compile time. With this information, you can ‘swap in and out’ components for the correct platform.

    In a good design, the Game should not require any information about it’s platform; it should only hold the logic and related components.

    Your ‘Engine’ classes should worry about the platform.

    The Game classes should only interface with the Engine objects via public functions that aren’t specific to the platform; you can have multiple versions of the Engine objects for each platform, and choose which one to use at compile time.

    For example, you could have a Texture ‘engine’ class that represents a texture in the game. If you support OS X and Windows, you could have a “Texture.h” which includes “Windows/Texture.h” or “OSX/Texture.h” depending on the platform you’re compiling on. Both headers will define a Texture class with the same interface (i.e. they’ll both have the same public functions with the same arguments), but their implementation will be platform-specific.

    To clarify, the Game should tell the Application to initialize the Renderer; there should be a strict line between the game logic and the implementation details. The renderer is an implementation detail, not part of the game logic. The game classes should know nothing about the system and only about the game world.

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

Sidebar

Related Questions

No related questions found

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.