diff --git a/game/src/cg_gallery.rpy b/game/src/cg_gallery.rpy index 35e59fd..e6a2cd3 100644 --- a/game/src/cg_gallery.rpy +++ b/game/src/cg_gallery.rpy @@ -1,6 +1,7 @@ -init python: +init 2 python: + import json # CONST PARAMS ALLOW_ZOOM = False @@ -36,15 +37,20 @@ init python: for cp in CG_PATHS: gallery_dic[cp['name']] = [] # + + # Make a scaled cg button # (cg: string; ext: string; w: float def cg_(fname, ext, w): scale = PREFERRED_WIDTH / w #scale = box_ratio(wh) #image = im.FactorScale(fname, scale, scale, True) - image = im.FactorScale(fname, scale, scale, True) - #return Image(fname, zoom=scale) - return image + if type(fname) is str: + image = im.FactorScale(fname, scale, scale, True) + return image + else: + return Transform(fname, zoom=scale) + #return Transform(fname, crop=(0,0,1920,1080), zoom=scale) # Reads /images/cgs dir for all image files # Populates galleryItems @@ -147,6 +153,66 @@ init python: pass + """ + renpy.image( fullbody_fangguitar = Composite( + (1920, 1080), + (0, 0), 'fangroom', + (0, 0), 'fangguitar')) + """ + + def jsonloadandpop(): + #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" + FILENAME = os.path.join(config.basedir, 'game/src/gallery_dataset.json') + #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" + fp = open(FILENAME) + data = json.load(fp) + + list_img = renpy.list_images() + + for x in data['tabs']: + + tab_name = x['tab_name'] + _eval = None + if 'eval' in x.keys(): + _eval = x['eval'] + + CG_PATHS.append({'path': None, 'name': tab_name, 'eval': _eval}) + gallery_dic[tab_name] = [] + #gallery_dataset + + if 'items' in x.keys(): + for y in x['items']: + name = y["name"] + cg = y["image"] + + rcg = renpy.get_registered_image(cg) + + #print(rcg.get_size()) + image_dimensions = (1920, 1080) #renpy.image_size(rcg) + + item = { + "item": name, + "fn": rcg, + "cg": cg_(rcg, None, image_dimensions[0]), + "ext": None, + "wh": image_dimensions + } + gallery_dic[tab_name].append(item) + else: #folders + for str in list_img: + for cp in x['folders']: + for ext in ACCEPTED_EXTENSIONS: + path = cp #cp['path'] + _str = path+str+"."+ext + + print(_str) + if renpy.loadable(_str): #brute force + add_(str, _str, ext, tab_name) #cp['name']) + + print(data) + pass + + jsonloadandpop() pass @@ -231,7 +297,7 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'): ycenter 0.525 vpgrid id "vpg": - yinitial __yoffset + #yinitial __yoffset scrollbars "vertical" mousewheel True draggable True @@ -265,7 +331,7 @@ if/else flow control & extra parameters for Buttons """ screen flag_button(item, yoffset, origin): python: - flag = renpy.seen_image(item['item']) + flag = True #renpy.seen_image(item['item']) if flag: button: @@ -310,8 +376,9 @@ screen view_image(item, _origin, zoom = zoom_arr.index(1.0), flag='a'): zoom_b_f = ShowMenu('view_image_'+flag, item, _origin, zoom_b) tag menu - key "game_menu" action _origin - key "button_alternate" action _origin + key "game_menu" action [Hide('view_image'), Show('cg_gallery_0')] #_origin + key "button_alternate" action [Hide('view_image'), Show('cg_gallery_0')] + #key "button_alternate" action _origin # mousewheel & insert+delete if (ALLOW_ZOOM): diff --git a/game/src/definitions.rpy b/game/src/definitions.rpy index 1660ec5..02c2835 100644 --- a/game/src/definitions.rpy +++ b/game/src/definitions.rpy @@ -1,81 +1,93 @@ -init offset = 1 #load later than the scripts folder #dpromdance # fang full body -image fullbody_hallpass = Composite( +init 1 python: + renpy.image('fullbody_hallpass', Composite( (1920, 1080), (0, 0), 'roof day', (0, 0), 'hallpass') + ) -image fullbody_fangguitar = Composite( + renpy.image('fullbody_fangguitar', Composite( (1920, 1080), (0, 0), 'fangroom', (0, 0), 'fangguitar') + ) + #full body fang anon wombo -#full body fang anon wombo - -image fullbody_fangarm = Composite( + renpy.image('fullbody_fangarm', Composite( (1920, 1080), - (-771, 0), 'room anon day alt', #check - (213, 0), 'fangarm') + (0, 0), 'room anon day alt', #check + (0, 47), Transform('fangarm', xsize=1920, fit='cover')) + ) -image fullbody_fanganonguitar = Composite( + renpy.image('fullbody_fanganonguitar', Composite( (1920, 1080), (0, 0), 'fangroom', (213, 0), 'fanganonguitar') + ) -#path to true ending only -image fullbody_fanganonhug = Composite( - (1920, 1080), - (0, 0), 'roof day', - (0, 0), 'fanganonhug') + #path to true ending only + renpy.image('fullbody_fanganonhug', Composite( + (1920, 1080), + (0, 0), 'roof day', + (0, 0), 'fanganonhug') + ) -#crops -image fullbody_kissu1 = Composite( + #crops + renpy.image('fullbody_kissu1', Composite( (1920, 1080), (0, 0), 'room anon night', - (-529, 0), 'kissu1') + (0, 0), Transform('kissu1', crop=(49, 0, 1920, 1080))) + ) -image fullbody_kissu2 = Composite( + renpy.image('fullbody_kissu2', Composite( (1920, 1080), (0, 0), 'room anon day', (213, 0), 'kissu2') + ) -# ENDING 4 + # ENDING 4 -image fullbody_dpromdance = Composite( + renpy.image('fullbody_dpromdance', Composite( (1920, 1080), (0, 0), 'park_night', (0, 0), 'dpromdance') + ) -image fullbody_christmas = Composite( + renpy.image('fullbody_christmas', Composite( (1920, 1080), (0, 0), 'room anon day', (0, 0), 'anonchristmasmorning') + ) -# ENDING 3 + # ENDING 3 -image fullbody_c06 = Composite( + renpy.image('fullbody_c06', Composite( (1920, 1080), (0, 0), 'park night', (0, 0), 'c06') + ) -image fullbody_c07 = Composite( + renpy.image('fullbody_c07', Composite( (1920, 1080), (0, 0), 'park night', (0, 0), 'c07') + ) -image fullbody_c09 = Composite( + renpy.image('fullbody_c09', Composite( (1920, 1080), (0, 0), 'city morning', (0, 0), 'c09') + ) -# ENDING 1 + # ENDING 1 -image fullbody_fang_shooter = Composite( + renpy.image('fullbody_fang_shooter', Composite( (1920, 1080), - (0, 0), 'shooterroof', - (0, 0), 'fang shooter') + (0, 0), Transform('shooterroof', xsize=1920, fit='cover'), + (0, 0), Transform('fang shooter', crop=(0,0,1920,1080))) + ) diff --git a/game/src/gallery_dataset.json b/game/src/gallery_dataset.json index d4d0a65..4269c12 100644 --- a/game/src/gallery_dataset.json +++ b/game/src/gallery_dataset.json @@ -1,25 +1,27 @@ { - { - "tab_name": "Full Body Fang", - "items": { - { "name": "hallpass", "image": "fullbody_hallpass" }, - { "name": "fangguitar", "image": "fullbody_fangguitar" }, - { "name": "fangshooter", "image": "fullbody_fangshooter" } - } - }, - { - tab_name: "Full Body Fang & Anon", - "items": { - { "name": "fanganonhug", "image": "fullbody_fanganonhug" }, - { "name": "fanganonguitar", "image": "fullbody_fanganonguitar" }, - { "name": "fangarm", "image": "fullbody_fangarm" }, - { "name": "kissu1", "image": "fullbody_kissu1" }, - { "name": "kissu2", "image": "fullbody_kissu2" }, - { "name": "c06", "image": "fullbody_c06" }, - { "name": "c07", "image": "fullbody_c07" }, - { "name": "c09", "image": "fullbody_c09" }, - { "name": "anonchristmasmorning", "image": "fullbody_christmas" } - } - } + "tabs":[ + { + "tab_name": "Full body Fang", + "items": [ + { "name": "hallpass", "image": "fullbody_hallpass" }, + { "name": "fangguitar", "image": "fullbody_fangguitar" }, + { "name": "fangshooter", "image": "fullbody_fang_shooter" } + ] + }, + { + "tab_name": "Full body Fang & Anon", + "items": [ + { "name": "fanganonhug", "image": "fullbody_fanganonhug" }, + { "name": "fanganonguitar", "image": "fullbody_fanganonguitar" }, + { "name": "fangarm", "image": "fullbody_fangarm" }, + { "name": "kissu1", "image": "fullbody_kissu1" }, + { "name": "kissu2", "image": "fullbody_kissu2" }, + { "name": "c06", "image": "fullbody_c06" }, + { "name": "c07", "image": "fullbody_c07" }, + { "name": "c09", "image": "fullbody_c09" }, + { "name": "anonchristmasmorning", "image": "fullbody_christmas" } + ] + } + ] }