-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
101 lines (87 loc) · 2.1 KB
/
main.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<allegro.h>
#include<iostream>
#include<math.h>
#include"araba.cpp"
#include"araba2.cpp"
#include<stdio.h>
#include<cstdlib>
#include<time.h>
using namespace std;
float km_dondur();
void Baslat();
void Bitir();
///////////////////////////////////////////
int main()
{
Baslat();
float toplamkm=0;
toplamkm=km_dondur();
BITMAP *ok= load_bitmap("bmp/ok3.bmp", NULL);
BITMAP *ok1= load_bitmap("bmp/ok4.bmp", NULL);
BITMAP *ara=create_bitmap(1300,675);
BITMAP *panel=load_bitmap("bmp/gosterge1.bmp", NULL);
BITMAP *panel2=load_bitmap("bmp/gosterge2.bmp", NULL);
BITMAP *yol=load_bitmap("bmp/yoll.bmp", NULL);
Secenekler *a=new Secenekler(ok,ara,panel,ok1,toplamkm);
Secenekler2 *a2=new Secenekler2(ok,ara,panel2,ok1,toplamkm);
time_t bas,son;
time(&bas);
while(!key[KEY_ESC])
{
time(&son);
rotate_sprite(ara,yol,0,0,0);
a->sure=difftime(son,bas);
a->Ciz();
a2->sure=difftime(son,bas);
a2->Ciz(a->gunluk_km);
a->Hareket();
blit(ara,screen,0,0,0,0,1300,675);
rest(10);
}
Bitir();
return 0;
}
/////////////////////////////////////////////////////////////////////////
END_OF_MAIN()
//////////////////////////////////////////////////////////////////////////////
void Baslat()
{
int depth, res;
allegro_init();
depth = desktop_color_depth();
if (depth == 0) depth = 32;
set_color_depth(depth);
res = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1300, 675, 0, 0);
if (res != 0)
{
allegro_message(allegro_error);
exit(-1);
}
install_timer();
install_keyboard();
install_mouse();
install_sound(DIGI_AUTODETECT,MIDI_AUTODETECT, "A");
}
///////////////////////////////////////////////////////////////////////////////////
void Bitir()
{
clear_keybuf();
}
////////////////////////////////////////////////////////
float km_dondur()
{
FILE *dosya;
float km;
float tkm=0;
if((dosya=fopen("data/km.txt","r"))==NULL)
{
}
while(!feof(dosya))
{
fscanf(dosya,"%f\n",&km);
tkm+=km;
}
fclose(dosya);
return tkm;
}
///////////////////////////////////////////////////////////////