~ubuntu-branches/ubuntu/maverick/ultrastar-ng/maverick

« back to all changes in this revision

Viewing changes to src/screen_score.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz, Miriam Ruiz, Mario Bonino, Jon Dowland, Ansgar Burchardt
  • Date: 2008-06-07 16:43:18 UTC
  • mfrom: (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080607164318-4cnzizck1tp8mrwp
Tags: 0.2.1-1
[ Miriam Ruiz ]
* New Upstream Release (Closes: #453132)
* Removed unneeded patches
* Added packages to build deps:
  + libtool
  + portaudio19-dev | portaudio-dev
  + libboost-dev, libboost-thread-dev, libboost-serialization-dev
  + libboost-program-options-dev, libboost-regex-dev
* Moved shared objects to private directory: /usr/lib/ultraster-ng
* Added rpath to binaries to search for shared objects in the private dir
* Uses ultrastar-ng-gstreamer as default, instead of ultrastar-ng-xine,
  since there are significantly less issues with GStreamer.
* Added patch to fix upstream desktop file
* Added -Wl,-as-needed to LDFLAGS
* Replaced fftw3-dev by libfftw3-dev in build dependencies.
* Standards-Version upgraded to 3.7.3

[ Mario Bonino ]
* Fixed data/Makefile.am to install .desktop file and icon

[ Jon Dowland ]
* add Homepage: control field to source stanza
* fix a bashism in debian/rules (Closes: #478634)

[ Ansgar Burchardt ]
* debian/control: Change XS-Vcs-* to Vcs-*
* Remove Homepage semi-field from description

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <screen_score.h>
 
2
 
 
3
CScreenScore::CScreenScore(std::string const& name, unsigned int width, unsigned int height):
 
4
  CScreen(name, width, height)
 
5
{}
 
6
 
 
7
CScreenScore::~CScreenScore() {}
 
8
 
 
9
void CScreenScore::enter() {
 
10
        CScreenManager* sm = CScreenManager::getSingletonPtr();
 
11
        theme = new CThemeScore(m_width, m_height);
 
12
        bg_texture = sm->getVideoDriver()->initSurface(theme->bg->getSDLSurface());
 
13
}
 
14
 
 
15
void CScreenScore::exit() {
 
16
        delete theme;
 
17
}
 
18
 
 
19
void CScreenScore::manageEvent(SDL_Event event) {
 
20
        if (event.type == SDL_KEYDOWN) CScreenManager::getSingletonPtr()->activateScreen("Songs");
 
21
}
 
22
 
 
23
void CScreenScore::draw() {
 
24
        CScreenManager* sm = CScreenManager::getSingletonPtr();
 
25
        Song& song = sm->getSongs()->current();
 
26
        theme->theme->clear();
 
27
        // Draw some numbers
 
28
        int score = song.getScore();
 
29
        char scoreStr[32];
 
30
        char rankStr[32];
 
31
        float scorePercent;
 
32
        sprintf(scoreStr,"%4d",score);
 
33
        theme->normal_score.text = scoreStr;                    
 
34
        if (score < 2000) sprintf(rankStr,"Tone deaf");
 
35
        else if (score < 4000) sprintf(rankStr,"Amateur");
 
36
        else if (score < 6000) sprintf(rankStr,"Rising star");
 
37
        else if (score < 8000) sprintf(rankStr,"Lead singer");
 
38
        else sprintf(rankStr,"Hit singer");
 
39
        double oldY = theme->level.y;
 
40
        scorePercent = score/10000.;
 
41
        theme->level.y = theme->level.y + theme->level.final_height * (1.-scorePercent);
 
42
        theme->level.height = theme->level.final_height* scorePercent;
 
43
        theme->rank.text = rankStr;
 
44
        theme->theme->PrintText(&theme->normal_score);
 
45
        theme->theme->PrintText(&theme->rank);
 
46
        theme->theme->DrawRect(theme->level);
 
47
        theme->level.y = oldY;
 
48
        sm->getVideoDriver()->drawSurface(bg_texture);
 
49
        sm->getVideoDriver()->drawSurface(theme->theme->getCurrent());
 
50
}