1 module mminer
is aliced
;
3 import arsd
.simpledisplay
;
11 // ////////////////////////////////////////////////////////////////////////// //
12 void main (string
[] args
) {
17 void loadRoom (int idx
) {
18 curRoom
= gameRooms
[idx
];
25 auto sdwin
= new SimpleWindow(vbufW
*(blit2x ?
2 : 1), vbufH
*(blit2x ?
2 : 1), "Manic Miner", OpenGlOptions
.no
, Resizablity
.fixedSize
);
28 Image vbimg
= new Image(vbufW
*(blit2x ?
2 : 1), vbufH
*(blit2x ?
2 : 1));
32 sdwin
.eventLoop(1000/20,
35 if (sdwin
.closed
) return;
37 if (!curRoom
.willyDead
&& !singleStepWait
) {
39 if (curRoom
.willyDead
) {
40 blitType
= BlitType
.BlackWhite
;
42 if (curRoom
.checkExit()) {
43 if (gameRooms
.length
-curRoom
.roomIdx
> 1) {
44 loadRoom(curRoom
.roomIdx
+1);
45 curRoom
.willyDead
= true;
47 blitType
= BlitType
.Green
;
50 singleStepWait
= singleStep
;
52 //clear(rgbcol(255, 127, 0));
55 roomImg
= curRoom
.draw(roomImg
);
56 //roomImg.blit2xTV(0, 0);
57 roomImg
.blitFast(0, 0);
60 drawStr(10, vbufH
-10, curRoom
.title
, rgbcol(255, 255, 0));
64 auto painter
= sdwin
.draw();
65 painter
.drawImage(Point(0, 0), vbimg
);
66 //map.drawMap(painter, player);
70 delegate (KeyEvent evt
) {
72 case Key
.Left
: curRoom
.keyLeft
= evt
.pressed
; break;
73 case Key
.Right
: curRoom
.keyRight
= evt
.pressed
; break;
74 case Key
.Up
: curRoom
.keyUp
= evt
.pressed
; break;
75 case Key
.Down
: curRoom
.keyDown
= evt
.pressed
; break;
76 case Key
.Ctrl
: curRoom
.keyJump
= evt
.pressed
; break;
77 case Key
.N1
: debugColdet
= !debugColdet
; break;
79 if (!evt
.pressed
) break;
80 curRoom
.cheatRemoveKeys();
83 if (!evt
.pressed
) break;
84 debugColdet
= !debugColdet
;
87 if (!evt
.pressed
) break;
88 singleStep
= !singleStep
;
89 singleStepWait
= singleStep
;
92 if (!evt
.pressed
) break;
93 singleStepWait
= false;
96 if (!evt
.pressed
) break;
97 blitType
= BlitType
.Normal
;
98 if (curRoom
.willyDead
) {
99 loadRoom(curRoom
.roomIdx
);
102 case Key
.Q
: case Key
.Escape
: doQuit
= true; break;
104 if (!evt
.pressed
) break;
105 if (curRoom
.roomIdx
> 0) {
106 loadRoom(curRoom
.roomIdx
-1);
110 if (!evt
.pressed
) break;
111 if (gameRooms
.length
-curRoom
.roomIdx
> 1) {
112 loadRoom(curRoom
.roomIdx
+1);
117 if (doQuit
) { sdwin
.close(); return; }
120 delegate (MouseEvent evt
) {
123 delegate (dchar ch
) {