197 |
{ |
{ |
198 |
areas.clear(); |
areas.clear(); |
199 |
|
|
200 |
blit(gc, 0,0, enigma::GetImage("menu_bg")); |
// blit(gc, 0,0, enigma::GetImage("menu_bg")); |
201 |
// set_color(gc, 0,0,0); |
// set_color(gc, 0,0,0); |
202 |
// box(gc, r); |
// box(gc, r); |
203 |
|
|
223 |
int ypos = y0 + y*(imgh + vgap); |
int ypos = y0 + y*(imgh + vgap); |
224 |
areas.push_back(Rect(xpos-10, ypos-10, imgw+20, imgh+35)); |
areas.push_back(Rect(xpos-10, ypos-10, imgw+20, imgh+35)); |
225 |
|
|
226 |
|
if (i == iselected) { |
227 |
|
set_color(gc, 255,0,0); |
228 |
|
Rect a=areas.back(); |
229 |
|
frame(gc, a); |
230 |
|
frame(gc, smaller(a,1)); |
231 |
|
frame(gc, smaller(a,2)); |
232 |
|
} |
233 |
|
|
234 |
string fname = string("levels/") + levels[i].filename + ".png"; |
string fname = string("levels/") + levels[i].filename + ".png"; |
235 |
if (Surface *img = cache.get(enigma::FindDataFile(fname))) |
if (Surface *img = cache.get(enigma::FindDataFile(fname))) |
236 |
blit (gc, xpos, ypos, img); |
blit (gc, xpos, ypos, img); |
243 |
if (ls->finished != 0) |
if (ls->finished != 0) |
244 |
blit (gc, xpos, ypos, enigma::GetImage("completed")); |
blit (gc, xpos, ypos, enigma::GetImage("completed")); |
245 |
} |
} |
|
if( i == iselected) |
|
|
{ |
|
|
char bottom_line_text[255]; |
|
|
snprintf( bottom_line_text, 254, " #%d %s (%s)", i+1, levels[i].name.c_str(), levels[i].filename.c_str()); |
|
|
smallfnt->render (gc, 5, 460, bottom_line_text); |
|
|
} |
|
246 |
|
|
247 |
string tstr = levels[i].name; |
string tstr = levels[i].name; |
248 |
smallfnt->render (gc, |
smallfnt->render (gc, |
253 |
} |
} |
254 |
done_painting: |
done_painting: |
255 |
|
|
256 |
set_color(gc, 255,0,0); |
char bottom_line_text[255]; |
257 |
Rect a=areas[iselected-ifirst]; |
snprintf (bottom_line_text, 254, " #%d %s (%s)", |
258 |
frame(gc, a); |
iselected+1, |
259 |
frame(gc, smaller(a,1)); |
levels[iselected].name.c_str(), |
260 |
frame(gc, smaller(a,2)); |
levels[iselected].filename.c_str()); |
261 |
|
smallfnt->render (gc, 5, 460, bottom_line_text); |
262 |
} |
} |
263 |
|
|
264 |
void |
void |
749 |
|
|
750 |
MainMenu::MainMenu() |
MainMenu::MainMenu() |
751 |
{ |
{ |
752 |
BuildVList b(this, Rect((640-150)/2,200,150,40), 5); |
BuildVList b(this, Rect((640-150)/2,150,150,40), 5); |
753 |
if (enigma::LevelPacks.size() > 2) { |
if (enigma::LevelPacks.size() > 2) { |
754 |
newgame = b.add(new TextButton("New Game", this)); |
newgame = b.add(new TextButton("New Game", this)); |
755 |
playenigma = 0; |
playenigma = 0; |
759 |
playenigma = b.add(new TextButton("Play Enigma", this)); |
playenigma = b.add(new TextButton("Play Enigma", this)); |
760 |
playoxyd = b.add(new TextButton("Play Oxyd & Co", this)); |
playoxyd = b.add(new TextButton("Play Oxyd & Co", this)); |
761 |
} |
} |
762 |
leveled = 0; //b.add(new TextButton("Editor", this)); |
leveled = b.add(new TextButton("Editor", this)); |
763 |
manual = b.add(new TextButton("Manual", this)); |
manual = b.add(new TextButton("Manual", this)); |
764 |
options = b.add(new TextButton("Options", this)); |
options = b.add(new TextButton("Options", this)); |
765 |
credits = b.add(new TextButton("Credits", this)); |
credits = b.add(new TextButton("Credits", this)); |
777 |
Font *f = enigma::GetFont("levelmenu"); |
Font *f = enigma::GetFont("levelmenu"); |
778 |
Surface * logo(enigma::GetImage("enigma_logo3")); |
Surface * logo(enigma::GetImage("enigma_logo3")); |
779 |
int x0=(640-logo->width())/2; |
int x0=(640-logo->width())/2; |
780 |
int y0=40; |
int y0=30; |
781 |
blit(gc, x0, y0, logo); |
blit(gc, x0, y0, logo); |
782 |
f->render (gc, 5, 460, "v" VERSION); |
f->render (gc, 5, 460, "v" VERSION); |
783 |
} |
} |
867 |
0 |
0 |
868 |
}; |
}; |
869 |
|
|
870 |
show_text( credits); |
show_text( credits); |
871 |
} |
} |
872 |
|
|
873 |
void |
void |
874 |
MainMenu::show_help () |
MainMenu::show_help () |
875 |
{ |
{ |
876 |
static const char *screen1[] = { |
static const char *screen1[] = { |
877 |
"Introduction:", |
"Introduction:", |
878 |
"", |
"", |
879 |
"The idea behind Enigma is simple: In most levels your job is to find", |
"The idea behind Enigma is simple: In most levels your job is to find", |
880 |
"pairs of \"Oxyd\" stones (you will recognize them when you see them)", |
"pairs of \"Oxyd\" stones (you will recognize them when you see them)", |
881 |
"with matching colors. You have to open all oxyd stones but they only", |
"with matching colors. You have to open all oxyd stones but they only", |
882 |
"stay open when opening two stones of the same color one after", |
"stay open when opening two stones of the same color one after", |
883 |
"another. Just play the first levels in the \"Oxyd & Co\" group and you", |
"another. Just play the first levels in the \"Oxyd & Co\" group and you", |
884 |
"will get the idea.", |
"will get the idea.", |
885 |
"In some other levels, called \"meditation landscapes\" you have a", |
"In some other levels, called \"meditation landscapes\" you have a", |
886 |
"somewhat different job: You control a couple of small white marbles", |
"somewhat different job: You control a couple of small white marbles", |
887 |
"simultaneously and have to put each of them into a pit on the floor.", |
"simultaneously and have to put each of them into a pit on the floor.", |
888 |
"", |
"", |
889 |
"Moving around:", |
"Moving around:", |
890 |
"", |
"", |
891 |
"You control the marble by moving around the mouse into the desired", |
"You control the marble by moving around the mouse into the desired", |
892 |
"direction. But be careful, because the marble has some mass and", |
"direction. But be careful, because the marble has some mass and", |
893 |
"the floor some friction, the marble needs some time to accelerate or", |
"the floor some friction, the marble needs some time to accelerate or", |
894 |
"stop.", |
"stop.", |
895 |
"Larger levels scroll when you reach the outermost part of the visible", |
"Larger levels scroll when you reach the outermost part of the visible", |
896 |
"part on the screen.", |
"part on the screen.", |
897 |
"", |
"", |
898 |
0 |
0 |
899 |
}; |
}; |
900 |
static const char *screen2[] = { |
static const char *screen2[] = { |
901 |
"The Floor:", |
"The Floor:", |
902 |
"", |
"", |
903 |
"On most types of floor you can move around riskless but the speed", |
"On most types of floor you can move around riskless but the speed", |
904 |
"of your marble may vary.", |
"of your marble may vary.", |
905 |
"When moving into abyss or water you will die.", |
"When moving into abyss or water you will die.", |
906 |
"Ice is very slippery.", |
"Ice is very slippery.", |
907 |
"You cannot control your marble in space.", |
"You cannot control your marble in space.", |
908 |
"", |
"", |
909 |
"Items and Inventory:", |
"Items and Inventory:", |
910 |
"", |
"", |
911 |
"In many levels you can see different items. You can pick them up", |
"In many levels you can see different items. You can pick them up", |
912 |
"by simply rolling over them. The items are then stored in your", |
"by simply rolling over them. The items are then stored in your", |
913 |
"inventory, which you control using the left and right mouse button.", |
"inventory, which you control using the left and right mouse button.", |
914 |
"The leftmost item will be activated when pressing the left mouse", |
"The leftmost item will be activated when pressing the left mouse", |
915 |
"button and you can rotate the items using the right mouse button.", |
"button and you can rotate the items using the right mouse button.", |
916 |
"Some items can mutate when hit by a laser or crushed by a stone.", |
"Some items can mutate when hit by a laser or crushed by a stone.", |
917 |
"", |
"", |
918 |
0 |
0 |
919 |
}; |
}; |
920 |
static const char *screen3[] = { |
static const char *screen3[] = { |
921 |
"Something about stones:", |
"Something about stones:", |
922 |
"", |
"", |
923 |
"Most of the time the stones are nothing more than walls.", |
"Most of the time the stones are nothing more than walls.", |
924 |
"Some special stones are movable when hit strong enought.", |
"Some special stones are movable when hit strong enought.", |
925 |
"The wooden stone will build new floor if moved into water, space or", |
"The wooden stone will build new floor if moved into water, space or", |
926 |
"abyss.", |
"abyss.", |
927 |
"Others can be destroyed using a hammer, dynamite or a laser.", |
"Others can be destroyed using a hammer, dynamite or a laser.", |
928 |
"Doors can be opened using a switch or trigger hidden somewhere", |
"Doors can be opened using a switch or trigger hidden somewhere", |
929 |
"around in the level.", |
"around in the level.", |
930 |
"Some magic stones can be changed when hit using a magicwand.", |
"Some magic stones can be changed when hit using a magicwand.", |
931 |
"And some depend on the color of your marble.", |
"And some depend on the color of your marble.", |
932 |
"", |
"", |
933 |
0 |
0 |
934 |
}; |
}; |
935 |
|
|
936 |
show_text( screen1); |
show_text( screen1); |
937 |
show_text( screen2); |
show_text( screen2); |
938 |
show_text( screen3); |
show_text( screen3); |
939 |
} |
} |
940 |
|
|
941 |
//---------------------------------------------------------------------- |
//---------------------------------------------------------------------- |