开发者

Timer to appear on Game Screen

开发者 https://www.devze.com 2023-01-24 19:17 出处:网络
I have made a countdown timer using C# on basic form wind开发者_C百科ow and i want it to appear on game screen i tried to set form properties but it wont work on game screen.

I have made a countdown timer using C# on basic form wind开发者_C百科ow and i want it to appear on game screen i tried to set form properties but it wont work on game screen. how would it be done? Any Idea?


If you are looking to draw a timer into an existing DirectX or OpenGL backed game then I suggest you take a look at the following question which offers information about hooking and the ability to intercept calls along with working with the applications draw calls. However I believe this is above the level of complexity you would wish to encounter for adding a timer.

LINK : OpenGL/DirectX Hook - Similar to FRAPS


As you don't indicate if you are using OpenGL, XNA or what I will give you a generic response.

If it is your game

Your splash screen should be part of the game loop. This means that will have an update() and a draw().

  • In the update method you have to calculate the remaining time and store it in a variable or property of an object.

  • In the draw method you should paint the remaining time.

My recommendation is that you create a TimeCounter class because seems you are also going to reuse it during game.

If it is not your game

  • Most games will switch to full-screen direct-render mode. It is not impossible but pretty hard.

  • If the game is web, then you can wrap it in IFrame or similar and put the counter

0

精彩评论

暂无评论...
验证码 换一张
取 消