Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cmake.environment": {
"VCPKG_ROOT": "/home/nobbele/.local/share/vcpkg"
},
"cmake.configureArgs": [
"-DCMAKE_TOOLCHAIN_FILE=/home/nobbele/.local/share/vcpkg/scripts/buildsystems/vcpkg.cmake",
"-DVCPKG_TARGET_TRIPLET=x64-mingw-static"
]
}
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
cmake_minimum_required(VERSION 3.30)

# Find VCPKG_ROOT from environment variables.
if (DEFINED ENV{VCPKG_ROOT})
set(VCPKG_ROOT ENV{VCPKG_ROOT})
elseif(DEFINED ENV{VCPKG_INSTALLATION_ROOT})
set(VCPKG_ROOT ENV{VCPKG_INSTALLATION_ROOT})
endif()

if (LINUX)
if (NOT DEFINED VCPKG_ROOT)
message(FATAL_ERROR "VCPKG_ROOT must be set to build on Linux, CMake will exit.")
endif()

set(CMAKE_SYSTEM_NAME Windows)

set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(VCPKG_TARGET_TRIPLET x64-mingw-static)

if (NOT DEFINED CMAKE_FIND_ROOT_PATH)
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
endif()

set(MINGW_BASED true)
endif()

if(DEFINED VCPKG_ROOT)
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
endif()

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

set(CMAKE_CXX_STANDARD 20)
Expand Down
104 changes: 41 additions & 63 deletions src/Core/ByteStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,29 @@ struct WriteStream
void writeNum(uint32_t num);
void writeStr(const std::string& str);

template <unsigned int S>
inline void writeSz(const void* val)
{
write(val, S);
}

template <>
inline void writeSz<1>(const void* val)
{
write8(val);
}

template <>
inline void writeSz<2>(const void* val)
{
write16(val);
}

template <>
inline void writeSz<4>(const void* val)
{
write32(val);
}

template <>
inline void writeSz<8>(const void* val)
{
write64(val);
}

template <typename T>
inline void write(const T& val)
{
writeSz<sizeof(T)>(&val);
switch (sizeof(T)) {
case 1:
write8(&val);
break;

case 2:
write16(&val);
break;

case 4:
write32(&val);
break;

case 8:
write64(&val);
break;

default:
write(&val, static_cast<int>(sizeof(T)));
}
}

// Returns true if all write operations have succeeded.
Expand Down Expand Up @@ -94,47 +83,36 @@ struct ReadStream
void readNum(uint32_t& num);
void readStr(std::string& str);

template <size_t S>
inline void readSz(void* out)
{
read(out, S);
}

template <>
inline void readSz<1>(void* out)
{
read8(out);
}

template <>
inline void readSz<2>(void* out)
{
read16(out);
}

template <>
inline void readSz<4>(void* out)
{
read32(out);
}

template <>
inline void readSz<8>(void* out)
{
read64(out);
}

template <typename T>
inline void read(T& out)
{
readSz<sizeof(T)>(&out);
switch (sizeof(T)) {
case 1:
read8(&out);
break;

case 2:
read16(&out);
break;

case 4:
read32(&out);
break;

case 8:
read64(&out);
break;

default:
read(&out, static_cast<int>(sizeof(T)));
}
}

