-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Update Proyect Pipeline Added and resources create projects with …
…python
- Loading branch information
1 parent
73a94ec
commit 3628b70
Showing
44 changed files
with
5,555 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import os | ||
import shutil | ||
|
||
def crear_proyecto_desde_base(nuevo_nombre_proyecto): | ||
# Ruta donde está ubicado el script | ||
ruta_base = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Ruta de la carpeta base (BaseProject) | ||
ruta_origen = os.path.join(ruta_base, "EmptyProject") | ||
|
||
# Ruta de la nueva carpeta (destino) | ||
ruta_destino = os.path.join(ruta_base, nuevo_nombre_proyecto) | ||
|
||
try: | ||
# Verificar si la carpeta base existe | ||
if not os.path.exists(ruta_origen): | ||
raise FileNotFoundError(f"La carpeta base 'EmptyProject' no existe en '{ruta_base}'.") | ||
|
||
# Copiar la carpeta base al destino con el nuevo nombre | ||
if os.path.exists(ruta_destino): | ||
print(f"La carpeta '{ruta_destino}' ya existe. Se sobreescribirá.") | ||
shutil.rmtree(ruta_destino) | ||
shutil.copytree(ruta_origen, ruta_destino) | ||
print(f"Carpeta base copiada a '{ruta_destino}'.") | ||
|
||
# Ruta al archivo CMakeLists.txt en la nueva carpeta | ||
ruta_cmake = os.path.join(ruta_destino, "CMakeLists.txt") | ||
|
||
# Verificar si existe el archivo CMakeLists.txt en la carpeta base | ||
if not os.path.exists(ruta_cmake): | ||
raise FileNotFoundError(f"No se encontró el archivo CMakeLists.txt en '{ruta_destino}'.") | ||
|
||
# Leer y modificar el archivo CMakeLists.txt | ||
with open(ruta_cmake, "r") as archivo: | ||
contenido = archivo.read() | ||
|
||
# Reemplazar el nombre del proyecto en el archivo | ||
contenido_modificado = f"""cmake_minimum_required(VERSION 3.8) | ||
# Nombre del proyecto | ||
project({nuevo_nombre_proyecto}) | ||
""" + "\n".join(contenido.split("\n")[3:]) | ||
|
||
# Guardar los cambios en el archivo | ||
with open(ruta_cmake, "w") as archivo: | ||
archivo.write(contenido_modificado) | ||
print(f"Archivo CMakeLists.txt actualizado con el nombre del proyecto '{nuevo_nombre_proyecto}'.") | ||
|
||
except Exception as e: | ||
print(f"Error: {e}") | ||
|
||
# Solicitar el nombre del proyecto al usuario | ||
nombre_proyecto = input("Introduce el nombre del nuevo proyecto: ") | ||
crear_proyecto_desde_base(nombre_proyecto) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
# C++ 17 standar | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") | ||
|
||
|
||
file(GLOB_RECURSE SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp") | ||
|
||
|
||
file(GLOB_RECURSE HEADERS "${PROJECT_SOURCE_DIR}/src/*.h") | ||
file(GLOB_RECURSE HEADERS "${PROJECT_SOURCE_DIR}/src/*.hpp") | ||
|
||
# Incluye directories | ||
include_directories( | ||
"${PROJECT_SOURCE_DIR}/../Ifnity/vendor/spdlog/include" | ||
"${PROJECT_SOURCE_DIR}/../Ifnity/src" | ||
) | ||
|
||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) | ||
|
||
#Add Ifnity dependencies | ||
add_dependencies(${PROJECT_NAME} Ifnity) | ||
|
||
if(BUILD_SHARED_IFNITY) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE IFNITY_USE_SHARED) | ||
message("IFNITY_USE_SHARED CREATE = ON ") | ||
endif() | ||
|
||
# Link Ifnity library dll | ||
target_link_libraries(${PROJECT_NAME} PUBLIC Ifnity) | ||
|
||
|
||
|
||
|
||
# Copy Ifnity.dll inside Sandbox Proyect. | ||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy | ||
$<TARGET_FILE:Ifnity> | ||
$<TARGET_FILE_DIR:${PROJECT_NAME}> | ||
) | ||
|
||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${CMAKE_SOURCE_DIR}/../Shaders | ||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/Shaders | ||
) | ||
|
||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${CMAKE_SOURCE_DIR}/../data | ||
$<TARGET_FILE_DIR:${PROJECT_NAME}>/data | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,239 @@ | ||
|
||
|
||
// IFNITY.cp | ||
|
||
#include <Ifnity.h> | ||
|
||
|
||
|
||
using namespace IFNITY::rhi; | ||
|
||
class ExampleLayer: public IFNITY::GLFWEventListener, public IFNITY::Layer | ||
{ | ||
public: | ||
ExampleLayer(): Layer("Example") {} | ||
~ExampleLayer() {} | ||
|
||
void OnUpdate() override | ||
{ | ||
IFNITY_LOG(LogApp, INFO, "Update App"); | ||
} | ||
|
||
|
||
void onEventReceived(const IFNITY::WindowResize& event) override | ||
{ | ||
IFNITY_LOG(LogApp, WARNING, event.ToString() + "Example Layer"); | ||
} | ||
void ConnectToEventBusImpl(void* bus) override | ||
{ | ||
auto eventBus = static_cast<IFNITY::GLFWEventSource*>(bus); | ||
if(eventBus) | ||
{ | ||
CONNECT_EVENT_LAYER(WindowResize, eventBus); | ||
CONNECT_EVENT_LAYER(WindowClose, eventBus); | ||
CONNECT_EVENT_LAYER(KeyPressed, eventBus); | ||
CONNECT_EVENT_LAYER(KeyRelease, eventBus); | ||
CONNECT_EVENT_LAYER(MouseMove, eventBus); | ||
CONNECT_EVENT_LAYER(ScrollMouseMove, eventBus); | ||
CONNECT_EVENT_LAYER(MouseClick, eventBus); | ||
} | ||
else | ||
{ | ||
//Manage conversion pointer error. | ||
IFNITY_LOG(LogApp, ERROR, "The pointer is not type IFNITY::GLFWEventSource*"); | ||
} | ||
} | ||
|
||
|
||
}; | ||
|
||
class NVMLLayer: public IFNITY::Layer | ||
{ | ||
public: | ||
NVMLLayer(): Layer("NVML") {} | ||
~NVMLLayer() {} | ||
|
||
void OnUpdate() override | ||
{ | ||
|
||
monitor.refresh(); | ||
monitor.display(); | ||
} | ||
|
||
void ConnectToEventBusImpl(void* bus) override | ||
{} | ||
void OnAttach() override | ||
{ | ||
loggerDisplayMonitor = LoggerDisplayMonitor(); | ||
monitor.setDisplay(&loggerDisplayMonitor); | ||
|
||
IFNITY_LOG(LogApp, INFO, "NVML Layer is attached"); | ||
} | ||
|
||
private: | ||
NvmlMonitor monitor; | ||
LoggerDisplayMonitor loggerDisplayMonitor; | ||
}; | ||
|
||
|
||
|
||
class ImGuiTestLayer : public IFNITY::Layer | ||
{ | ||
public: | ||
ImGuiTestLayer() : Layer("ImGuiTest") {} | ||
~ImGuiTestLayer() {} | ||
|
||
void OnAttach() override | ||
{ | ||
IFNITY_LOG(LogApp, INFO, "ImGuiTest Layer is attached"); | ||
} | ||
|
||
void OnUpdate() override | ||
{ | ||
ImGuiContext* context = GetImGuiContext(); | ||
if (context == nullptr) | ||
{ | ||
IFNITY_LOG(LogApp, ERROR, "Failed to get ImGui context from DLL"); | ||
return; | ||
} | ||
ImGui::SetCurrentContext(context); | ||
|
||
ChooseApi(); | ||
//IFNITY_LOG(LogApp, INFO, "Update ImGuiTest Layer OnUpdate"); | ||
} | ||
// Heredado vía Layer | ||
void ConnectToEventBusImpl(void* bus) override | ||
{ | ||
|
||
|
||
} | ||
private: | ||
// Una función que se llama al hacer clic en el botón | ||
void AccionPorOpcion(int opcionSeleccionada) { | ||
|
||
GraphicsAPI api = IFNITY::App::GetApp().GetGraphicsAPI(); | ||
switch (opcionSeleccionada) { | ||
case 0: | ||
// Acción para la opción 1 | ||
IFNITY_LOG(LogApp, INFO, "OPENGL"); | ||
|
||
|
||
IFNITY::App::GetApp() | ||
.SetGraphicsAPI(GraphicsAPI::OPENGL,api != GraphicsAPI::OPENGL); | ||
break; | ||
case 1: | ||
// Acción para la opción 2 | ||
IFNITY_LOG(LogApp, INFO, "D3D11"); | ||
IFNITY::App::GetApp() | ||
.SetGraphicsAPI(GraphicsAPI::D3D11, api != GraphicsAPI::D3D11); | ||
break; | ||
|
||
case 2: | ||
// Acción para la opción 3 | ||
IFNITY_LOG(LogApp, INFO, "D3D12"); | ||
IFNITY::App::GetApp() | ||
.SetGraphicsAPI(GraphicsAPI::D3D12, api != GraphicsAPI::D3D12); | ||
break; | ||
|
||
case 3: | ||
// Acción para la opción 3 | ||
IFNITY_LOG(LogApp, INFO, "VULKAN"); | ||
IFNITY::App::GetApp() | ||
.SetGraphicsAPI(GraphicsAPI::VULKAN, api != GraphicsAPI::VULKAN); | ||
break; | ||
default: | ||
|
||
break; | ||
} | ||
} | ||
|
||
void ChooseApi() { | ||
static int selectOption = 0; | ||
const char* options[] = { "OPENGL", "D3D11","D3D12","VULKAN"}; | ||
|
||
ImGui::Begin("API WINDOW"); // Comienza la creación de la ventana | ||
|
||
// Combo box con las opciones | ||
if (ImGui::Combo("Choose Option ", &selectOption, options, IM_ARRAYSIZE(options))) { | ||
// Este bloque se ejecuta cada vez que se selecciona una opción diferente | ||
} | ||
|
||
// Botón que ejecuta la función cuando se hace clic | ||
if (ImGui::Button("OK")) { | ||
AccionPorOpcion(selectOption); | ||
} | ||
|
||
ImGui::End(); // Termina la creación de la ventana | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}; | ||
|
||
class Source: public IFNITY::App | ||
{ | ||
public: | ||
Source(IFNITY::rhi::GraphicsAPI api) : IFNITY::App(api) | ||
{ | ||
// Obtener el contexto de ImGui desde IFNITY DLL | ||
/*ImGuiContext* context = GetImGuiContext(); | ||
if (context == nullptr) | ||
{ | ||
IFNITY_LOG(LogApp, ERROR, "Failed to get ImGui context from DLL"); | ||
return; | ||
}*/ | ||
|
||
// Establecer el contexto de ImGui en la aplicación principal | ||
//ImGui::SetCurrentContext(context); | ||
PushLayer(new IFNITY::NVML_Monitor()); | ||
PushLayer(new ImGuiTestLayer()); | ||
PushOverlay(new IFNITY::ImguiLayer()); //Capa de dll | ||
|
||
|
||
|
||
} | ||
|
||
void Initialize() override | ||
{ | ||
|
||
} | ||
|
||
void Render() override | ||
{ | ||
IFNITY_LOG(LogApp, INFO, "Render App"); | ||
} | ||
void Animate() override | ||
{ | ||
IFNITY_LOG(LogApp, INFO, "Animate App"); | ||
} | ||
~Source() override {} | ||
}; | ||
|
||
class Source_TestD3D12 : public IFNITY::App | ||
{ | ||
public: | ||
Source_TestD3D12(IFNITY::rhi::GraphicsAPI api) : IFNITY::App(api) | ||
{ | ||
PushLayer(new ExampleLayer()); | ||
} | ||
~Source_TestD3D12() override | ||
{ | ||
} | ||
}; | ||
|
||
|
||
IFNITY::App* IFNITY::CreateApp() | ||
{ | ||
|
||
|
||
auto api = IFNITY::rhi::GraphicsAPI::VULKAN; | ||
|
||
|
||
//return new Source_TestD3D12(api); | ||
return new Source(api); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.