-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
executable file
·70 lines (49 loc) · 1.51 KB
/
main.cpp
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
69
70
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_mixer.h>
#include <math.h>
#include "engine.h"
#include "gfx/sprite.h"
#include "gfx/background.h"
#include "gfx/font.h"
#include "io/joy.h"
#include "io/cfg.h"
#include "io/dir.h"
#include "io/display.h"
// player specific:
#include "player/theme.h"
#include "player/list.h"
using namespace std;
bool main_loop = true;
config maincfg("config.ini");
engine madamp(maincfg.get_int_by_key("screenwidth",480),maincfg.get_int_by_key("screenheight",320),maincfg.get_int_by_key("framerate",60));
joystick joy(0);
Mix_Music *loop;
display lcd(maincfg.get_string_by_key("backlight"), &joy, &maincfg);
int main() {
madamp.init_gfx();
madamp.init_sfx();
madamp.disable_debug_mode();
theme maintheme(maincfg.get_string_by_key("theme"));
background bg(maintheme.file_bg,madamp);
font fnt(maintheme.file_font,maintheme.font_size,madamp);
fnt.setRGBSDL(&maintheme.font_color);
directory musicdir(maincfg.get_string_by_key("musicdir"));
list playlist(&madamp, &fnt,&maincfg,&maintheme, &joy, &musicdir, loop);
while ( main_loop )
{
//madamp.clear_screen();
joy.poll();
main_loop = (false == (joy.start && joy.select));
bg.draw();
playlist.draw();
lcd.loop();
playlist.loop();
madamp.loop();
}
lcd.destroy();
playlist.destroy();
bg.destroy();
madamp.destroy();
}