~ubuntu-branches/ubuntu/trusty/ultrastar-ng/trusty

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2007-05-19 13:27:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070519132705-0e57ieq232ykprpv
Tags: 0.1.4-1
* Build-Depends on libcairo2-dev (>= 1.2)
* Modified rules so that the icon and desktop files appear in both flavours
  of the program.
* Added rule-flavour type of targets in debian/rules, so that it is
  easier to maintain.
* New Upstream Release.
  + Added difficulty level
  + Added to-start cursor
  + Added audio pause/seek
  + Added practice screen
  + Added ingame fullscreen support
  + Rewrote of the lyrics parsing and screen API
  + Added manpage, desktop and pixmap files
  + Fixed latest unscaled graphics
  + Bufixes and memleak fixes
* Reconfigure autotools files before running configure.
  Added build dependencies: autoconf, automake1.10
* Added patch to avoid rebuilding the man page, not working properly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#include <screen_intro.h>
5
5
#include <screen_songs.h>
6
6
#include <screen_sing.h>
 
7
#include <screen_practice.h>
7
8
#include <video_driver.h>
8
9
unsigned int width=800;
9
10
unsigned int height=600;
24
25
                        case SDL_QUIT:
25
26
                                screenManager->finished();
26
27
                                break;
 
28
                case SDL_KEYDOWN:
 
29
                        int keypressed  = event.key.keysym.sym;
 
30
                        SDLMod modifier = event.key.keysym.mod;
 
31
                        if( keypressed == SDLK_f && modifier&KMOD_ALT ) {
 
32
                                SDL_WM_ToggleFullScreen(screenSDL);
 
33
                                break;
 
34
                        }
27
35
                }
28
36
        }
29
37
}
55
63
 
56
64
void usage( char * progname )
57
65
{
58
 
        fprintf(stdout,"Usage: %s [options] [song_directory]\n", progname);
 
66
        fprintf(stdout,"Usage: %s [OPTIONS] [SONG_DIRECTORY]\n", progname);
59
67
        fprintf(stdout,"Options:\n");
60
 
        fprintf(stdout,"--------\n");
61
 
        fprintf(stdout,"-h, --help\n");
62
 
        fprintf(stdout,"\tDisplay this text and exit\n");
63
 
        fprintf(stdout,"-W, --width (Default: 640)\n");
64
 
        fprintf(stdout,"\tSet window width\n");
65
 
        fprintf(stdout,"-H, --height (Default: 480)\n");
66
 
        fprintf(stdout,"\tSet window height\n");
67
 
        fprintf(stdout,"-t, --theme\n");
68
 
        fprintf(stdout,"\tSet theme (theme name or absolute path to the theme)\n");
69
 
        fprintf(stdout,"-c, --no-capture\n");
70
 
        fprintf(stdout,"\tDisable sound capture thread\n");
71
 
        fprintf(stdout,"-f, --fullscreen\n");
72
 
        fprintf(stdout,"\tEnable fullscreen video output\n");
73
 
        fprintf(stdout,"-v, --version\n");
74
 
        fprintf(stdout,"\tDisplay version number and exit\n");
 
68
        fprintf(stdout,"\n");
 
69
        fprintf(stdout," -W, --width (default: 640)  set window width\n");
 
70
        fprintf(stdout," -H, --height (default: 480) set window height\n");
 
71
        fprintf(stdout," -t, --theme                 set theme (theme name or absolute path to the\n");
 
72
        fprintf(stdout,"                             theme)\n");
 
73
        fprintf(stdout," -c, --no-capture            disable sound capture thread\n");
 
74
        fprintf(stdout," -f, --fullscreen            enable fullscreen video output\n");
 
75
        fprintf(stdout," -d, --difficulty            set difficulty level\n");
 
76
        fprintf(stdout,"                             (0: easy, 1:medium, 2:hard (default))\n");
 
77
        fprintf(stdout," -h, --help                  display this text and exit\n");
 
78
        fprintf(stdout," -v, --version               display version number and exit\n");
75
79
        exit(EXIT_SUCCESS);
76
80
}
77
81
 
80
84
        char * songs_directory = NULL;
81
85
        char * theme_name      = NULL;
82
86
        CScreen * screen       = NULL;
83
 
        int ch                = 0;
 
87
        int ch                 = 0;
84
88
        SDL_Thread *thread     = NULL;
 
89
        unsigned int difficulty= 2;
85
90
 
86
91
        static struct option long_options[] =
87
92
                {
91
96
                {"help",no_argument,NULL,'h'},
92
97
                {"no-capture",no_argument,NULL,'c'},
93
98
                {"version",no_argument,NULL,'v'},
 
99
                {"difficulty",required_argument,NULL,'d'},
94
100
                {"fullscreen",no_argument,NULL,'f'},
95
101
                {0, 0, 0, 0}
96
102
        };
97
103
 
98
 
        while ((ch = getopt_long(argc, argv, "t:W:H:hcfv", long_options, NULL)) != -1) {
 
104
        while ((ch = getopt_long(argc, argv, "t:W:H:hcfd:v", long_options, NULL)) != -1) {
99
105
                switch(ch) {
100
106
                        case 't':
101
107
                                theme_name = optarg;
115
121
                        case 'f':
116
122
                                fullscreen = 1;
117
123
                                break;
 
124
                        case 'd':
 
125
                                difficulty = atoi(optarg);
 
126
                                break;
118
127
                        case 'v':
119
128
                                fprintf(stdout,"%s %s\n",PACKAGE, VERSION);
120
129
                                exit(EXIT_SUCCESS);
147
156
        screenManager->setAudio( new CAudio() );
148
157
        screenManager->setRecord( new CRecord() );
149
158
        screenManager->setVideoDriver( videoDriver );
 
159
        screenManager->setDifficulty( difficulty );
150
160
        
151
161
        screen = new CScreenIntro("Intro");
152
162
        screenManager->addScreen(screen);
154
164
        screenManager->addScreen(screen);
155
165
        screen = new CScreenSing("Sing");
156
166
        screenManager->addScreen(screen);
 
167
        screen = new CScreenPractice("Practice");
 
168
        screenManager->addScreen(screen);
157
169
 
158
170
        screenManager->activateScreen("Intro");
159
171