template <typename T>
inline T read()
{
T out = T();
readSz<sizeof(T)>(&out);
read(out);
return out;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ struct GetPolyDist : public DistanceFunc

struct Canvas::Data
{
Canvas::Data();
Data();
void draw(float* buf, int w, int h, const areaf& area, DistanceFunc* func);

areai mask;
Expand Down
4 changes: 3 additions & 1 deletion src/Core/FontData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include <System/OpenGL.h>

#include <cmath>

namespace Vortex {

static const int PADDING = 1;
Expand Down Expand Up @@ -217,7 +219,7 @@ static Glyph* PutGlyphInCache(GlyphCache* cache, FT_GlyphSlot slot)
// Copy the glyph pixels to the cache texture.
uint8_t* pixels = CopyGlyphBitmap(bitmapW, bitmapH, bitmap);
cache->tex->modify(glyph->box.x, glyph->box.y, bitmapW, bitmapH, pixels);
cache->shelfH = max(cache->shelfH, bitmapH);
cache->shelfH = std::max(cache->shelfH, bitmapH);
free(pixels);

// Set the glyph uvs.
Expand Down
12 changes: 7 additions & 5 deletions src/Core/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include <System/Debug.h>
#include <System/OpenGL.h>

#include <cmath>

namespace Vortex {

static const int BATCH_QUAD_LIMIT = 256;
Expand Down Expand Up @@ -206,7 +208,7 @@ void Renderer::pushScissorRect(const recti& r)
void Renderer::pushScissorRect(int x, int y, int w, int h)
{
auto& stack = RI->scissorStack;
w = max(w, 0), h = max(h, 0);
w = std::max(w, 0), h = std::max(h, 0);
if(stack.empty())
{
// The new scissor region is the first scissor region, use it as-is.
Expand All @@ -217,10 +219,10 @@ void Renderer::pushScissorRect(int x, int y, int w, int h)
{
// Calculate the intersection of the current and new scissor region.
recti last = stack.back();
int r = min(last.x + last.w, x + w);
int b = min(last.y + last.h, y + h);
x = max(last.x, x), w = max(0, r - x);
y = max(last.y, y), h = max(0, b - y);
int r = std::min(last.x + last.w, x + w);
int b = std::min(last.y + last.h, y + h);
x = std::max(last.x, x), w = std::max(0, r - x);
y = std::max(last.y, y), h = std::max(0, b - y);
stack.push_back({x, y, w, h});
}

Expand Down
2 changes: 1 addition & 1 deletion src/Core/TextureImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "gl/gl.h"
#include "GL/gl.h"

namespace Vortex {
namespace {
Expand Down
1 change: 1 addition & 0 deletions src/Editor/Butterworth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include <vector>

#undef M_PI
#define M_PI 3.14159265358

static double* binomial_mult(int n, double *p);
Expand Down
3 changes: 2 additions & 1 deletion src/Editor/Editing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <algorithm>
#include <set>
#include <cmath>

#include <Core/Utils.h>
#include <Core/StringUtils.h>
Expand Down Expand Up @@ -370,7 +371,7 @@ void finishNotePlacement(int col)

if (note.quant > 0 && note.quant <= 192)
{
note.quant = min(192u, note.quant * gView->getSnapQuant() / gcd(note.quant, gView->getSnapQuant()));
note.quant = min(192, note.quant * gView->getSnapQuant() / gcd(note.quant, gView->getSnapQuant()));
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/Editor/Notefield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,25 +795,25 @@ void drawSongPreviewArea()
// ================================================================================================
// NotefieldImpl :: toggle/check functions.

void NotefieldImpl::toggleShowWaveform()
void toggleShowWaveform()
{
myShowWaveform = !myShowWaveform;
gMenubar->update(Menubar::SHOW_WAVEFORM);
}

void NotefieldImpl::toggleShowBeatLines()
void toggleShowBeatLines()
{
myShowBeatLines = !myShowBeatLines;
gMenubar->update(Menubar::SHOW_BEATLINES);
}

void NotefieldImpl::toggleShowNotes()
void toggleShowNotes()
{
myShowNotes = !myShowNotes;
gMenubar->update(Menubar::SHOW_NOTES);
}

void NotefieldImpl::toggleShowSongPreview()
void toggleShowSongPreview()
{
myShowSongPreview = !myShowSongPreview;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Editor/NotefieldPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void drawNotes()
// ================================================================================================
// NotefieldPreviewImpl :: toggle/check functions.

int NotefieldPreviewImpl::getY()
int getY()
{
return myY;
}
Expand All @@ -484,20 +484,20 @@ DrawMode getMode()
return myDrawMode;
}

void NotefieldPreviewImpl::toggleEnabled()
void toggleEnabled()
{
myEnabled = !myEnabled;
gView->adjustForPreview(myEnabled);
gMenubar->update(Menubar::PREVIEW_ENABLED);
}

void NotefieldPreviewImpl::toggleShowBeatLines()
void toggleShowBeatLines()
{
myShowBeatLines = !myShowBeatLines;
gMenubar->update(Menubar::PREVIEW_SHOW_BEATLINES);
}

void NotefieldPreviewImpl::toggleReverseScroll()
void toggleReverseScroll()
{
myUseReverseScroll = !myUseReverseScroll;
gMenubar->update(Menubar::PREVIEW_SHOW_REVERSE_SCROLL);
Expand Down
4 changes: 2 additions & 2 deletions src/Editor/Shortcuts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ ShortcutsImpl()
// ================================================================================================
// ShortcutsImpl :: API functions.

std::string Shortcuts::getNotation(Action::Type action, bool fullList = false)
std::string getNotation(Action::Type action, bool fullList = false)
{
std::string out;
for(auto& shortcut : shortcutMappings_)
Expand Down Expand Up @@ -541,7 +541,7 @@ std::string Shortcuts::getNotation(Action::Type action, bool fullList = false)
return out;
}

Action::Type Shortcuts::getAction(int keyflags, Code key)
Action::Type getAction(int keyflags, Code key)
{
for(auto& shortcut : shortcutMappings_)
{
Expand Down
Loading
Loading