Hi,
I've been building my own little polygon based drawing tool,
And I'm also making a couple of experiments using the output from that tool.
I would like to optimize my workflow, because currently its a bit involved.
What I do now is :
- draw something in that tool
- save the file into the save folder that belongs to that tool
- copy the file from there into my game's asset folder
- add some code to my game to use it
rinse and repeat.
I'd like to improve this in 2 ways (there might be more i havent thought of)
In game i'd like to just start editing the model, or add a new one, so the first question:
How would you make some -lets say - docked view 50% of the screen that has the drawing tool running
Specifically, how to handle all the love.mousepressed etc callbacks
Because then my game itself has a couple of the callbacks, and the editor has a few of the same ones.
Depending on if the editing tool is open and where you start clicking, mousewheeling etc one of the 2 callbacks should be used.
The other thing I havent really completely figured out;
There is probably an easier way then having to place files in a location, pointing the editor to it, and then having to overwrite the file at that location, also the fact that these files are not in the same vanilla save location is an issue I think that needs to be solved, I found some code in this post that might be useful (https://www.reddit.com/r/love2d/comment ... directory/), but was wondering if people have any experience and tips in this?
edit: ha, rubber duck is at it again, I think the first thing I have todo is make my drawingtool into a better library, which would have a bunch of functions that are identical to the love.callbacks (like in this post viewtopic.php?p=246793#p246793)
then i can conditionally call those in my game's
but, still up for good tips!
How to approach having an ingame editor
-
- Party member
- Posts: 559
- Joined: Wed Oct 05, 2016 11:53 am
Re: How to approach having an ingame editor
My game has its built-in level editor, and to make built-in maps I have the following debug function:- draw something in that tool
- save the file into the save folder that belongs to that tool
- copy the file from there into my game's asset folder
- add some code to my game to use it
Code: Select all
DEBUG.SAVE_LEVEL_TO_WORKING_DIRECTORY = function ( filename )
if not DEBUG.CAN_SAVE_TO_WORKING_DIRECTORY then return false end
local uos = love.system.getOS( )
local usr = (love.filesystem.getSaveDirectory( ) .. "/usergenerated/official_maps/" )
local dir = (BUILD_FLAGS.WORKING_DIRECTORY .. "/content/maps" )
local cmd
if uos == "Windows" then -- never got around implementing the behavior for other OSes
usr = usr:gsub ( "/", "\\" )
dir = dir:gsub ( "/", "\\" )
cmd = ('copy "' .. usr .. filename .. '" "' .. dir .. '" /Y /V')
end
print("-----------------------------------------------")
print("[DEBUG] Saving level file to working directory:")
print("\t",cmd)
os.execute(cmd)
print("-----------------------------------------------")
return true
end
Who is online
Users browsing this forum: slime and 7 guests