Closes: lazysnake/feature/ISSUE-3_CG_Gallery #3 #55
|
@ -103,6 +103,8 @@ define gui.main_menu_text_size = 60
|
|||
## The images used for the main and game menus.
|
||||
define gui.main_menu_background = "gui/main_menu.png"
|
||||
define gui.game_menu_background = "gui/game_menu.png"
|
||||
define gui.extras_submenu_background = "gui/overlay/extras_submenu.png"
|
||||
define gui.extras_submenu_panel = "gui/overlay/extras_submenu_panel.png"
|
||||
|
||||
## Dialogue ####################################################################
|
||||
##
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
Binary file not shown.
After Width: | Height: | Size: 215 KiB |
Binary file not shown.
Before Width: | Height: | Size: 425 KiB |
Binary file not shown.
Before Width: | Height: | Size: 549 KiB |
Binary file not shown.
Before Width: | Height: | Size: 210 KiB |
225
game/screens.rpy
225
game/screens.rpy
|
@ -424,9 +424,10 @@ screen main_menu():
|
|||
[ "Start", Start() ], \
|
||||
[ "Load", ShowMenu("load") ], \
|
||||
[ "Options", ShowMenu("preferences") ], \
|
||||
[ "Help & About", ShowMenu("extras") ], \
|
||||
[ "Extra", ShowMenu("extras") ], \
|
||||
[ "Quit", Quit(confirm=not main_menu) ] \
|
||||
] )
|
||||
on "show" action renpy.start_predict_screen("cg_gallery")
|
||||
|
||||
# if gui.show_name:
|
||||
#
|
||||
|
@ -600,69 +601,33 @@ style return_button:
|
|||
screen about():
|
||||
|
||||
tag menu
|
||||
style_prefix "main_menu"
|
||||
|
||||
## This use statement includes the game_menu screen inside this one. The
|
||||
## vbox child is then included inside the viewport inside the game_menu
|
||||
## screen.
|
||||
use game_menu(_("About"), scroll="viewport"):
|
||||
add gui.main_menu_background
|
||||
add gui.extras_submenu_panel
|
||||
|
||||
style_prefix "about"
|
||||
## This empty frame darkens the main menu.
|
||||
frame:
|
||||
pass
|
||||
|
||||
vbox:
|
||||
## The use statement includes another screen inside this one. The actual
|
||||
## contents of the main menu are in the navigation screen.
|
||||
|
||||
label "[config.name!t]"
|
||||
text _("Version [config.version!t]\n")
|
||||
vbox:
|
||||
yalign 0.00
|
||||
yoffset 100
|
||||
xoffset 80
|
||||
xmaximum 1100
|
||||
label "[config.name!t]"
|
||||
text _("Version [config.version!t]\n")
|
||||
|
||||
## gui.about is usually set in options.rpy.
|
||||
if gui.about:
|
||||
text "[gui.about!t]\n"
|
||||
|
||||
text _("Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]\nTo find more information about the game (and its source code) please visit {a=https://www.snootgame.xyz/}our website{/a}.")
|
||||
textbutton "Back to Extras" action ShowMenu("extras")
|
||||
|
||||
## This is redefined in options.rpy to add text to the about screen.
|
||||
define gui.about = ""
|
||||
|
||||
|
||||
style about_label is gui_label
|
||||
style about_label_text is gui_label_text
|
||||
style about_text is gui_text
|
||||
|
||||
style about_label_text:
|
||||
size gui.label_text_size
|
||||
|
||||
## Gallery screen ################################################################
|
||||
##
|
||||
## This screen holds the Gallery.
|
||||
##
|
||||
|
||||
screen gallery():
|
||||
|
||||
tag menu
|
||||
|
||||
## This use statement includes the game_menu screen inside this one. The
|
||||
## vbox child is then included inside the viewport inside the game_menu
|
||||
## screen.
|
||||
use game_menu(_("Gallery"), scroll="viewport"):
|
||||
|
||||
style_prefix "gallery"
|
||||
|
||||
vbox:
|
||||
|
||||
label "[config.name!t]"
|
||||
text _("Version [config.version!t]\n")
|
||||
|
||||
text _("Placeholder for gallery.")
|
||||
textbutton "Back to Extras" action ShowMenu("extras")
|
||||
|
||||
|
||||
style gallery_label is gui_label
|
||||
style gallery_label_text is gui_label_text
|
||||
style gallery_text is gui_text
|
||||
|
||||
style gallery_label_text:
|
||||
size gui.label_text_size
|
||||
## gui.about is usually set in options.rpy.
|
||||
if gui.about:
|
||||
text "[gui.about!t]\n"
|
||||
|
||||
style_prefix "quick"
|
||||
text _("{size=30}Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]\nTo find more information about the game (and its source code) please visit {a=https://www.snootgame.xyz/}our website{/a}.{/size}") text_align 0
|
||||
use extrasnavigation
|
||||
|
||||
## Updates screen ################################################################
|
||||
##
|
||||
|
@ -673,41 +638,33 @@ screen updates():
|
|||
|
||||
tag menu
|
||||
|
||||
## This use statement includes the game_menu screen inside this one. The
|
||||
## vbox child is then included inside the viewport inside the game_menu
|
||||
## screen.
|
||||
use game_menu(_("Updates"), scroll="viewport"):
|
||||
style_prefix "main_menu"
|
||||
|
||||
style_prefix "updates"
|
||||
add gui.main_menu_background
|
||||
add gui.extras_submenu_panel
|
||||
|
||||
vbox:
|
||||
## This empty frame darkens the main menu.
|
||||
frame:
|
||||
pass
|
||||
|
||||
label "[config.name!t]"
|
||||
text _("Your Version is [config.version!t]\n")
|
||||
textbutton "[update]" ##action Update()
|
||||
textbutton "Back to Extras" action ShowMenu("extras")
|
||||
## The use statement includes another screen inside this one. The actual
|
||||
## contents of the main menu are in the navigation screen.
|
||||
|
||||
|
||||
|
||||
## This is redefined in options.rpy to add text to the about screen.
|
||||
define gui.update = ""
|
||||
|
||||
|
||||
style update_label is gui_label
|
||||
style update_label_text is gui_label_text
|
||||
style update_text is gui_text
|
||||
style page_button is gui_button
|
||||
style page_button_text is gui_button_text
|
||||
|
||||
|
||||
style update_label_text:
|
||||
size gui.label_text_size
|
||||
|
||||
style update_button:
|
||||
properties gui.button_properties("page_button")
|
||||
|
||||
style update_button_text:
|
||||
properties gui.button_text_properties("page_button")
|
||||
##todo add size
|
||||
##add gui.game_menu_background
|
||||
vbox:
|
||||
xalign 0.10
|
||||
ypos 1000
|
||||
text _("UPDATES")
|
||||
label "[config.name!t]"
|
||||
text _("Your Version is [config.version!t]\n")
|
||||
##style_prefix "check"
|
||||
label _("Auto Update")
|
||||
textbutton _("Enable Automatic Updates") action ToggleVariable("persistent.autoup", True, False)
|
||||
textbutton _("Update Now!") ##action ("persistent.autoup", True, False) This should also set the value of updateresults
|
||||
label _("Update Result:\n")
|
||||
text _("[persistent.updateresult!t]\n")
|
||||
use extrasnavigation
|
||||
|
||||
## Load and Save screens #######################################################
|
||||
##
|
||||
|
@ -1119,14 +1076,41 @@ style history_label_text:
|
|||
## A screen that combines help, about, updates, gallery,
|
||||
screen extras():
|
||||
tag menu
|
||||
|
||||
style_prefix "main_menu"
|
||||
|
||||
add gui.main_menu_background
|
||||
|
||||
## This empty frame darkens the main menu.
|
||||
frame:
|
||||
pass
|
||||
|
||||
use extrasnavigation
|
||||
|
||||
##Extras Navigation Screen #####################################################
|
||||
##
|
||||
##This screen is to be reused in
|
||||
screen extrasnavigation():
|
||||
vbox:
|
||||
textbutton _("Help") action ShowMenu("help")
|
||||
textbutton _("About") action ShowMenu("about")
|
||||
textbutton _("Updates") action ShowMenu("updates")
|
||||
textbutton _("Gallery") action ShowMenu("gallery")
|
||||
textbutton _("Return") action ShowMenu("main_menu")
|
||||
|
||||
xpos 1940
|
||||
yalign 0.03
|
||||
|
||||
if persistent.splashtype == 1:
|
||||
add "gui/sneedgame.png"
|
||||
else:
|
||||
add "gui/snootgame.png"
|
||||
vbox:
|
||||
spacing 25
|
||||
xpos 1885
|
||||
yalign 0.9
|
||||
use main_menu_buttons("gui/button/menubuttons/template_idle.png",
|
||||
[
|
||||
[ "Help", ShowMenu("help") ],
|
||||
[ "About", ShowMenu("about") ],
|
||||
[ "Updates", ShowMenu("updates") ],
|
||||
[ "Gallery", ShowMenu("cg_gallery") ],
|
||||
[ "Return", ShowMenu("main_menu") ]
|
||||
] )
|
||||
|
||||
## Help screen #################################################################
|
||||
##
|
||||
|
@ -1138,33 +1122,50 @@ screen help():
|
|||
|
||||
tag menu
|
||||
|
||||
style_prefix "main_menu"
|
||||
|
||||
add gui.main_menu_background
|
||||
add gui.extras_submenu_panel
|
||||
|
||||
## This empty frame darkens the main menu.
|
||||
frame:
|
||||
pass
|
||||
|
||||
default device = "keyboard"
|
||||
|
||||
use game_menu(_("Help"), scroll="viewport"):
|
||||
# vbox:
|
||||
# xpos 1100
|
||||
# ## ypos 1000
|
||||
# yalign 0.4
|
||||
# spacing 23
|
||||
|
||||
style_prefix "help"
|
||||
fixed:
|
||||
hbox:
|
||||
xpos 200
|
||||
spacing 23
|
||||
style_prefix "help"
|
||||
textbutton _("Keyboard") action SetScreenVariable("device", "keyboard")
|
||||
textbutton _("Mouse") action SetScreenVariable("device", "mouse")
|
||||
if GamepadExists():
|
||||
textbutton _("Gamepad") action SetScreenVariable("device", "gamepad")
|
||||
|
||||
vbox:
|
||||
spacing 23
|
||||
|
||||
hbox:
|
||||
|
||||
textbutton _("Keyboard") action SetScreenVariable("device", "keyboard")
|
||||
textbutton _("Mouse") action SetScreenVariable("device", "mouse")
|
||||
textbutton "Back to Extras" action ShowMenu("extras")
|
||||
if GamepadExists():
|
||||
textbutton _("Gamepad") action SetScreenVariable("device", "gamepad")
|
||||
|
||||
yalign 0.5
|
||||
xpos 1100
|
||||
if device == "keyboard":
|
||||
use keyboard_help
|
||||
elif device == "mouse":
|
||||
use mouse_help
|
||||
elif device == "gamepad":
|
||||
use gamepad_help
|
||||
text _("") ## again in here to keep vbox in check
|
||||
|
||||
use extrasnavigation
|
||||
|
||||
|
||||
|
||||
screen keyboard_help():
|
||||
|
||||
style_prefix "help"
|
||||
hbox:
|
||||
label _("Enter")
|
||||
text _("Advances dialogue and activates the interface.")
|
||||
|
@ -1211,7 +1212,7 @@ screen keyboard_help():
|
|||
|
||||
|
||||
screen mouse_help():
|
||||
|
||||
style_prefix "help"
|
||||
hbox:
|
||||
label _("Left Click")
|
||||
text _("Advances dialogue and activates the interface.")
|
||||
|
@ -1234,7 +1235,7 @@ screen mouse_help():
|
|||
|
||||
|
||||
screen gamepad_help():
|
||||
|
||||
style_prefix "help"
|
||||
hbox:
|
||||
label _("Right Trigger\nA/Bottom Button")
|
||||
text _("Advances dialogue and activates the interface.")
|
||||
|
@ -1262,7 +1263,7 @@ screen gamepad_help():
|
|||
|
||||
textbutton _("Calibrate") action GamepadCalibrate()
|
||||
|
||||
|
||||
#this bit is might need trimming or rework
|
||||
style help_button is gui_button
|
||||
style help_button_text is gui_button_text
|
||||
style help_label is gui_label
|
||||
|
@ -1285,8 +1286,6 @@ style help_label_text:
|
|||
xalign 1.0
|
||||
text_align 1.0
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
## Additional screens
|
||||
################################################################################
|
||||
|
|
|
@ -774,7 +774,7 @@ label chapter_1:
|
|||
|
||||
Nas "Look, whatever happens promise you won’t hold this against them."
|
||||
|
||||
Nas "They're actually a really a nice person once you get to know them"
|
||||
Nas "They're actually a really nice person once you get to know them"
|
||||
|
||||
A "Naser why did you just murder the english language in cold blood?"
|
||||
|
||||
|
|
|
@ -1853,8 +1853,6 @@ label chapter_13D:
|
|||
|
||||
"Curled up around my pillow, suckling on her thumb."
|
||||
|
||||
"And my present to her still hung around securely on her neck."
|
||||
|
||||
"I go back to the scrapbook, enjoying the memories I’ve shared with my friends."
|
||||
|
||||
"And to think I wanted to stay a loner when I first got here."
|
||||
|
|
|
@ -502,7 +502,7 @@ label chapter_5:
|
|||
|
||||
F "{i}Uuuuughhhhh…{/i}"
|
||||
|
||||
F "...Allright, whatever."
|
||||
F "...Alright, whatever."
|
||||
|
||||
Ro "Go, go now! And no more tripping!"
|
||||
|
||||
|
@ -2546,4 +2546,4 @@ label chapter_5:
|
|||
|
||||
"..."
|
||||
|
||||
return
|
||||
return
|
||||
|
|
|
@ -2598,7 +2598,7 @@ label chapter_6:
|
|||
|
||||
A "Like… Like her passion, Naser. She adores music. Adores {i}playing{/i} music."
|
||||
|
||||
A "And she has theses… moments where I can see the softer side of her."
|
||||
A "And she has these… moments where I can see the softer side of her."
|
||||
|
||||
"The pop of knuckles from Naser tells me I should rephrase that."
|
||||
|
||||
|
@ -2685,4 +2685,4 @@ label chapter_6:
|
|||
|
||||
"..."
|
||||
|
||||
return
|
||||
return
|
||||
|
|
|
@ -812,7 +812,7 @@ label chapter_7:
|
|||
|
||||
"Rosa wanted to stay and help clean buuut…"
|
||||
|
||||
"{i}Ro I am so sorry Stella! Come, I shall nurse you back at my home!{/i}"
|
||||
Ro "{i}I am so sorry Stella! Come, I shall nurse you back at my home!{/i}"
|
||||
|
||||
"I’d feel more sorry for Stella but Rosa looked capable of helping her."
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
init python:
|
||||
|
||||
# CONST PARAMS
|
||||
GALLERY_COLS = 3
|
||||
GALLERY_CGS_PER_PAGE = 6
|
||||
PREFERRED_WIDTH = 432 #px (1920 * 0.225)
|
||||
PREFERRED_HEIGHT = 243 #px (1080 * 0.225)
|
||||
DEFAULT_WIDTH_SCALE_RATIO = round(float(PREFERRED_WIDTH) / float(1920), 4)
|
||||
DEFAULT_HEIGHT_SCALE_RATIO = round(float(PREFERRED_HEIGHT) / float(1080), 4)
|
||||
NOT_UNLOCKED_COVER = im.FactorScale("gui/gallery/unlocked_cg_button_cover.png", DEFAULT_WIDTH_SCALE_RATIO, DEFAULT_HEIGHT_SCALE_RATIO)
|
||||
ACCEPTED_EXTENSIONS = ["jpg", "png"]
|
||||
CG_PATHS = "images/cgs/"
|
||||
|
||||
# GALLERY OBJECT
|
||||
# Handles unlockables via ren'py
|
||||
g = Gallery()
|
||||
g.transition = dissolve
|
||||
g.locked_button = NOT_UNLOCKED_COVER
|
||||
|
||||
# GALLERY ITEMS
|
||||
# Data structure that holds the data for each cg and button
|
||||
# item is the key in the Gallery
|
||||
# ext is the file extension
|
||||
# { item: string; cg: Displayable; ext: string }[]
|
||||
galleryItems = []
|
||||
|
||||
# Make a scaled cg button
|
||||
# (cg: string; ext: string; w: float; h: float; unlocked?: boolean): Displayable
|
||||
def cg(fname, ext, w, h):
|
||||
scaleFactor = getBoxNormalizerRatio(w, h)
|
||||
return im.FactorScale(CG_PATHS + fname + "." + ext, scaleFactor["x"], scaleFactor["y"], False)
|
||||
|
||||
# Create an object in g:Gallery, add to galleryItems
|
||||
# (imageName: string; ext: string; w: float; h: float) -> None
|
||||
def addGalleryItem(imageName, ext, w, h):
|
||||
g.button(imageName)
|
||||
g.image(imageName)
|
||||
|
||||
horizontalPan = Pan((w - 1920, h - 1080), (0, h - 1080), 30.0)
|
||||
verticalPan = Pan((w - 1920, h - 1080), (w - 1920, 0), 30.0)
|
||||
g.transform(horizontalPan if w > h else verticalPan) #TODO: niceify
|
||||
|
||||
str = "renpy.seen_image('"+imageName+"')"
|
||||
g.condition(str)
|
||||
|
||||
galleryItems.append({
|
||||
"item": imageName,
|
||||
"cg": cg(imageName, ext, w, h),
|
||||
"ext": ext
|
||||
})
|
||||
return
|
||||
|
||||
# Reads /images/cgs dir for all image files
|
||||
# Populates g:Gallery and galleryItems
|
||||
# Appends extra spaces at the end
|
||||
# () -> None
|
||||
def loadGallery():
|
||||
|
||||
list_img = renpy.list_images()
|
||||
|
||||
# Add each image to the gallery
|
||||
for str in list_img:
|
||||
_str = CG_PATHS+str+"."+ACCEPTED_EXTENSIONS[0]
|
||||
if renpy.loadable(_str): #brute force
|
||||
image = renpy.image_size(Image(_str))
|
||||
addGalleryItem(str, ACCEPTED_EXTENSIONS[0], image[0], image[1])
|
||||
return
|
||||
|
||||
|
||||
# Returns what params to call im.FactorScale with for cg button size
|
||||
# Basically the delta diff dimensions
|
||||
# (w: int; h: int) -> { x: float; y: float }
|
||||
def getBoxNormalizerRatio(w, h):
|
||||
x = round(float(PREFERRED_WIDTH) / float(w), 4)
|
||||
y = round(float(PREFERRED_HEIGHT) / float(h), 4)
|
||||
|
||||
return { "x": x, "y": y }
|
||||
|
||||
# Call to loading the gallery
|
||||
loadGallery()
|
||||
|
||||
## CG Gallery screen ########################################################
|
||||
## A screen that shows the image gallery
|
||||
screen cg_gallery():
|
||||
python:
|
||||
items = len(galleryItems)
|
||||
galleryRows = (items / GALLERY_COLS) + 1
|
||||
extraSpaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||
tag menu
|
||||
use game_menu(_("Gallery"), scroll="viewport"):
|
||||
grid GALLERY_COLS galleryRows:
|
||||
spacing 8
|
||||
for item in galleryItems:
|
||||
# vbox:
|
||||
# text item["item"] size 8
|
||||
add g.make_button(item["item"], item["cg"], xalign = 0.5, yalign = 0.5)
|
||||
# Add empty items to fill grid after last cg button
|
||||
for i in range(0, extraSpaces):
|
||||
null height 20
|
||||
|
Loading…
Reference in New Issue