Okay, I jumped back into the code. The clock class is built to stretch the width of the image so that it will adjust to fit the size of the font. It will make the image wider if you are also showing seconds, a narrower if you aren't. It is meant to make it so you don't have to do as much work. However, if you don't want the image size being adjusted to fit, you'll have to change some of the code and then do some adjustment by hand until you get a font spacing that looks like what you want.
So in the clock.rpy code.
At the top where you define the class...
Code: Select all
"""As a Creater Defined Displayable this needs to extend the Displayable class)"""
class Clock(renpy.Displayable):
#The clock class constructor
def __init__(self, ana=True, h=0, m=0, cwidth=150, cheight=150, sH=True, mil_time=False, **kwargs):
"""
This constructor takes the following arguments:
ana = True gives the analogue version of the clock, False gives digital
h=Hours the clock should start on
m=Minutes the clock should start on
cwidth=How wide you want your clock images to be
cheight=How wide you want your clock image to be--note for the analogue clock width and height must be the same of it won't work
sH=If you want the second hand to be visible or not
If you do not give any arguments when you create the clock, it will default to
a clock with 0 hours, 0 minutes, 150 pixels square, with a second hand showing
"""
super(Clock, self).__init__(**kwargs)
#These lines are for setting up the images used and the size of them
self.width = cwidth
#self.d_height = (resize*32)/100
self.d_height = cheight
self.base_image = im.Scale(img[0], cwidth, cwidth)
self.hour_hand_image = im.Scale(img[1], cwidth, cwidth)
self.minute_hand_image = im.Scale(img[2], cwidth, cwidth)
self.second_hand_image = im.Scale(img[3], cwidth, cwidth)
self.digital_base_image = im.Scale("00 images/DigitalClockBase460x200.png",
self.width, self.d_height)
self.offset = (cwidth*2**0.5-cwidth)/2
self.second_hand_visible = sH
You are adding a height parameter here, so you put in exactly what width and height you want the clock to be. This does mean that you will break the code if you are using an analogue clock and don't that both width and height the same.
Now this isn't going to be enough. You are now going to have to hand adjust the font size until it fits in your clock image. My original code does it for you, but you are going to have to do it yourself.
Find this part of the clock.rpy code. It is under the render method:
Code: Select all
else:
# create the text that will go in the Digital Clock and boxes text sits in
ftht = self.d_height * 0.6 #Adjust this for font size, i.e. height
col =Text(":", style="digi_clock", size=ftht)
time = list(Text("{0:02d}".format(item), style="digi_clock", size=ftht)
for item in self.get_time())
fxsize = (self.width-60)//3 #Adjust this for the spacing
So in the line: ftht = self.d_height * 0.6
you'll want to change the 0.6 to a number that will make the font fit will in your image. I think I originally had 0.8? Then I changed it to 0.6 and that fit well for me. Decide what works for you.
In the line: fxsize = (self.width-60)//3
I changed the 4 to a 3...that makes the time much wider, a 5 would make it much narrower.
I changed the -10 to a -60 for smaller adjustments, the bigger the negative number the closer the numbers will be together.
You will have to hand adjust those numbers since you are taking the auto adjustment out.
You would call your clock in the script file like so:
Code: Select all
default myClock = Clock(False, 7, 24, 460, 200, False, True)
Make those changes and then adjust away!