Initial commit - Migration from cmake to gradle

This commit is contained in:
bigboss committed 2026-11-29 00:38:13 +01:00
commit 279f292225
217 files changed
+14945

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
plugins { id 'cpp-application' }
apply from: rootProject.file('gradle/common.gradle')
application {
targetMachines.add(machines.windows.x86_64)
targetMachines.add(machines.linux.x86_64)
source.from('src/main')
privateHeaders.setFrom('src/main')
dependencies { implementation project(':CosmicEngine') }
}
// Nom du projet du module de scripts (adapter si renommé dans settings.gradle)
def scriptsProject = ':ScriptsModule'
evaluationDependsOn(scriptsProject) // pour retrouver ses tâches de link
def fsOps = project.services.get(FileSystemOperations)
def runtimeDir = rootProject.ext.runtimeDir
def assetDir = rootProject.ext.assetDir // CosmicEngine/src/main/resources
def appAssetDir = file('src/main/resources') // assets propres à cette application
// Le module de scripts est chargé dynamiquement par le moteur (dlopen/LoadLibrary) : il est copié, pas lié.
tasks.withType(InstallExecutable).configureEach { installTask ->
// installDebugLinux -> linkDebugLinux (le suffixe dépend des targetMachines)
// On prend le fichier produit par la tâche de link : plus de chemin à deviner.
def scriptsLib = project(scriptsProject).tasks
.named(name.replaceFirst('^install', 'link'), LinkSharedLibrary)
.flatMap { it.linkedFile }
// 'libs' = fichiers installés dans lib/ par la tâche (suivis par Gradle : dépendance + up-to-date).
libs.from(scriptsLib)
doLast {
def destDir = installTask.installDirectory.get().dir('lib').asFile
destDir.mkdirs()
// DLL/SO vcpkg (non récursif, ignore les liens cassés)
if (runtimeDir.exists()) {
runtimeDir.listFiles().each { f ->
if (f.isFile() && (f.name.endsWith('.dll') || f.name.endsWith('.dylib') ||
f.name.endsWith('.so') || f.name.contains('.so.'))) {
java.nio.file.Files.copy(f.toPath(), new File(destDir, f.name).toPath(),
java.nio.file.StandardCopyOption.REPLACE_EXISTING)
}
}
}
// Assets du moteur (obligatoires), puis ceux de l'application (ajoutent / surchargent)
[assetDir, appAssetDir].each { dir ->
if (dir.exists()) {
fsOps.copy {
from dir
into destDir
}
}
}
}
}
+33
View File
@@ -0,0 +1,33 @@
//#include "Engine/Headers/Core.hpp"
//#include "Engine/Headers/Components.hpp"
//#include <cstdlib>
/*#include <sndfile.h>
#include <al.h>
#include <alc.h>
#include <cassert>
#include <cstdlib>
#include <stdio.h>
#include <iostream>
#include <omp.h>
#include <boost/cstdint.hpp>
#include <boost/chrono.hpp>
#include <boost/thread.hpp>
#include <boost/array.hpp>
#include <boost/shared_ptr.hpp>*/
#include "Engine/Core/Kernel/CKernel.hpp"
int main(int argc, char** argv) {
// test();
using namespace CosmicCore;
CKernel g("Mon jeu", "Jeu");
g.start();
g.loop();
return 0;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

@@ -0,0 +1,139 @@
{
"name" : "Scene test",
"description": "Scene de test",
"entities": [
],
"entities2D": [
{
"entityref": 1,
"parent": null,
"children": [],
"name": "Camera2D",
"description": "Une camera en 2D",
"components": {
"transform": {
"position": [0,0],
"size": [1,1],
"scale": [1,1],
"pivot" : [0,0],
"rotation": 0.0,
"anchor": [0,0],
"zorder": 0,
"visible": true
},
"camera":
{
"zoom": 1.0
}
}
},
{
"entityref": 2,
"parent": 5,
"children": [],
"name": "QuitButton_text",
"description": "",
"components": {
"transform": {
"position": [0, 0],
"size": [50,50],
"scale": [1,1],
"pivot" : [0,0],
"rotation": 0.0,
"anchor": [0,0],
"zorder": 1,
"visible": true
},
"text":
{
"text": "Quit game",
"shader": "ui_text",
"color": [1,1,1,1],
"font": "assets/fonts/Arial"
}
}
},
{
"entityref": 5,
"parent": null,
"children": [2],
"name": "QuitButton_col",
"description": "",
"components": {
"transform": {
"position": [320, 386],
"size": [60,35],
"scale": [5,2],
"pivot" : [0,0],
"anchor": [0,0],
"rotation": 0.0,
"zorder": 0,
"visible": true
},
"collider" : {
"type": 0
},
"renderer":
{
"model": "assets/models/2D/rectangle.json",
"shader": "ui"
},
"script": ["QuitHandler"]
}
},
{
"entityref": 3,
"parent": 4,
"children": [],
"name": "PlayButton_text",
"description": "",
"components": {
"transform": {
"position": [0, 0],
"size": [50,50],
"scale": [1,1],
"pivot" : [0,0],
"rotation": 0.0,
"anchor": [0,0],
"zorder": 1,
"visible": true
},
"text":
{
"text": "Play",
"shader": "ui_text",
"color": [1,1,1,1],
"font": "assets/fonts/Arial"
}
}
},
{
"entityref": 4,
"parent": null,
"children": [3],
"name": "PlayButton_col",
"description": "",
"components": {
"transform": {
"position": [250, 186],
"size": [70,30],
"scale": [2,2],
"pivot" : [0,0],
"rotation": 0.0,
"anchor": [0,0],
"zorder": 0,
"visible": true
},
"collider" : {
"type": 0
},
"renderer":
{
"model": "assets/models/2D/rectangle.json",
"shader": "ui"
},
"script": ["LaunchSceneTest"]
}
}
]
}
@@ -0,0 +1,123 @@
{
"name" : "Scene test",
"description": "Scene de test",
"entities": [
{
"entityref": 0,
"name": "Cube",
"description": "Un cube",
"parent" : null,
"children": [],
"components": {
"transform": {
"position": [0,0,0],
"rotation": [0,0,0],
"scale": [1,1,1]
},
"renderer":
{
"model": "assets/models/3D/cube.glb",
"shader": "triangle",
"albedo": "assets/shrekt.png"
}
}
},
{
"entityref": 3,
"name": "Light",
"description": "A light",
"parent" : null,
"children": [],
"components": {
"transform": {
"position": [2,4,-1],
"rotation": [0,0,0],
"scale": [1,1,1]
},
"light":
{
"type": 1,
"color": [1,1,1],
"intensity": 10.0,
"range": 50,
"attenuation": 1,
"innerangle": 15,
"outerangle": 90,
"castshadow": false
}
}
},
{
"entityref": 1,
"name": "Camera",
"description": "Une camera",
"parent" : null,
"children": [],
"components": {
"transform": {
"position": [0,0,5],
"rotation": [0,0,0],
"scale": [1,1,1]
},
"camera":
{
"fov": 75,
"near": 0.1,
"far": 100
},
"script": ["CExampleScript"]
}
}
],
"entities2D": [
{
"entityref": 2,
"parent": null,
"children": [],
"name": "Camera2D",
"description": "Une camera en 2D",
"components": {
"transform": {
"position": [0,0],
"size": [1,1],
"scale": [1,1],
"pivot" : [0,0],
"anchor": [0,0],
"rotation": 0.0,
"zorder": 0,
"visible": true
},
"camera":
{
"zoom": 1.0
}
}
},
{
"entityref": 4,
"parent": null,
"children": [],
"name": "Texte",
"description": "Du texte",
"components": {
"transform": {
"position": [200, 360],
"size": [50,50],
"scale": [1,1],
"pivot" : [0,0],
"anchor": [0,0],
"rotation": 0.0,
"zorder": 0,
"visible": true
},
"text":
{
"text": "Test de la scene avec texte en 2D",
"shader": "ui_text",
"color": [1,1,1,1],
"font": "assets/fonts/Arial"
}
}
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB