From 64fa6396bccc5fedfe73e4b35d0b53093bb9a05f Mon Sep 17 00:00:00 2001 From: HiveBeats Date: Tue, 8 Aug 2023 23:35:05 +0400 Subject: [PATCH] [refactor]: names --- inc/Renderer.h | 16 ++++++++-------- src/Renderer.cpp | 38 +++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/inc/Renderer.h b/inc/Renderer.h index facbc70..8140114 100644 --- a/inc/Renderer.h +++ b/inc/Renderer.h @@ -6,21 +6,21 @@ class Renderer { private: - void DrawMainPanel(const Rectangle& panel_bounds); - void DrawAddOscillatorButton(Synth& synth, SynthGuiState& synthGui, + void draw_main_panel(const Rectangle& panel_bounds); + void draw_add_oscillator_button(Synth& synth, SynthGuiState& synth_gui, Rectangle panel_bounds); - void DrawOscillatorsPanels( + void draw_oscillators_panels( const std::vector& oscillators, - const std::vector& guiOscillators, + const std::vector& gui_oscillators, const Rectangle& panel_bounds); - void DrawOscillatorsShapeInputs( + void draw_oscillators_shape_inputs( const std::vector& oscillators, const std::vector& guiOscillators); - void DrawUi(Synth& synth, SynthGuiState& synthGui); - void DrawSignal(Synth& synth, SynthGuiState& synthGui); + void draw_ui(Synth& synth, SynthGuiState& synth_gui); + void draw_signal(Synth& synth, SynthGuiState& synth_gui); public: Renderer(/* args */); ~Renderer(); - void Draw(Synth& synth, SynthGuiState& synthGui); + void Draw(Synth& synth, SynthGuiState& synth_gui); }; diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 3d0eaa9..32a8748 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -11,20 +11,20 @@ Renderer::Renderer(/* args */) { Renderer::~Renderer() {} -void Renderer::Draw(Synth& synth, SynthGuiState& synthGui) { +void Renderer::Draw(Synth& synth, SynthGuiState& synth_gui) { BeginDrawing(); ClearBackground(RAYWHITE); // todo: implement renderer - DrawUi(synth, synthGui); - DrawSignal(synth, synthGui); + draw_ui(synth, synth_gui); + draw_signal(synth, synth_gui); // DrawText("Congrats! You created your first window!", 190, 200, 20, // LIGHTGRAY); DrawFPS(0,0); EndDrawing(); } -void Renderer::DrawSignal(Synth& synth, SynthGuiState& synthGui) { +void Renderer::draw_signal(Synth& synth, SynthGuiState& synth_gui) { GuiGrid((Rectangle){0, 0, WINDOW_WIDTH, WINDOW_HEIGHT}, "", WINDOW_HEIGHT / 8, 2); auto signal = synth.GetOutSignal(); @@ -39,14 +39,14 @@ void Renderer::DrawSignal(Synth& synth, SynthGuiState& synthGui) { delete[] signal_points; } -void Renderer::DrawOscillatorsShapeInputs( +void Renderer::draw_oscillators_shape_inputs( const std::vector& oscillators, - const std::vector& guiOscillators) { + const std::vector& gui_oscillators) { #define WAVE_SHAPE_OPTIONS "Sine;Triangle;Sawtooth;Square" // DRAW OSCILLATOR SHAPE INPUTS for (int i = 0; i < oscillators.size(); i += 1) { - OscillatorGuiState* ui_osc = guiOscillators[i]; + OscillatorGuiState* ui_osc = gui_oscillators[i]; assert(ui_osc); Oscillator* osc = oscillators[i]; @@ -70,13 +70,13 @@ void Renderer::DrawOscillatorsShapeInputs( } } -void Renderer::DrawOscillatorsPanels( +void Renderer::draw_oscillators_panels( const std::vector& oscillators, - const std::vector& guiOscillators, + const std::vector& gui_oscillators, const Rectangle& panel_bounds) { float panel_y_offset = 0; for (int i = 0; i < oscillators.size(); i++) { - OscillatorGuiState* ui_osc = guiOscillators[i]; + OscillatorGuiState* ui_osc = gui_oscillators[i]; assert(ui_osc); Oscillator* osc = oscillators[i]; @@ -136,13 +136,13 @@ void Renderer::DrawOscillatorsPanels( } } -void Renderer::DrawMainPanel(const Rectangle& panel_bounds) { +void Renderer::draw_main_panel(const Rectangle& panel_bounds) { bool is_shape_dropdown_open = false; int shape_index = 0; GuiPanel(panel_bounds, ""); } -void Renderer::DrawAddOscillatorButton(Synth& synth, SynthGuiState& synthGui, +void Renderer::draw_add_oscillator_button(Synth& synth, SynthGuiState& synth_gui, Rectangle panel_bounds) { //clang-format off bool click_add_oscillator = @@ -159,21 +159,21 @@ void Renderer::DrawAddOscillatorButton(Synth& synth, SynthGuiState& synthGui, new OscillatorGuiState{.freq = osc->GetFreq(), .waveshape = osc->GetType(), .volume = osc->GetVolume()}; - synthGui.oscillators.push_back(ui); + synth_gui.oscillators.push_back(ui); } } -void Renderer::DrawUi(Synth& synth, SynthGuiState& synthGui) { +void Renderer::draw_ui(Synth& synth, SynthGuiState& synth_gui) { Rectangle panel_bounds = {.x = 0, .y = 0, .width = OSCILLATOR_PANEL_WIDTH, .height = WINDOW_HEIGHT}; - DrawMainPanel(panel_bounds); - DrawAddOscillatorButton(synth, synthGui, panel_bounds); + draw_main_panel(panel_bounds); + draw_add_oscillator_button(synth, synth_gui, panel_bounds); // Draw Oscillators std::vector oscillators = synth.GetOscillators(); - std::vector guiOscillators = synthGui.oscillators; + std::vector gui_oscillators = synth_gui.oscillators; - DrawOscillatorsPanels(oscillators, guiOscillators, panel_bounds); - DrawOscillatorsShapeInputs(oscillators, guiOscillators); + draw_oscillators_panels(oscillators, gui_oscillators, panel_bounds); + draw_oscillators_shape_inputs(oscillators, gui_oscillators); } \ No newline at end of file