-
Notifications
You must be signed in to change notification settings - Fork 0
/
screen.cpp
58 lines (46 loc) · 1.49 KB
/
screen.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
#include <allegro.h>
#include <stdio.h>
#include "include\screen.h"
#include "include\ship.h"
#include "include\asteroid.h"
int screen_Array[24][24];
BITMAP *buffer, *asteroid, *bonus;
void screen_Scroll() {
int x, y;
for (y = 23; y > 0; y--) {
for (x = 0; x < 24; x++) {
screen_Array[x][y] = screen_Array[x][y - 1];
screen_Array[x][y - 1] = 0;
}
}
asteroid_Newline();
}
void screen_Draw() {
clear(buffer);
int x, y;
for (y = 0; y < 24; y++) {
for (x = 0; x < 24; x++) {
switch (screen_Array[x][y]) {
case 1: blit(asteroid, buffer, 0, 0, (x * asteroid->w), (y * asteroid->h), asteroid->w, asteroid->h);
break;
case 2: blit(bonus, buffer, 0, 0, (x * bonus->w), ( y * bonus->h), bonus->w, bonus->h);
break;
}
}
}
ship_Draw();
screen_Info();
screen_Show();
}
void screen_Info() {
char score_Buffer[20];
line(buffer, 482, 0, 482, 480, level);
//score = ((level-1) * 100) + (scrolls * 1) + (bonuses * 100);
sprintf(score_Buffer, "Score: %d", score);
textout(buffer, comic, score_Buffer, 484, 10, level);
sprintf(score_Buffer, "Level: %d", level);
textout(buffer, comic, score_Buffer, 484, 40, level);
}
void screen_Show() {
blit(buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
}