projects
/
butaba-adventures.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added a different font
[butaba-adventures.git]
/
utility.py
diff --git
a/utility.py
b/utility.py
index
9c68c05
..
5ef5428
100644
(file)
--- a/
utility.py
+++ b/
utility.py
@@
-5,7
+5,7
@@
import os.path
# function to draw text on surface
def put_text (surface, x, y, size, (r,g,b), text):
# function to draw text on surface
def put_text (surface, x, y, size, (r,g,b), text):
- harisfont = os.path.join ("font", "
HarisComic-2
.ttf")
+ harisfont = os.path.join ("font", "
harisgamefont
.ttf")
textsurf = pygame.font.Font (harisfont, size).render (text, True, pygame.Color (r,g,b))
surface.blit (textsurf, (x, y))
textsurf = pygame.font.Font (harisfont, size).render (text, True, pygame.Color (r,g,b))
surface.blit (textsurf, (x, y))
@@
-13,19
+13,19
@@
def put_text (surface, x, y, size, (r,g,b), text):
def put_lines (surface, text_lines):
textsurfs = []
height = 0
def put_lines (surface, text_lines):
textsurfs = []
height = 0
- harisfont = os.path.join ("font", "
HarisComic-2
.ttf")
+ harisfont = os.path.join ("font", "
harisgamefont
.ttf")
for size, r, g, b, text in text_lines:
s = pygame.font.Font (harisfont, size).render (text, True, pygame.Color (r,g,b))
for size, r, g, b, text in text_lines:
s = pygame.font.Font (harisfont, size).render (text, True, pygame.Color (r,g,b))
- # add
10 for
spacing
- height = height + s.get_height()
+ 10
+ # add spacing
+ height = height + s.get_height()
*1.5
textsurfs.append (s)
scrwidth = surface.get_width ()
scrheight = surface.get_height ()
i = 0
for s in textsurfs:
textsurfs.append (s)
scrwidth = surface.get_width ()
scrheight = surface.get_height ()
i = 0
for s in textsurfs:
- surface.blit (s, (scrwidth/2 - s.get_width()/2, scrheight/2 - height/2+ i*
s.get_height()+10
))
+ surface.blit (s, (scrwidth/2 - s.get_width()/2, scrheight/2 - height/2+ i*
(s.get_height()*1.5)
))
i += 1
# function to ask a question and return answer
i += 1
# function to ask a question and return answer
@@
-34,7
+34,7
@@
def ask_question (surface, question, answers, bgscreen):
sel_answer = 1
while 1:
sel_answer = 1
while 1:
- textarray = [ [
22
, 128, 0, 0, question ] ]
+ textarray = [ [
10
, 128, 0, 0, question ] ]
i = 1
for answer in answers:
i = 1
for answer in answers:
@@
-42,7
+42,7
@@
def ask_question (surface, question, answers, bgscreen):
r, g, b = 0, 0, 216
else:
r, g, b = 0, 0, 0
r, g, b = 0, 0, 216
else:
r, g, b = 0, 0, 0
- textarray.append ( [
2
0, r, g, b, answer] )
+ textarray.append ( [
1
0, r, g, b, answer] )
i += 1
i += 1