C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28629
Number of posts: 94611

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Another way..? Posted by MT2002 on 18 Aug 2005 at 7:11 PM

Hey everyone,

Im <still> working on my video code..Jeez I cant wait
'till I ge this done!!

Anyway, I ran into <another> problem with design..Ugh!

I developed a system that makes the API (DX/OGL/etc.)
indepent of the video code. This works well..except the
layers of software.

Now for the question..

I have three classes...
_IVideoTask -updates every frame by core engine
_IRenderer -The link to outside API *.libs
_IVideoDX -Part of the engines' DirectX lib

Now the question...How should I access *specific*
DirectX features? For example, If I want to set the
video mode, I would need THREE functions. One empty
(_IRenderer), one wrapper _IVideoTask), and te actual
defnition (_IVideoDX).

Theres GOT to be a better way!! _IRender links with
_IVideoDX. _IRender is used by _IVideoTask like this..
class _IVideoTask : _ITaskManager
{
  _IRenderer renderer;
};
class _IRenderer
{
 // pure virual base class that _IVideoDX isbased off of
}
class _IVideoDX : _IRenderer
{
 // DirectX
}


Does anyone have any suggestions, or a better method?
Anything would be great!

Thanks!

Report
Re: Another way..? Posted by MT2002 on 19 Aug 2005 at 9:07 AM
:
: Hey everyone,
:
: Im <still> working on my video code..Jeez I cant wait
: 'till I ge this done!!
:
: Anyway, I ran into <another> problem with design..Ugh!
:
: I developed a system that makes the API (DX/OGL/etc.)
: indepent of the video code. This works well..except the
: layers of software.
:
: Now for the question..
:
: I have three classes...
: _IVideoTask -updates every frame by core engine
: _IRenderer -The link to outside API *.libs
: _IVideoDX -Part of the engines' DirectX lib
:
: Now the question...How should I access *specific*
: DirectX features? For example, If I want to set the
: video mode, I would need THREE functions. One empty
: (_IRenderer), one wrapper _IVideoTask), and te actual
: defnition (_IVideoDX).
:
: Theres GOT to be a better way!! _IRender links with
: _IVideoDX. _IRender is used by _IVideoTask like this..
:
: class _IVideoTask : _ITaskManager
: {
:   _IRenderer renderer;
: };
: class _IRenderer
: {
:  // pure virual base class that _IVideoDX isbased off of
: }
: class _IVideoDX : _IRenderer
: {
:  // DirectX
: }

:
: Does anyone have any suggestions, or a better method?
: Anything would be great!
:
: Thanks!

:

Let me add on to my previus post..

I want to be able to access my _IVideoDX:_IRenderer
object diretly from my _IVideoTask. I know one possible
way is this..
//Main game
#include "DirectX.h"
#pragma comment (lib, "DirectX.lib") // _IVideoDX
//...
_IVideoDX dx= (_IVideoDX*)_IVideoTask::GetRenderer();
// access dx directly!

This would work--but Im trying to wrap these APIs so that
the game doesnt need to worry 'bout it. (Yeah, my code has
feelings ).

Does anyone have any suggestions?




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.