mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +00:00
GUI: instrument selector
This commit is contained in:
parent
c6ca40494a
commit
2f813c55e0
7 changed files with 34 additions and 8 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -12,3 +12,6 @@
|
||||||
[submodule "extern/imgui"]
|
[submodule "extern/imgui"]
|
||||||
path = extern/imgui
|
path = extern/imgui
|
||||||
url = https://github.com/ocornut/imgui.git
|
url = https://github.com/ocornut/imgui.git
|
||||||
|
[submodule "extern/fmt"]
|
||||||
|
path = extern/fmt
|
||||||
|
url = https://github.com/fmtlib/fmt.git
|
||||||
|
|
|
@ -9,6 +9,8 @@ else()
|
||||||
set(BUILD_GUI ON)
|
set(BUILD_GUI ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(extern/fmt)
|
||||||
|
|
||||||
set(BUILD_TESTING OFF)
|
set(BUILD_TESTING OFF)
|
||||||
set(BUILD_PROGRAMS OFF)
|
set(BUILD_PROGRAMS OFF)
|
||||||
set(BUILD_EXAMPLES OFF)
|
set(BUILD_EXAMPLES OFF)
|
||||||
|
@ -20,13 +22,17 @@ if (WIN32)
|
||||||
add_subdirectory(extern/zlib)
|
add_subdirectory(extern/zlib)
|
||||||
set(HAVE_SDL2 SDL2-static)
|
set(HAVE_SDL2 SDL2-static)
|
||||||
set(HAVE_Z zlibstatic)
|
set(HAVE_Z zlibstatic)
|
||||||
include_directories(extern/imgui extern/imgui/backends extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib)
|
include_directories(extern/imgui extern/imgui/backends extern/zlib ${CMAKE_CURRENT_BINARY_DIR}/extern/zlib extern/fmt/include)
|
||||||
else()
|
else()
|
||||||
if (BUILD_GUI)
|
if (BUILD_GUI)
|
||||||
set(SDL_SHARED ON)
|
set(SDL_SHARED ON)
|
||||||
add_subdirectory(extern/SDL)
|
add_subdirectory(extern/SDL)
|
||||||
include_directories(extern/SDL/include extern/imgui extern/imgui/backends)
|
include_directories(extern/SDL/include extern/imgui extern/imgui/backends extern/fmt/include)
|
||||||
set(HAVE_SDL2 SDL2)
|
if (APPLE)
|
||||||
|
set(HAVE_SDL2 SDL2-static)
|
||||||
|
else()
|
||||||
|
set(HAVE_SDL2 SDL2)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
find_library(HAVE_SDL2 SDL2)
|
find_library(HAVE_SDL2 SDL2)
|
||||||
endif()
|
endif()
|
||||||
|
@ -119,7 +125,7 @@ else()
|
||||||
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
|
add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(furnace ${HAVE_SDL2} ${HAVE_Z} sndfile)
|
target_link_libraries(furnace ${HAVE_SDL2} ${HAVE_Z} sndfile fmt)
|
||||||
|
|
||||||
if (HAVE_JACK)
|
if (HAVE_JACK)
|
||||||
target_link_libraries(furnace ${HAVE_JACK})
|
target_link_libraries(furnace ${HAVE_JACK})
|
||||||
|
|
1
extern/fmt
vendored
Submodule
1
extern/fmt
vendored
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3a951a66cb0fb53ff5a9d5ce9c77e05ef9d382ce
|
|
@ -1,5 +1,5 @@
|
||||||
#include "taAudio.h"
|
#include "taAudio.h"
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(HAVE_GUI)
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#else
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
|
@ -99,6 +99,7 @@ void DivPlatformGenesis::tick() {
|
||||||
int freqt=toFreq(chan[i].freq);
|
int freqt=toFreq(chan[i].freq);
|
||||||
writes.emplace(chanOffs[i]+0xa4,freqt>>8);
|
writes.emplace(chanOffs[i]+0xa4,freqt>>8);
|
||||||
writes.emplace(chanOffs[i]+0xa0,freqt&0xff);
|
writes.emplace(chanOffs[i]+0xa0,freqt&0xff);
|
||||||
|
chan[i].freqChanged=false;
|
||||||
}
|
}
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
writes.emplace(0x28,0xf0|konOffs[i]);
|
writes.emplace(0x28,0xf0|konOffs[i]);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "../ta-log.h"
|
#include "../ta-log.h"
|
||||||
#include "imgui.h"
|
#include "imgui.h"
|
||||||
|
#include <fmt/printf.h>
|
||||||
|
|
||||||
void FurnaceGUI::bindEngine(DivEngine* eng) {
|
void FurnaceGUI::bindEngine(DivEngine* eng) {
|
||||||
e=eng;
|
e=eng;
|
||||||
|
@ -41,6 +42,16 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
if (ImGui::Begin("Instruments")) {
|
||||||
|
for (int i=0; i<e->song.ins.size(); i++) {
|
||||||
|
DivInstrument* ins=e->song.ins[i];
|
||||||
|
if (ImGui::Selectable(fmt::sprintf("%d: %s##_INS%d\n",i,ins->name,i).c_str(),curIns==i)) {
|
||||||
|
curIns=i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::End();
|
||||||
|
|
||||||
SDL_RenderClear(sdlRend);
|
SDL_RenderClear(sdlRend);
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
|
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
|
||||||
|
@ -88,5 +99,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
quit(false),
|
quit(false),
|
||||||
scrW(1280),
|
scrW(1280),
|
||||||
scrH(800),
|
scrH(800),
|
||||||
dpiScale(2) {
|
dpiScale(1),
|
||||||
}
|
curIns(0),
|
||||||
|
curOctave(3) {
|
||||||
|
}
|
||||||
|
|
|
@ -19,9 +19,11 @@ class FurnaceGUI {
|
||||||
ImFont* mainFont;
|
ImFont* mainFont;
|
||||||
ImFont* patFont;
|
ImFont* patFont;
|
||||||
|
|
||||||
|
int curIns, curOctave;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void bindEngine(DivEngine* eng);
|
void bindEngine(DivEngine* eng);
|
||||||
bool loop();
|
bool loop();
|
||||||
bool init();
|
bool init();
|
||||||
FurnaceGUI();
|
FurnaceGUI();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue