137 |
Widget *back; |
Widget *back; |
138 |
Widget *m_nextlp, *m_prevlp; // Next/previous level pack |
Widget *m_nextlp, *m_prevlp; // Next/previous level pack |
139 |
TextButton *m_lpbutton; // Current level pack |
TextButton *m_lpbutton; // Current level pack |
140 |
TextButton *m_infobutton; |
Label *m_infobutton; |
141 |
TextButton *m_levelinfo; |
Label *m_levelinfo, *m_levelinfo2; |
142 |
LevelWidget *levelwidget; |
LevelWidget *levelwidget; |
143 |
LevelPack *level_pack; |
LevelPack *level_pack; |
144 |
unsigned m_ilevelpack; |
unsigned m_ilevelpack; |
945 |
m_nextlp (new TextButton(">", this)), |
m_nextlp (new TextButton(">", this)), |
946 |
m_prevlp (new TextButton("<", this)), |
m_prevlp (new TextButton("<", this)), |
947 |
m_lpbutton (new TextButton("Level Pack", this)), |
m_lpbutton (new TextButton("Level Pack", this)), |
948 |
m_infobutton(new TextButton("", this)), |
m_infobutton(new Label("")), |
949 |
m_levelinfo (new TextButton("", this)), |
m_levelinfo (new Label("")), |
950 |
|
m_levelinfo2 (new Label("")), |
951 |
levelwidget (new LevelWidget(lp, 4, 3)), |
levelwidget (new LevelWidget(lp, 4, 3)), |
952 |
level_pack (lp), |
level_pack (lp), |
953 |
m_ilevelpack () |
m_ilevelpack () |
954 |
{ |
{ |
955 |
const int |
const int |
956 |
BX=120, // button xsize |
BX=140, // button xsize |
957 |
BY=35, // button ysize |
BY=35, // button ysize |
958 |
SX=5, // x spacing |
SX=5, // x spacing |
959 |
SY=2, // y spacing |
// SY=2, // y spacing |
960 |
OX=(BX+SX), |
OX=(BX+SX), |
961 |
OY=(BY+SY), |
// OY=(BY+SY), |
962 |
RJ=(605+SX), // right justification |
RJ=(605+SX), // right justification |
963 |
// Y1=15, // y position for top button row |
Y1=60, // y position for level preview |
964 |
Y2=430; // y position for bottom button row |
Y2=10, // y position for information area |
965 |
|
Y3=430; // y position for bottom button row |
966 |
{ |
{ |
967 |
pgup = new ImageButton("ic-up", "ic-up1"); |
pgup = new ImageButton("ic-up", "ic-up1", this); |
968 |
pgdown = new ImageButton("ic-down", "ic-down1"); |
pgdown = new ImageButton("ic-down", "ic-down1", this); |
969 |
start = new ImageButton("ic-top", "ic-top1"); |
start = new ImageButton("ic-top", "ic-top1", this); |
970 |
end = new ImageButton("ic-bottom", "ic-bottom1"); |
end = new ImageButton("ic-bottom", "ic-bottom1", this); |
971 |
unsolved = new ImageButton("ic-unsolved", "ic-unsolved1"); |
unsolved = new ImageButton("ic-unsolved", "ic-unsolved1", this); |
972 |
// new TextButton("Timer on") |
// new TextButton("Timer on") |
973 |
|
|
974 |
BuildHList hlist1(this, Rect(RJ-4*OX, Y2, BX, BY), 5); |
BuildHList hlist1(this, Rect(10, Y3, BX, BY), 15); |
|
BuildHList hlist2(this, Rect(RJ-3*OX, Y2+OY, BX, BY), 5); |
|
975 |
|
|
976 |
hlist1.add (m_lpbutton); |
hlist1.add (m_lpbutton); |
977 |
hlist1.add (unsolved); |
hlist1.add (unsolved); |
978 |
hlist1.add (newgame); |
hlist1.add (newgame); |
979 |
hlist1.add (back); |
hlist1.add (back); |
|
|
|
|
pgup->set_listener(this); |
|
|
pgdown->set_listener(this); |
|
|
start->set_listener(this); |
|
|
end->set_listener(this); |
|
|
unsolved->set_listener(this); |
|
980 |
} |
} |
981 |
|
|
982 |
{ |
{ |
983 |
Rect r(10+590+10, 50,20,50); |
Rect r(10+590+10, Y1, 20, 50); |
984 |
r.y = 50; |
r.y = Y1; |
985 |
add (pgup, r); |
add (pgup, r); |
986 |
r.y += 60; |
r.y += 60; |
987 |
add (pgdown, r); |
add (pgdown, r); |
988 |
r.y = 290; |
r.y = Y1+240; |
989 |
add (start, r); |
add (start, r); |
990 |
r.y += 60; |
r.y += 60; |
991 |
add (end, r); |
add (end, r); |
992 |
} |
} |
993 |
|
|
994 |
add (m_infobutton, Rect (10,10,305, 28)); |
add (m_infobutton, Rect (325,Y2,305,28)); |
995 |
add (m_levelinfo, Rect (325,10,305,28)); |
m_infobutton->set_alignment (ALIGN_RIGHT, ALIGN_LEFT); |
996 |
|
add (m_levelinfo, Rect (10,Y2,305, 28)); |
997 |
|
m_levelinfo->set_alignment (ALIGN_LEFT, ALIGN_LEFT); |
998 |
|
add (m_levelinfo2, Rect (10,Y2+20,305, 28)); |
999 |
|
m_levelinfo->set_alignment (ALIGN_LEFT, ALIGN_LEFT); |
1000 |
// add (levelwidget, Rect (10,50,620,350)); |
// add (levelwidget, Rect (10,50,620,350)); |
1001 |
add (levelwidget, Rect (10,50,590,350)); |
add (levelwidget, Rect (10,Y1,590,350)); |
1002 |
levelwidget->set_listener(this); |
levelwidget->set_listener(this); |
1003 |
|
|
1004 |
set_levelpack (ilevel_pack); |
set_levelpack (ilevel_pack); |
1062 |
enigma::LevelPack *lp = enigma::LevelPacks[m_ilevelpack]; |
enigma::LevelPack *lp = enigma::LevelPacks[m_ilevelpack]; |
1063 |
int iselected = levelwidget->selected_level(); |
int iselected = levelwidget->selected_level(); |
1064 |
if (const enigma::LevelInfo *li = lp->get_info (iselected)) { |
if (const enigma::LevelInfo *li = lp->get_info (iselected)) { |
1065 |
snprintf (txt, sizeof(txt), "#%d: %s", |
if (options::WizardMode) { |
1066 |
iselected, li->name.c_str()); //, li->filename.c_str()); |
snprintf (txt, sizeof(txt), "#%d: %s (%s)", |
1067 |
|
iselected+1, li->name.c_str(), li->filename.c_str()); |
1068 |
|
} else { |
1069 |
|
snprintf (txt, sizeof(txt), "#%d: %s", |
1070 |
|
iselected+1, li->name.c_str()); //, li->filename.c_str()); |
1071 |
|
} |
1072 |
m_levelinfo->set_text(txt); |
m_levelinfo->set_text(txt); |
1073 |
|
|
1074 |
|
int par_time = li->best_time; |
1075 |
|
if (LevelStatus *ls= options::GetLevelStatus (lp->get_name(), li->filename)) { |
1076 |
|
if (options::Difficulty == DIFFICULTY_HARD) { |
1077 |
|
if (ls->par_hard > 0) |
1078 |
|
par_time = ls->par_hard; |
1079 |
|
} else { |
1080 |
|
if (ls->par_easy > 0) |
1081 |
|
par_time = ls->par_easy; |
1082 |
|
} |
1083 |
|
} |
1084 |
|
snprintf (txt, sizeof(txt), "Time to beat: %d:%02d", |
1085 |
|
par_time/60, par_time % 60); |
1086 |
|
m_levelinfo2->set_text(txt); |
1087 |
} |
} |
1088 |
} |
} |
1089 |
|
|