Rev 31 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | draw_window: |
2 | |||
3 | |||
4 | mov eax,12 ; function 12:tell os about windowdraw |
||
5 | mov ebx,1 ; 1, start of draw |
||
6 | int 0x40 |
||
7 | |||
8 | ; DRAW WINDOW |
||
9 | mov eax,0 ; function 0 : define and draw window |
||
10 | mov ebx,320*65536+(LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2+98 |
||
11 | mov ecx,25*65536+ (LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+4 |
||
12 | mov edx,0x03000000 ; color of work area RRGGBB |
||
13 | mov esi,0x006688ee ; color of grab bar RRGGBB,8->col |
||
14 | mov edi,0x007799ff ; color of frames RRGGBB |
||
15 | int 0x40 |
||
16 | |||
17 | ; WINDOW LABEL |
||
18 | mov eax,4 ; function 4 : write text to window |
||
19 | mov ebx,8*65536+5 ; [x start] *65536 + [y start] |
||
20 | mov ecx,0x00ffffff ; color of text RRGGBB |
||
21 | mov edx,labelt ; pointer to text beginning |
||
22 | mov esi,scoretext-labelt ; text length |
||
23 | int 0x40 |
||
24 | |||
25 | cmp byte[status],'0' |
||
26 | jne status1 |
||
27 | call draw_logo |
||
28 | call draw_menu |
||
29 | |||
30 | status1: |
||
31 | cmp byte[status],'1' |
||
32 | jne status2 |
||
33 | |||
34 | call draw_game |
||
35 | |||
36 | status2: |
||
37 | cmp byte[status],'2' |
||
38 | jne status3 |
||
39 | |||
40 | call draw_game |
||
41 | |||
42 | mov eax,4 ; function 4 : write text to window |
||
43 | mov ebx,80*65536+170 ; [x start] *65536 + [y start] |
||
44 | mov ecx,0x10ff0000 ; color of text RRGGBB |
||
45 | mov edx,paused ; pointer to text beginning |
||
46 | mov esi,txt_end-paused ; text length |
||
47 | int 0x40 |
||
48 | |||
49 | status3: |
||
50 | cmp byte[status],'3' |
||
51 | jne status4 |
||
52 | |||
53 | call draw_logo |
||
54 | mov edx,history |
||
55 | call show_text |
||
56 | |||
57 | status4: |
||
58 | cmp byte[status],'4' |
||
59 | jne status5 |
||
60 | |||
61 | call draw_logo |
||
62 | mov edx,instructions |
||
63 | call show_text |
||
64 | |||
65 | status5: |
||
66 | |||
67 | mov eax,12 ; function 12:tell os about windowdraw |
||
68 | mov ebx,2 ; 2, end of draw |
||
69 | int 0x40 |
||
70 | |||
71 | ret |
||
72 | |||
73 | draw_game: |
||
74 | |||
75 | call draw_table |
||
76 | movzx edx,byte [current_block_color] |
||
77 | call draw_block |
||
78 | |||
79 | call write_score |
||
80 | |||
81 | mov eax,38 |
||
82 | mov ebx,((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4) shl 16 + ((LEN_X-BORDER_LEFT-BORDER_RIGHT)*ADOBE_SIZE+X_LOCATION*2-4) |
||
83 | mov ecx,20 shl 16 + ((LEN_Y-BORDER_TOP-BORDER_BOTTOM)*ADOBE_SIZE+Y_LOCATION+2-4) |
||
84 | mov edx,0x00ffffff |
||
85 | int 0x40 |
||
86 | |||
87 | ret |
||
88 | |||
89 | draw_logo: |
||
90 | |||
91 | mov ebx,2 |
||
92 | mov ecx,2 |
||
93 | mov edx,[color_table+1*4] |
||
94 | mov edi,tetris_t |
||
95 | call draw_title_block |
||
96 | mov ebx,5 |
||
97 | mov ecx,3 |
||
98 | mov edx,[color_table+2*4] |
||
99 | mov edi,tetris_e |
||
100 | call draw_title_block |
||
101 | mov ebx,8 |
||
102 | mov ecx,2 |
||
103 | mov edx,[color_table+3*4] |
||
104 | mov edi,tetris_t |
||
105 | call draw_title_block |
||
106 | mov ebx,11 |
||
107 | mov ecx,3 |
||
108 | mov edx,[color_table+4*4] |
||
109 | mov edi,tetris_r |
||
110 | call draw_title_block |
||
111 | mov ebx,13 |
||
112 | mov ecx,2 |
||
113 | mov edx,[color_table+5*4] |
||
114 | mov edi,tetris_i |
||
115 | call draw_title_block |
||
116 | mov ebx,15 |
||
117 | mov ecx,3 |
||
118 | mov edx,[color_table+6*4] |
||
119 | mov edi,tetris_s |
||
120 | call draw_title_block |
||
121 | mov ebx,20 |
||
122 | mov ecx,2 |
||
123 | mov edx,[color_table+7*4] |
||
124 | mov edi,tetris_II |
||
125 | call draw_title_block |
||
126 | |||
127 | ret |
||
128 | |||
129 | show_text: |
||
130 | mov ebx,6*65536+120 ; draw info text with function 4 |
||
131 | mov ecx,0xff0000 |
||
132 | mov esi,34 |
||
133 | newline: |
||
134 | mov eax,4 |
||
135 | int 0x40 |
||
136 | add ebx,10 |
||
137 | add edx,34 |
||
138 | cmp [edx],byte 'x' |
||
139 | jne newline |
||
140 | ret |
||
141 |