-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from codes import init as base | ||
import pygame as pg | ||
import pygame.locals as pgl | ||
import os | ||
import json | ||
from codes import textview | ||
#intialize objects | ||
main=base.inital() | ||
mainwindow=main.get_screen_object() | ||
bgexist=0 | ||
textlist=textview.textview() | ||
font4title_index=textlist.new_text() | ||
font4title=textlist.get_object(font4title_index) | ||
|
||
if os.access("./res/bg.png",os.R_OK): | ||
bg=pg.image.load("./res/bg.png").convert() | ||
bgexist=1 | ||
|
||
if main.config_exist==1: | ||
config={} | ||
with open(main.config_path,'r') as config_reader:#read configs | ||
config=json.load(config_reader) | ||
#load title text properties from config.json | ||
font4title.set_color(config["font_color"]) | ||
font4title.set_font(config["font"]) | ||
font4title.set_content(config["title"]) | ||
font4title.set_size(config["font_size"]) | ||
|
||
font4title.set_text() | ||
|
||
while True: | ||
for event in pg.event.get(): | ||
if event.type == pgl.QUIT: | ||
main.onquit() | ||
|
||
#show background if it's there | ||
if bgexist==1: | ||
mainwindow.blit(bg,(0,0)) | ||
|
||
font4title.render_surface() | ||
#get title text size for show it in center | ||
F_width,F_height=font4title.get_dimensions() | ||
#show title text | ||
mainwindow.blit(font4title.get_surface(),((main.get_reso_horizontal()-F_width)/2,100)) | ||
#Update display | ||
pg.display.update() | ||
main.onquit() |