2024-10-09 02:01:23 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
*
|
2024-11-04 19:28:12 +01:00
|
|
|
* VISEQ - The Visual Sequencer
|
2024-10-30 02:03:03 +01:00
|
|
|
* 2024 Sebastian Kujas
|
2024-10-09 02:01:23 +02:00
|
|
|
*
|
|
|
|
|
*/
|
2024-10-25 16:41:37 +02:00
|
|
|
#define RAYGUI_IMPLEMENTATION
|
2024-10-13 04:22:09 +02:00
|
|
|
#include <raylib.h>
|
|
|
|
|
#include <raymath.h>
|
|
|
|
|
|
2024-11-26 01:58:09 +01:00
|
|
|
#include "state.h"
|
2024-11-14 00:55:09 +01:00
|
|
|
#include "app-manager.h"
|
2024-11-02 15:52:16 +01:00
|
|
|
#include "datatypes.h"
|
|
|
|
|
|
2024-10-09 02:01:23 +02:00
|
|
|
#include <cstdlib>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <cmath>
|
2024-11-02 15:52:16 +01:00
|
|
|
#include <memory>
|
2024-10-09 02:01:23 +02:00
|
|
|
|
2024-10-22 01:55:31 +02:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
VISEQ::APP::AppManager app;
|
|
|
|
|
std::shared_ptr<VISEQ::APP::State> state = VISEQ::APP::State::get();
|
2024-10-09 02:01:23 +02:00
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
|
|
|
|
|
srand(time(NULL));
|
|
|
|
|
|
2024-11-01 14:08:27 +01:00
|
|
|
InitWindow(1920, 1080, "VISEQ - The Visual Sequencer");
|
2024-10-26 16:31:23 +02:00
|
|
|
|
|
|
|
|
int current_monitor = GetCurrentMonitor();
|
|
|
|
|
int monitor_width = GetMonitorWidth(current_monitor);
|
|
|
|
|
int monitor_height = GetMonitorHeight(current_monitor);
|
2024-10-25 16:41:37 +02:00
|
|
|
|
2024-10-26 16:31:23 +02:00
|
|
|
SetWindowMonitor(current_monitor);
|
|
|
|
|
SetWindowState(FLAG_WINDOW_RESIZABLE);
|
|
|
|
|
|
|
|
|
|
SetWindowSize(monitor_width - 300, monitor_height - 300);
|
2024-10-13 04:22:09 +02:00
|
|
|
|
2024-10-26 16:31:23 +02:00
|
|
|
//ToggleFullscreen();
|
2024-11-26 01:58:09 +01:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
state->settings.fps = 60.0f;
|
|
|
|
|
state->settings.bpm = 120.0f;
|
|
|
|
|
state->settings.grid = 60.0f; // 120px for a 16th note
|
2024-10-23 03:25:57 +02:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
state->settings.speed = (state->settings.grid * 16.0f) * (state->settings.bpm / 120.f);
|
2024-10-25 16:41:37 +02:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
state->settings.width = monitor_width - 300;
|
|
|
|
|
state->settings.height = monitor_height - 300;
|
2024-10-25 02:43:41 +02:00
|
|
|
|
2024-11-14 00:55:09 +01:00
|
|
|
SetTargetFPS(state->settings.fps);
|
2024-10-13 04:22:09 +02:00
|
|
|
|
2024-11-26 01:58:09 +01:00
|
|
|
app.init();
|
|
|
|
|
app.ui.init();
|
2024-10-23 00:23:24 +02:00
|
|
|
|
2024-11-26 01:58:09 +01:00
|
|
|
app.loadState();
|
2024-11-06 15:35:25 +01:00
|
|
|
|
2024-11-26 01:58:09 +01:00
|
|
|
app.startSignals();
|
2024-11-08 01:43:06 +01:00
|
|
|
|
2024-10-13 04:22:09 +02:00
|
|
|
while(!WindowShouldClose()){
|
2024-11-26 01:58:09 +01:00
|
|
|
app.update();
|
|
|
|
|
app.draw();
|
2024-10-24 21:05:05 +02:00
|
|
|
|
2024-11-10 01:56:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*switch(istate){*/
|
|
|
|
|
/* case InteractionState::SCALE_SELECTION:*/
|
|
|
|
|
/* case InteractionState::HOVER_CANVAS:*/
|
|
|
|
|
/* {*/
|
|
|
|
|
/* for(auto &n : app.gm.nodes){ */
|
|
|
|
|
/* n->hover_connect = false;*/
|
|
|
|
|
/* }*/
|
|
|
|
|
/* if(mouse_right_clicked){*/
|
|
|
|
|
/* drag_distance = 0;*/
|
|
|
|
|
/* }*/
|
|
|
|
|
/* if(mouse_right_down) {*/
|
2024-11-25 00:53:10 +01:00
|
|
|
/* canvas->camera.target = Vector2Add(canvas->camera.target, delta);*/
|
2024-11-10 01:56:33 +01:00
|
|
|
/* drag_distance += delta.length();*/
|
|
|
|
|
/* }*/
|
|
|
|
|
/* if(mouse_right_released && drag_distance < 5) {*/
|
|
|
|
|
/* node_menu_position = mouse_pos;*/
|
|
|
|
|
/* istate = InteractionState::ADD_NODES_MENU;*/
|
|
|
|
|
/* }*/
|
|
|
|
|
/* break;*/
|
|
|
|
|
/* }*/
|
|
|
|
|
/* case InteractionState::ADD_NODES_MENU:*/
|
|
|
|
|
/* {*/
|
|
|
|
|
/* DrawCircleV(node_menu_position, 30, VS_COLOR_LIGHTGREY);*/
|
|
|
|
|
/* DrawCircleLines(node_menu_position.x, node_menu_position.y, 32, VS_COLOR_DARKGREY);*/
|
|
|
|
|
/**/
|
|
|
|
|
/* }*/
|
|
|
|
|
/*};*/
|
2024-10-23 03:25:57 +02:00
|
|
|
|
2024-10-09 02:01:23 +02:00
|
|
|
}
|
2024-11-26 01:58:09 +01:00
|
|
|
app.close();
|
2024-10-09 02:01:23 +02:00
|
|
|
|
2024-11-02 23:12:38 +01:00
|
|
|
|
2024-10-13 04:22:09 +02:00
|
|
|
CloseWindow();
|
|
|
|
|
|
|
|
|
|
return 0;
|
2024-10-09 02:01:23 +02:00
|
|
|
}
|
|
|
|
|
|