• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
phil67rpg

erasing text

31 posts in this topic

case WM_TIMER:
{
switch(wParam)
{
case ID_TIMER:
{
HRESULT hr=D3DXCreateFont(g_pd3dDevice, //D3D Device
22, //Font height
10, //Font width
FW_NORMAL, //Font Weight
1, //MipLevels
false, //Italic
DEFAULT_CHARSET, //CharSet
OUT_DEFAULT_PRECIS, //OutputPrecision
ANTIALIASED_QUALITY, //Quality
DEFAULT_PITCH|FF_DONTCARE,//PitchAndFamily
"Arial", //pFacename,
&g_font); //ppFont

D3DCOLOR fontColor = D3DCOLOR_XRGB(0,0,0);
RECT rct;
rct.left=200;
rct.right=600;
rct.top=20;
rct.bottom =50;
g_font-> DrawText(NULL,"Welcome to DX9 Pong",-1,&rct,DT_CENTER,fontColor);

KillTimer(hWnd,ID_TIMER);
}
break;
}
return 0;
}
I am using the windows timer function to draw black text to the screen to cover up red text which I already drew to the screen.
I am trying to erase text for my pong game.I have done a lot of research on this topic but I still need help.
-2

Share this post


Link to post
Share on other sites
ok well my problem is that I can write to the screen using text but I want the text to only be there for 5 seconds and then I want to erase the text I want the player to read the instructions on how to interact with the mouse and then vanish so the player can play unimpeded. I have also decided to have the left paddle to be controlled by the computer. That is my next problem.
0

Share this post


Link to post
Share on other sites
Every time I see, from the list of topics, a topic started by phil67rpg, I put my hand to my forehead and look down, not dissimilar to this:
[img]http://www.whoateallthepies.tv/wp-content/uploads/2009/10/picard-fail-293x300.jpg[/img]


I already know what is inside before I click it:[list=1]
[*]A code dump.
[list=1]
[*]Without [[b][/b]CODE] tags.
[/list] [*]1 or 2 sentences explaining what he wants to happen.
[list=1]
[*]But not what [i]actually[/i] happens.
[/list] [*]No actual question.
[/list]
So this time I bet my friend that the contents of this topic would be as per my expectations.
I just won $1 (approximately).


I tend to just stay away from these topics because just reading them frustrates me.

phil67rpg, you can read [b]any[/b] other topic [b]anywhere[/b] else on the forum to see how a proper question looks, what it contains, the fact that code is inside [[b][/b]CODE] tags, etc.
You have been here long enough to have actually seen other topics before, so there is no excuse for the way you ask questions.


Even after you were asked to actually ask a question, [i]you didn’t[/i]!
You just explained what you want, not what [i]actually[/i] happens, and [b]there was no question[/b]. Twice!
How hard is it to ask a question? Check any other post. You have literally 10’s of thousands of examples.

There are even places you could check online that are meant to specifically help you learn how to ask questions.
[url="http://www.google.com/search?q=How+to+Ask+a+Question"]http://www.google.co... Ask a Question[/url]


Thank you for the $1, but I couldn’t help you even if I tried. No one can.
You don’t know how to ask for help. You give no information at all that someone could use to help you. Every. Single. Time.

Others are obviously just as frustrated by it.
Until you learn how to ask questions…


L. Spiro Edited by L. Spiro
0

Share this post


Link to post
Share on other sites
My problem is that I can use dx9 to print text to the screen. I created a font and used the drawtext function to print text to the screen. What I want to do is that after the text is sent to the screen that the text would be cleared from the screen. Basically all I want to do is give instructions to the player on how to interact with the GUI and then to be able to play the game without text on the screen. This is something like a splash screen. I have tried printing text to the screen in red color and then printing the same text to the screen in black but it does not erase the text that is already printed there. I hope you can understand my problem and hopefully help me to solve. Let me know if need more information or code.
1

Share this post


Link to post
Share on other sites
I've never used ID_TIMER, is it called every frame? Anyway just create a bool and stick an if check around your draw text function? The bool becomes false when you don't want the text, I.e. new screen. Also why would you think drawing black text over red would erase it? Did you not think that it would draw black text? If that timer message is called all the time then you might want to re locate that create font code

If ( bSplashScreen )
// draw text
0

Share this post


Link to post
Share on other sites
[quote name='phil67rpg' timestamp='1351810684' post='4996341']What I want to do is that after the text is sent to the screen that the text would be cleared from the screen[/quote][quote]I have tried printing text to the screen in red color and then printing the same text to the screen in black but it does not erase the text that is already printed there.[/quote]

