Original Post
Hi, Everyone.
I'm working on a tiled based game and right now everything has going well until now. I want my engine to render in different part of surfaces before it render to the backbuffer. For example
In surface g_mScoreBoard will score and amount life be drawed.
In surface g_mGameBoard will all items, player and enemies be drawed.
And after these surfaces will be drawed to the backbuffer. The score surface is going to be 800 x 200 in size and the game surface will be 800 x 400 in size.
Somehow I figured this out a long while ago but I have lost my codes for that :-( but I remember that rendertarget is the solution for this problem.
The only problem is that I don't remember how to put this thing right.
The game will use LPD3DXSPRITE as items and each sprite will have a texture too.
Wich solution should I choose?
1. Create surfaces with D3DPOOL_DEFAULT.
Create a RenderSurface with CreateRenderTarget() and draw score and game to it with StretchRect().
Then draw it to BackBuffer so it can display all of it to screen.
2. Create rendersurfaces with CreateRenderTarget() and let both score and game be rendertargets.
Then somehow set backbuffer as a rendertarget first and after that select ScoreBoard as a rendertarget so I can draw score stuff to its surface.
After that select GameBoard as a rendertarget so I can draw all items and players to its surface.
And finally select backbuffer as a rendertarget so it can render it to screen.
So any suggestion for my problem would be great. I also wonder if LPD3DXSPRITE works with rendertargets and how I make it work.
I'm working on a tiled based game and right now everything has going well until now. I want my engine to render in different part of surfaces before it render to the backbuffer. For example
In surface g_mScoreBoard will score and amount life be drawed.
In surface g_mGameBoard will all items, player and enemies be drawed.
And after these surfaces will be drawed to the backbuffer. The score surface is going to be 800 x 200 in size and the game surface will be 800 x 400 in size.
Somehow I figured this out a long while ago but I have lost my codes for that :-( but I remember that rendertarget is the solution for this problem.
The only problem is that I don't remember how to put this thing right.
The game will use LPD3DXSPRITE as items and each sprite will have a texture too.
Wich solution should I choose?
1. Create surfaces with D3DPOOL_DEFAULT.
Create a RenderSurface with CreateRenderTarget() and draw score and game to it with StretchRect().
Then draw it to BackBuffer so it can display all of it to screen.
2. Create rendersurfaces with CreateRenderTarget() and let both score and game be rendertargets.
Then somehow set backbuffer as a rendertarget first and after that select ScoreBoard as a rendertarget so I can draw score stuff to its surface.
After that select GameBoard as a rendertarget so I can draw all items and players to its surface.
And finally select backbuffer as a rendertarget so it can render it to screen.
So any suggestion for my problem would be great. I also wonder if LPD3DXSPRITE works with rendertargets and how I make it work.