Skip to content

Commit

Permalink
Fixed screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfstarDev authored Jul 7, 2024
1 parent 813a912 commit dc7d657
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 9 additions & 4 deletions matchanovel/defold_gui/images.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,21 @@ function M.set_node_to_thumbnail(node_id, slot)
end
end
local loaded_screenshot = loaded_screenshots[slot]
if loaded_screenshot then
if loaded_screenshot and loaded_screenshot ~= "" then
local node = gui.get_node(node_id)
set_node_to_png_buffer(node, loaded_screenshot, node_id)
return true
else
return false
end
end

function M.save_cached_screenshot(slot)
local filename = save.get_path(slot, nil, nil, "png")
files.write_binary(filename, cached_screenshot)
loaded_screenshots[slot] = cached_screenshot
if cached_screenshot then
local filename = save.get_path(slot, nil, nil, "png")
files.write_binary(filename, cached_screenshot)
loaded_screenshots[slot] = cached_screenshot
end
end


Expand Down
9 changes: 8 additions & 1 deletion matchanovel/defold_gui/menu.gui_script
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,14 @@ local function show_slot_as_written(page_slot, text)
end
--gui.play_flipbook(gui.get_node("save_"..page_slot.."/thumbnail"), "thumbnail")
gui.set_enabled(gui.get_node("save_"..page_slot.."/thumbnail"), true)
images.set_node_to_thumbnail("save_"..page_slot.."/thumbnail", slot)
local node_id = "save_"..page_slot.."/thumbnail"
local node = gui.get_node(node_id)
local thumbnail_loaded = images.set_node_to_thumbnail(node_id, slot)
if thumbnail_loaded then
gui.set_color(node, vmath.vector3(1, 1, 1))
else
gui.set_color(node, vmath.vector3(0.5, 0.5, 0.5))
end
--gui.animate(gui.get_node("save_"..page_slot.."/slot"), "color.w", 0.95, gui.EASING_INOUTSINE, 0.25)
end

Expand Down

0 comments on commit dc7d657

Please sign in to comment.