Embedded Resources

This commit is contained in:
Isuru Samarathunga
2025-11-01 11:13:04 +05:30
parent dd2d2e1ae8
commit ab484b4016
11 changed files with 248 additions and 18 deletions

View File

@ -34,26 +34,26 @@ FILE_TEMPLATE = """// IAEngine: 2D Game Engine by IA
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
namespace ia::iae
{
}
"""
def on_invalid_args():
print(f"\033[33mUsage: {sys.argv[0]} <ProjectName> <FileName>\033[39m")
exit(1)
def add_source_file(fileName: str, fileDirectory: str):
def add_source_file(fileName: str, fileDirectory: str, content: str):
print(f"\033[32mAdding Source File '{fileName}' to '{fileDirectory}'..\033[39m")
with open(f"{fileDirectory}/{fileName}", 'w') as f:
f.write(FILE_TEMPLATE)
f.write(f"{FILE_TEMPLATE}{content}")
def main(args: list[str]):
if len(args) < 3:
on_invalid_args()
fileName = f"{args[3]}.cpp"
fileDirectory = f"Src/{args[1]}/imp/cpp"
add_source_file(fileName, fileDirectory)
add_source_file(fileName, fileDirectory, """namespace ia::iae
{
}""")
main(sys.argv)
if __name__ == "__main__":
main(sys.argv)