Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat
How to manage several projects using one code template? - Gideros Forum

How to manage several projects using one code template?

Apollo14Apollo14 Member
edited October 9 in Code snippets
Hi guys!
I have an app that needs to be duplicated. Codebase is the same, but I'll need to change some graphics and sounds.
What is a good way to maintain these several projects and reduce manual routine when I'll need to change something in code later on?

My current project structure is:
GiderosProject
	Files
		/classes
		/gui
		/images -- contains 1.jpg, 2.jpg, 3.jpg, etc.
		/sounds -- contains 1.wav, 2.wav, 3.wav, etc.
		appConfig.lua
		init.lua
		main.lua
The only thing that is unique in every project is file "appConfig.lua" and files inside folders "images"&"sounds".
Guys I need your wisdom!
Many thanks! o:)

Likes: MoKaLux

> Newcomers roadmap: from where to start learning Gideros
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
+1 -1 (+1 / -0 ) Share on Facebook

Comments

  • hgy29hgy29 Maintainer
    Accepted Answer
    Put all your common files in some common folder on your hard drive, and like that folder into each Gideros project that needs it

    Likes: MoKaLux, plicatibu

    +1 -1 (+2 / -0 ) Share on Facebook
  • Apollo14Apollo14 Member
    edited October 9
    thx a lot @hgy29 ! I guess simple linking will work well!
    how come I didn't try it at the first place!

    Likes: MoKaLux

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+1 / -0 ) Share on Facebook
  • hgy29hgy29 Maintainer
    It is even easier with recent version of gideros, where you can manage code dependencies from code files themselves. It makes turning a folder into a reusable library a lot easier.

    Likes: Apollo14

    +1 -1 (+1 / -0 ) Share on Facebook
  • hgy29 said:

    It is even easier with recent version of gideros, where you can manage code dependencies from code files themselves. It makes turning a folder into a reusable library a lot easier.

    Sounds cool! How to do it?
    My 'init.lua' file depends on 'datasaver.lua', I usually right click on 'init.lua' and choose "Code dependencies...".
    How can I avoid manual setup of dependecies?
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • Apollo14Apollo14 Member
    edited October 20
    hgy29 said:

    It is even easier with recent version of gideros, where you can manage code dependencies from code files themselves. It makes turning a folder into a reusable library a lot easier.

    @hgy29 Hi again!
    I've just tried to start new project based on previous template. It seems that code dependencies are totally broken or random (actually I had only one dependency: init.lua depended on dataSaver.lua)

    I use very simple OOP code&file structure:

    /root/
    init.lua
    main.lua
    appConfig.lua
    /classes/* --generic classes like button.lua, gtween.lua, etc
    /gui/* --my classes

    Inside main.lua I create several objects:
    myobj1=myclass1.new()
    stage:addChild(myobj1)
     
    myobj2=myclass2.new()
    stage:addChild(myobj2)
    --etc.

    It all worked as expected in the normal first project.
    But when I've created second project, I've linked my files&folders from the first project (linked init.lua, main.lua too), and now all my classes are totally broken like there're no dependencies, lots of errors. If I duct-tape one class, then another class breaks, then another, etc...

    Can such unexpected behavior be caused because I've linked main.lua and init.lua?
    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
  • hgy29hgy29 Maintainer
    No, I don't think so. Did you use the "--!NEEDS:someOtherLuaFile.lua" style tags to set dependencies ? Also I am not sure how making init.lua depending on something else works, since by definition init.lua should be loaded first by gideros.
Sign In or Register to comment.