|
-
March 27th, 2008, 04:29 PM
#1
Variable sharing between include files
OK so I have a slight problem. I have a project in VS that I am trying to do some DirectX work with and having some trouble sharing a specific variable. I have one set of files for input "InputHandler.cpp/h" and another for controlling the rendering "WorldRender.cpp/h".
The main file simply initiates and manages the window. When it reads input it processes input through a function in the input handler. When it wants to render it processes through a function in the render file. What I have is a simple model rotation controlled by the arrow keys. So, when I want to rotate the model I push left arrow and the input handler sets a value to tell the renderer to rotate left.
Currently the variable(RotateY) is declared in "InputHandler.h" and both InputHandler and WorldRender are included by Main.cpp. How can I make it so that WorldRender sees the variable storing the value of rotation type in InputHandler? I tried including the input handler in WorldRender, but that results in multiple declarations of the variable RotateY since it is also included and initialized by Main.cpp. I konw the answer has to be fairly simple, it just isn't coming to me and I am starting to get frustrated...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|