You cannot erase what is already drawn to the screen. If you had an integer [tt]x[/tt], would you be able to see what values it previously held? No, keeping track of such data for every variable and every pixel is infeasible. It is faster and easier to redraw everything, excluding the stuff you don't want visible.

Phil, I strongly recommend researching [url=http://en.wikipedia.org/wiki/Game_programming#Game_structure]game loops[/url] and structuring your game accordingly. In your case, it probably look something like this:

[code]
load_fonts
load_resources

while ( not user_quit ) {
while ( events_to_be_processed )
process_window_event()

clear_screen()
draw_game()
if ( should_draw_instructions )
draw_instructions()
}

release_resources
release_fonts
[/code] Edited by fastcall22
0

Share this post


Link to post
Share on other sites
My God. It [i]learns[/i].

As was mentioned, standard practice is to clear the screen every frame within a game loop, such as the one provided by fastcall22.

Each frame you draw only what you want to be on the screen. This way you don’t have to keep track of what you had drawn in the past.
Imagine any 3D game that had to keep track of what it had drawn last frame and carefully erase that before putting a new image up.
Therefor you redraw the entire screen every frame after clearing it to black at the start of the frame. Draw only what you want to appear each frame and don’t draw what you don’t want to appear. No fuss with timers.


L. Spiro
0

Share this post


Link to post
Share on other sites
OMG Spiro. Laughing so hard. [img]http://public.gamedev.net//public/style_emoticons/default/laugh.png[/img]

?, ?????, ??????????? Edited by Khatharr
0

Share this post


Link to post
Share on other sites
I have done a great deal of research about game loops, message pumps, windows messages, windows threads and timer functions. I also read about splash screens and finite state machines. I still want to erase text on the screen. After much research I am still stuck on how to solve this problem. Google is my friend. Go easy on me I am attempting to ask better questions. Basically I am confused about how to use game loops.My question is when in the game loop do you print text to the screen and then print black text to the screen. Fastcall22 gave me some code and a explanation on how to use game loops I would like just little more information on how to use game loops.
-1

Share this post


Link to post
Share on other sites
OK, fundamental misunderstanding here.

When you're drawing stuff you don't just set down a baseline and then only change stuff that needs to be changed.

Instead, for each frame, you first clear the screen - [i]everything[/i] goes away - then you draw [i]everything[/i] all over again. The "draw everything all over again" part is where you can remove stuff that you don't want to draw and add new stuff that you do want.

This flies in the face of all logic if you come from an "everything is software" mode of thinking, but this is actually the way GPUs [i]like[/i] to be used. So don't try anything tricksy to circumvent it; instead use your GPU the way it wants to be used and it will be good to you in return.

If by now you're recoiling in horror and thinking "surely that's going to give awful performance" - remember - Quake did this in 1996. It wasn't a problem then and it's not a problem now. Edited by mhagain
0

Share this post


Link to post
Share on other sites
Ok, I don't think you are actually learning DirectX, you are just using precoded functions right?
I would suggest you to learn about it first, you are missing the basic of it while you are trying to create a game.
If you don't want to get stuck in every single thing you want to do you should learn how DirectX works.
[url="http://directxtutorial.com"]http://directxtutorial.com[/url] this is a good site to get started.
0

Share this post


Link to post
Share on other sites
You don't erase the text, you stop drawing it.

Imagine a flip-book, with a little picture drawn on each page. If each picture is slightly different, then if you flip quickly through the book whilst staring at the spot with the drawing it will appear as if you have a moving image. You don't erase the old image and then change it, you draw a completely new image on a new page.

Your text works the same -- each frame you draw the entire game scene, including the text, and when you want the text to disappear you simply re-draw the entire scene without the text included -- you don't have to "erase" it.



It's unlikely that you'll find Win32 significantly easier than Direct3d, but good luck.
0

Share this post


Link to post
Share on other sites
C++ is a complex language.

If I may depart from the topic at hand to some more general advice, I think that one of the problems you have is a lack of focus. I've seen you posting for quite a long time now, and without checking I remember you working on-and-off with C++, giving C# a go, jumping from one API to another and constantly moving from project to project -- most of which seem to have been attempts at Pong or if I recall correctly Tic-Tac-Toe.

You find a tutorial or book and start working away. You encounter one or more problems and make a topic looking for help. Sometimes you sort out your original issue and then run into another one, or sometimes it's the original that you're stuck on, but either way you seem to at some point get stuck, and then you put the project aside and move on to a different approach; suddenly you're trying C# instead of C++, or trying Win32 instead of DirectX.


If you don't want to still be making Pong in [i]another[/i] 7 years from now you have to actually choose one approach and stick with it until you've solved [i]all[/i] of the problems and learned to overcome whatever was holding you back. Follow through, and keep working at it when things get difficult.
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0