Files
viseq/src/main.cpp
T

103 lines
2.1 KiB
C++
Raw Normal View History

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
#include <raylib.h>
#include <raymath.h>
#include "state.h"
2024-11-14 00:55:09 +01:00
#include "app-manager.h"
#include "datatypes.h"
2024-10-09 02:01:23 +02:00
#include <cstdlib>
#include <stdio.h>
#include <cmath>
#include <memory>
2024-10-09 02:01:23 +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-26 16:31:23 +02:00
//ToggleFullscreen();
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-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-11-14 00:55:09 +01:00
SetTargetFPS(state->settings.fps);
app.init();
app.ui.init();
app.loadState();
2024-11-06 15:35:25 +01:00
app.startSignals();
2024-11-08 01:43:06 +01:00
while(!WindowShouldClose()){
app.update();
app.draw();
2024-10-24 21:05:05 +02: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) {*/
/* canvas->camera.target = Vector2Add(canvas->camera.target, delta);*/
/* 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-09 02:01:23 +02:00
}
app.close();
2024-10-09 02:01:23 +02:00
CloseWindow();
return 0;
2024-10-09 02:01:23 +02:00
}