Debian Codegraph @

src/screen.cc

raw symbols SCIP
1 // (_||_/
2 // ( )
3 // ( o 0 )
4 //-OOO°--(_)---°OOO---------------------------------------
5 // Copyright (C) 2006 By Dominique Roux-Serret
6 // .OOOo oOOO. [email protected]
7 //-( )------( )---------------------------------------
8 // ( ( ) / Copyright (C) 2023 By Johnny Jazeix
9 // (_) (_/ [email protected]
10
11 // This program is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation; either version 2 or version 3 of the License.
14
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19
20 // You should have received a copy of the GNU General Public License along
21 // with this program; if not, write to the Free Software Foundation, Inc.,
22 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24 #include "preference.h"
25 #include "sprite.h"
26 #include "screen.h"
27
28 /*** Variables globales ***/
29 /**************************/
30 extern Sprite *Sprites;
31
32 /*** Affiche un Sprite ***/
33 /*************************/
34 void Screen::PrintSprite(e_Sprite NumSpr, int Num, int x, int y)
35 {
36 B[N].NumSpr = NumSpr;
37 B[N].Num = Num;
38 B[N].x = x;
39 B[N].y = y;
40 N++;
41
42 Sprites[NumSpr].Affiche(x, y, Num);
43 }
44
45 void Screen::PrintCable(int dx, int dy, int fx, int fy)
46 {
47 // Show the rope between the wagons
48 Sprites[rope].PrintRope(dx, dy, fx, fy);
49
50 // Save cable position to delete it later
51 B[N].NumSpr = rope;
52 B[N].Num = 0;
53 B[N].x = dx;
54 B[N].y = dy;
55 B[N].fx = fx;
56 B[N].fy = fy;
57 N++;
58 }
59
60 /*** Affiche un text ***/
61 /***********************/
62 void Screen::PrintText(e_Sprite Text, int x, int y)
63 {
64 B[N].NumSpr = Text;
65 B[N].Num = 0;
66 B[N].x = x;
67 B[N].y = y;
68 N++;
69
70 Sprites[Text].Affiche(x, y, 0);
71 }
72
73 /*** Affiche les options du jeu ***/
74 /**********************************/
75 void Screen::PrintOptions(int NV, int NScore)
76 {
77 int x, y;
78
79 Score = NScore;
80 AfficheChiffre(740, 215, Score);
81
82 if (NV > 10) {
83 NV = 10; // Evite un dépassement de l'affichage
84 }
85 for (int i = 0; i < NV; ++i) { // Affiche les vies
86 x = i % 2;
87 x = x * 44 + 38 + LT * D_Case;
88 y = i / 2;
89 y = 384 + y * 46;
90 Sprites[logo_vie].Affiche(x, y, 0);
91 }
92 }
93
94 /*** Efface les sprites ***/
95 /**************************/
96 void Screen::ClearSprite(e_Sprite NumSp)
97 {
98 N = 0;
99 }
100
101 /*** Efface l'ecran avec l'image de fond ***/
102 /*******************************************/
103 void Screen::CleanSpriteAndScreen(e_Sprite NumSp)
104 {
105 Sprites[NumSp].Affiche(Sprites[NumSp].Dim[0].L / 2, Sprites[NumSp].Dim[0].H / 2, 0);
106 N = 0;
107 Score = -1;
108 }