Jump to content

removing dialog box [ c++ ]


cassius
 Share

Recommended Posts

Stop drawing it when you no longer want to show it. As for the quality, I suspect the image originally is not a power of 2 but you have the image saved as a DXT# format which will stretch the image to a power of 2. If that is the case, use the texture editor to set the compression format to 'Uncompressed'. Also make sure you draw the image on the screen at the same ratio of the image's width/height.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Thanks. I will do as you suggest.

But how do I get rid of dialog and clear screen at runtime?

 

 

 

EDIT: Ah yes, that's improved the quality.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

But how do I get rid of dialog and clear screen at runtime?

The first sentence of macklebee's post would do it but if that's not enough, I'd suggest sharing your code. Usually you would keep the state in a variable and display it or not display it based on that.

 

Psuedocode:

 

bool userhasreadsign = false; // You set this variable to true once user has read sign

...

if(userhasreadsign==false) drawimage...

 

So drawimage is only executed if userhasreadsign is false.

Link to comment
Share on other sites

The current dialog I have mentioned is shown only when keydown key "I" is pressed but the resson for my post is how to make dialog that will appear at the start of the game to explain the objective of the game.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

This is really all about the structure of your code since anything you want to be drawn must be drawn every frame. This means you'll end up with boolean to check when things should be drawn. There are way more advanced ways of doing this like state machines but they are fairly intrusive into your overall code design. The "simple" (and I have this in quotes because for small games this works but for complex games simple turns into a nightmare to manage) way is to do something like:

 

bool showInitDialog = true;

void Draw()
{
  if(showInitDialog)
  {
     // draw the dialog
  }
}

void Update()
{
  // determine when to set showInitDialog to false by either a timer or user interaction
}

Link to comment
Share on other sites

Using booleans like this is just setting states on and off. States being the state your game is currently in, or do when to run certain code. The above is a poor mans state machine. It's good for learning the idea but becomes horrible to maintain in bigger projects. Then one starts thinking of code separation to make it easier to read and maintain and one can come up with all sorts of interesting designs to do this.

 

The switch statement would be the next step after booleans and then entire classes! Designing is fun :)

Link to comment
Share on other sites

I have been using Booleans throughout my program just didn.t know they were state machine concepts. Thanks Rick I learned a lot from this thread.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...