Can some one help me to make a splash screen

I've been writing a small CLI program in C++ which will take and store some student data in ram and will manipulate them when needed.

I've 2 questions now.
1. I like to create a splash screen nothing fancy like displaying a image or anything like to keep it simple some text massage in the same window some up after a small time period the main program loads how can I archive this I've been going through "google" and trying every thing but ending in disaster.

2. I want to change the font color and the background color of the console so it will be little more easy on the eyes of the user can this be cone using the command SYSTEM(color b2) the way we change the color in CMD normally.

And please keep in mind I've just started to wonder in to the big world of C++ I'm still maggot compared to you guys I might nag you but please bear with me.

Thank you.

Sorry for the double post but I was not getting any answers in beginners forum.
Last edited on
For a console application, all you need to do is print your spash as soon as you enter main. Then do all your loading while the user is admiring your ASCII art, and then present the first prompt.

1
2
3
4
5
6
7
8
9
10
int main( int argc, char** argv )
  {
  display_splash();

  initialize( argc, argv );

  while (main_menu()) { }

  return 0;
  }

Dealing with colors in Windows is actually pretty easy. This is a common question and I've whipped up several answers. They all revolve around the SetConsoleTextAttribute() function.
http://www.cplusplus.com/forum/general/48596/#msg264748
http://www.cplusplus.com/forum/general/105393/#msg568794
Use one of those or roll your own.

Let us know if you want to do other fancy console stuff.
Duoas I was reading lots of post made by you helped me a lot sorry for being a nag can you please elaborate on the splash screen part I worked out most of the text coloring using your posts.

Thanks to your posts I managed to get the text color changed I want to change the background color as well can I use the same function ?

I'm still finding my way around C++

And I've seen you're not grate fan of using system() I'm using that command to set the window title, clear the screen and to pause the program is there any other way of doing this properly.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include <cctype>
#include <ctime>
#include <iostream>
#include <string>
using namespace std;

//----------------------------------------------------------------------------
void display_splash()
  {
  cout << string( 10, '\n' );
  cout <<
    "        ┌────────────────────────────────────────────────────┐ \n"
    "        │ ▄██▀██▄ ██▀▀██▄ ██       ▄███▄  ▄██▀██▄ ██   ██ ██ │ \n"
    "        │ ██▄▄ ▀▀ ██   ██ ██      ██   ██ ██▄▄ ▀▀ ██   ██ ██ │ \n"
    "        │ ▄▄ ▀▀██ ██▄▄██▀ ██      ██▄▄▄██ ▄▄ ▀▀██ ██▄▄▄██ ▀▀ │ \n"
    "        │ ▀██▄██▀ ██      ██▄▄▄██ ██   ██ ▀██▄██▀ ██   ██ ██ │ \n"
    "        └────────────────────────────────────────────────────┘ \n";
  cout << string( 10, '\n' );
  }

//----------------------------------------------------------------------------
void initialize( int argc, char** argv )
  {
  string message = "Please wait...";
  cout << message << flush;

  // spin some cycles to pretend that the program is loading resources, etc.
  time_t start = time( &start );
  while (difftime( time( NULL ), start ) < 5.0 /*seconds*/)
    { }

  cout << "\r" << string( message.length(), ' ' ) << "\r" << flush;
  }

//----------------------------------------------------------------------------
bool main_menu()
  {
  cout << "\n\n"
    "Main menu\n"
    "  A: ask again\n"
    "  Q: quit\n"
    "Make your choice> ";
  string s;
  getline( cin, s );
  cout << "\n";

  if (s.length() == 1)
    switch (toupper( s[ 0 ] ))
      {
      case 'A': cout << "Yay!\n";      return true;
      case 'Q': cout << "Good bye!\n"; return false;
      }

  cout << "What kind of choice is that?\n";
  return true;
  }

//----------------------------------------------------------------------------
int main( int argc, char** argv )
  {
  display_splash();

  initialize( argc, argv );

  while (main_menu()) { }

  return 0;
  }

Clear the screen:
http://www.cplusplus.com/articles/4z18T05o/

Pause:
http://www.cplusplus.com/articles/iw6AC542/

Console functions for setting window title, etc.
http://www.google.com/search?btnI=1&q=msdn+Console+Functions

Good luck!
You're freaking awesome man I could kiss you or buy you drinks till you drop thanks a million m8 and u r info helped a lot.
Topic archived. No new replies allowed.