[nostalgia] Start on new TileSheetEditor
This commit is contained in:
@@ -1,13 +1,4 @@
|
||||
|
||||
#setup libraries
|
||||
|
||||
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
|
||||
if(NOSTALGIA_BUILD_STUDIO)
|
||||
find_package(QT NAMES Qt6 Qt5 COMPONENTS QuickWidgets Widgets REQUIRED)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS QuickWidgets Widgets REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#project packages
|
||||
|
||||
add_subdirectory(core)
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
#include "bounds.hpp"
|
||||
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -16,7 +12,6 @@ class Bounds {
|
||||
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Bounds";
|
||||
static constexpr auto Fields = 4;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -15,7 +11,6 @@ namespace nostalgia::common {
|
||||
class Point {
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Point";
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -15,7 +11,6 @@ namespace nostalgia::common {
|
||||
class Size {
|
||||
public:
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.common.Size";
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
@@ -17,10 +17,11 @@ target_link_libraries(
|
||||
add_subdirectory(gba)
|
||||
if(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
|
||||
add_subdirectory(glfw)
|
||||
#add_subdirectory(sdl)
|
||||
add_subdirectory(userland)
|
||||
endif()
|
||||
if(NOSTALGIA_BUILD_STUDIO)
|
||||
#add_subdirectory(studio)
|
||||
add_subdirectory(studio)
|
||||
endif()
|
||||
|
||||
install(
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/config.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/config.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/fs/fs.hpp>
|
||||
@@ -34,7 +30,6 @@ struct GbaPaletteTarget {
|
||||
|
||||
struct GbaTileMapTarget {
|
||||
static constexpr auto TypeName = NostalgiaGraphic::TypeName;
|
||||
static constexpr auto Fields = NostalgiaGraphic::Fields;
|
||||
static constexpr auto TypeVersion = NostalgiaGraphic::TypeVersion;
|
||||
volatile uint16_t *bgCtl = nullptr;
|
||||
ox::FileAddress defaultPalette;
|
||||
@@ -54,7 +49,7 @@ constexpr ox::Error modelRead(T *io, GbaPaletteTarget *t) noexcept {
|
||||
|
||||
template<typename T>
|
||||
constexpr ox::Error modelRead(T *io, GbaTileMapTarget *t) noexcept {
|
||||
io->template setTypeInfo<GbaTileMapTarget>(GbaTileMapTarget::TypeName, GbaTileMapTarget::Fields);
|
||||
io->template setTypeInfo<GbaTileMapTarget>();
|
||||
uint8_t bpp;
|
||||
int dummy;
|
||||
oxReturnError(io->field("bpp", &bpp));
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
// NOTE: this file is compiled as ARM and not THUMB, so don't but too much in
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/types.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/fs/fs.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/memops.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "gfx.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -25,14 +21,12 @@ enum class TileSheetSpace {
|
||||
|
||||
struct NostalgiaPalette {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.NostalgiaPalette";
|
||||
static constexpr auto Fields = 1;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
ox::Vector<Color16> colors;
|
||||
};
|
||||
|
||||
struct NostalgiaGraphic {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.NostalgiaGraphic";
|
||||
static constexpr auto Fields = 6;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
int8_t bpp = 0;
|
||||
// rows and columns are really only used by TileSheetEditor
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
@@ -49,7 +45,7 @@ ox::Error initGfx(Context *ctx) noexcept {
|
||||
ImGui::CreateContext();
|
||||
auto &io = ImGui::GetIO();
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||
io.MouseDrawCursor = true;
|
||||
//io.MouseDrawCursor = true;
|
||||
ImGui_ImplGlfw_InitForOpenGL(id->window, true);
|
||||
}
|
||||
return renderer::init(ctx);
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "media.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <array>
|
||||
|
@@ -1,63 +1,27 @@
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
add_library(
|
||||
NostalgiaCore-Studio OBJECT
|
||||
imgconv.cpp
|
||||
import_tilesheet_wizard.cpp
|
||||
#imgconv.cpp
|
||||
#import_tilesheet_wizard.cpp
|
||||
module.cpp
|
||||
new_tilesheet_wizard.cpp
|
||||
newpalettewizard.cpp
|
||||
paletteeditor.cpp
|
||||
#new_tilesheet_wizard.cpp
|
||||
#newpalettewizard.cpp
|
||||
#paletteeditor.cpp
|
||||
tilesheeteditor.cpp
|
||||
util.cpp
|
||||
rsrc.qrc
|
||||
tilesheetpixelgrid.cpp
|
||||
tilesheetpixels.cpp
|
||||
#util.cpp
|
||||
#rsrc.qrc
|
||||
)
|
||||
|
||||
if(NOT MSVC)
|
||||
target_compile_options(NostalgiaCore-Studio PRIVATE -Wsign-conversion)
|
||||
endif()
|
||||
|
||||
target_precompile_headers(
|
||||
NostalgiaCore-Studio PRIVATE
|
||||
<QBuffer>
|
||||
<QButtonGroup>
|
||||
<QColor>
|
||||
<QDebug>
|
||||
<QDialog>
|
||||
<QFile>
|
||||
<QFormLayout>
|
||||
<QHeaderView>
|
||||
<QImage>
|
||||
<QItemDelegate>
|
||||
<QMap>
|
||||
<QPainter>
|
||||
<QPluginLoader>
|
||||
<QPointer>
|
||||
<QPushButton>
|
||||
<QQmlContext>
|
||||
<QQuickItem>
|
||||
<QQuickWidget>
|
||||
<QSettings>
|
||||
<QSpinBox>
|
||||
<QSplitter>
|
||||
<QString>
|
||||
<QStringList>
|
||||
<QStyledItemDelegate>
|
||||
<QTableWidget>
|
||||
<QToolBar>
|
||||
<QUndoCommand>
|
||||
<QUndoStack>
|
||||
<QVariant>
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
NostalgiaCore-Studio
|
||||
Qt${QT_VERSION_MAJOR}::QuickWidgets
|
||||
NostalgiaCore-Studio PUBLIC
|
||||
NostalgiaStudio
|
||||
NostalgiaCore-Qt
|
||||
NostalgiaCore
|
||||
NostalgiaCore-GLFW
|
||||
NostalgiaGlUtils
|
||||
)
|
||||
|
||||
#target_compile_definitions(NostalgiaCore-Studio PRIVATE QT_QML_DEBUG)
|
||||
|
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2020 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
id: pixel;
|
||||
property int pixelNumber: index
|
||||
color: sheetData ? sheetData.palette[pixelNumber < sheetData.pixels.length ? sheetData.pixels[pixelNumber] : 0] : 'black'
|
||||
width: parent.width / 8
|
||||
height: parent.height / 8
|
||||
border.color: '#717d7e'
|
||||
border.width: 1
|
||||
|
||||
Text {
|
||||
text: (index % 8 + 1) + ', ' + Math.floor(index / 8 + 1)
|
||||
font.family: 'Helvetica'
|
||||
font.pointSize: 11
|
||||
color: '#717d7e88'
|
||||
visible: pixel.width > 42 // that's acutally not HGtG reference
|
||||
anchors.horizontalCenter: pixel.horizontalCenter
|
||||
anchors.bottom: pixel.bottom
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: sheetData ? sheetData.pixelSelected[pixel.pixelNumber] & 1 == 1 : false
|
||||
color: '#0088ff'
|
||||
opacity: 0.5
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
}
|
||||
|
||||
}
|
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2019 gtalent2@gmail.com
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
id: tile;
|
||||
property int tileNumber: -1
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
x: parent.width / 2 - tile.width / 2
|
||||
y: parent.height / 2 - tile.height / 2
|
||||
color: '#000000'
|
||||
|
||||
function pixelAt(x, y) {
|
||||
return tileGrid.childAt(x, y);
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: tileGrid
|
||||
width: tile.width
|
||||
height: tile.height
|
||||
rows: 8
|
||||
columns: 8
|
||||
Repeater {
|
||||
model: 64
|
||||
Pixel {
|
||||
pixelNumber: index + 64 * tile.tileNumber
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// place an outline Rectangle above the pixels
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
// make fill transparent
|
||||
color: '#00000000'
|
||||
border.color: '#000000'
|
||||
border.width: 2
|
||||
}
|
||||
|
||||
}
|
@@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 - 2020 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.14
|
||||
import 'qrc:/qml/'
|
||||
|
||||
Rectangle {
|
||||
id: tileSheetEditor
|
||||
clip: true
|
||||
color: '#717d7e'
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
width: tileSheetEditor.width
|
||||
height: tileSheetEditor.height
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
var tile = mouseArea.tileAt(mouseX, mouseY);
|
||||
if (tile) {
|
||||
contextMenu.popup();
|
||||
}
|
||||
} else {
|
||||
contextMenu.dismiss();
|
||||
switch (sheetData.activeTool) {
|
||||
case 'Fill':
|
||||
{
|
||||
var pixel = pixelAt(mouseX, mouseY);
|
||||
if (pixel) {
|
||||
sheetData.fillPixel(pixel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
if (mouse.button === Qt.LeftButton && !contextMenu.visible) {
|
||||
switch (sheetData.activeTool) {
|
||||
case 'Draw':
|
||||
var pixel = pixelAt(mouseX, mouseY);
|
||||
if (pixel) {
|
||||
sheetData.beginCmd();
|
||||
sheetData.updatePixel(pixel);
|
||||
}
|
||||
break;
|
||||
case 'Select':
|
||||
var pixel = pixelAt(mouseX, mouseY);
|
||||
if (pixel) {
|
||||
sheetData.beginCmd();
|
||||
sheetData.selectPixel(pixel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onWheel: {
|
||||
if (wheel.modifiers & Qt.ControlModifier) {
|
||||
const mod = tileGrid.scaleFactor / 10;
|
||||
if (wheel.angleDelta.y > 0 && tileGrid.scaleFactor < 7) {
|
||||
tileGrid.scaleFactor += mod;
|
||||
} else if (tileGrid.scaleFactor > 0.9) {
|
||||
tileGrid.scaleFactor -= mod;
|
||||
}
|
||||
|
||||
|
||||
if (tileGrid.width <= this.width) {
|
||||
tileGrid.x = this.width / 2 - tileGrid.width / 2;
|
||||
}
|
||||
if (tileGrid.height <= this.height) {
|
||||
tileGrid.y = this.height / 2 - tileGrid.height / 2;
|
||||
}
|
||||
} else {
|
||||
const mod = 15;
|
||||
if (tileGrid.width > this.width) {
|
||||
if (wheel.angleDelta.x > 0) {
|
||||
if (tileGrid.x < tileGrid.width / 2) {
|
||||
tileGrid.x += mod;
|
||||
}
|
||||
} else if (wheel.angleDelta.x < 0) {
|
||||
let x2 = tileGrid.x + tileGrid.width;
|
||||
if (x2 > this.width / 2) {
|
||||
tileGrid.x -= mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tileGrid.height > this.height) {
|
||||
if (wheel.angleDelta.y > 0) {
|
||||
if (tileGrid.y < this.height / 2) {
|
||||
tileGrid.y += mod;
|
||||
}
|
||||
} else if (wheel.angleDelta.y < 0) {
|
||||
let y2 = tileGrid.y + tileGrid.height;
|
||||
if (y2 > this.height / 2) {
|
||||
tileGrid.y -= mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
wheel.accepted = true;
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: contextMenu
|
||||
|
||||
MenuItem {
|
||||
text: "Insert Tile"
|
||||
onTriggered: {
|
||||
var tile = mouseArea.tileAt(contextMenu.x, contextMenu.y);
|
||||
if (tile) {
|
||||
sheetData.insertTileCmd(tile.tileNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuItem {
|
||||
text: "Delete Tile"
|
||||
onTriggered: {
|
||||
var tile = mouseArea.tileAt(contextMenu.x, contextMenu.y);
|
||||
sheetData.deleteTileCmd(tile.tileNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged: {
|
||||
if (mouseArea.pressedButtons & Qt.LeftButton && !contextMenu.visible) {
|
||||
var pixel = pixelAt(mouseX, mouseY);
|
||||
switch (sheetData.activeTool) {
|
||||
case 'Draw':
|
||||
if (pixel) {
|
||||
sheetData.updatePixel(pixel);
|
||||
}
|
||||
break;
|
||||
case 'Select':
|
||||
if (pixel) {
|
||||
sheetData.selectPixel(pixel);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onReleased: sheetData.endCmd()
|
||||
onCanceled: sheetData.endCmd()
|
||||
|
||||
function tileAt(x, y) {
|
||||
var gridX = x - tileGrid.x;
|
||||
var gridY = y - tileGrid.y;
|
||||
return tileGrid.childAt(gridX, gridY);
|
||||
}
|
||||
|
||||
function pixelAt(x, y) {
|
||||
var gridX = x - tileGrid.x;
|
||||
var gridY = y - tileGrid.y;
|
||||
var tile = tileGrid.childAt(gridX, gridY);
|
||||
if (tile === null) {
|
||||
return null;
|
||||
}
|
||||
var tileX = gridX - tile.x;
|
||||
var tileY = gridY - tile.y;
|
||||
var pixel = tile.pixelAt(tileX, tileY);
|
||||
return pixel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Grid {
|
||||
id: tileGrid
|
||||
property double scaleFactor: 0.9
|
||||
property int baseTileSize: Math.min(2000 / tileGrid.columns, 1000 / tileGrid.rows)
|
||||
x: tileSheetEditor.width / 2 - this.width / 2
|
||||
y: tileSheetEditor.height / 2 - this.height / 2
|
||||
width: tileGrid.columns * tileGrid.baseTileSize * tileGrid.scaleFactor
|
||||
height: tileGrid.rows * tileGrid.baseTileSize * tileGrid.scaleFactor
|
||||
rows: sheetData ? sheetData.rows : 1
|
||||
columns: sheetData ? sheetData.columns : 1
|
||||
states: State {
|
||||
name: "widthChanged"
|
||||
PropertyChanges { target: tileGrid.width; width: tileGrid.columns * tileGrid.baseTileSize * tileGrid.scaleFactor }
|
||||
}
|
||||
Repeater {
|
||||
model: tileGrid.rows * tileGrid.columns
|
||||
Tile {
|
||||
tileNumber: index
|
||||
width: tileGrid.width / tileGrid.columns
|
||||
height: tileGrid.height / tileGrid.rows
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <QColor>
|
||||
@@ -16,9 +12,8 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] uint16_t toGbaColor(QColor c) {
|
||||
[[nodiscard]]
|
||||
static uint16_t toGbaColor(QColor c) {
|
||||
const auto r = static_cast<uint32_t>(c.red()) >> 3;
|
||||
const auto g = static_cast<uint32_t>(c.green()) >> 3;
|
||||
const auto b = static_cast<uint32_t>(c.blue()) >> 3;
|
||||
@@ -26,9 +21,8 @@ namespace {
|
||||
return (a << 15) | (r << 10) | (g << 5) | (b << 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[[nodiscard]] static int countColors(const QImage &img, int argTiles) {
|
||||
[[nodiscard]]
|
||||
static int countColors(const QImage &img, int argTiles) {
|
||||
QMap<QRgb, bool> colors;
|
||||
// copy pixels as color ids
|
||||
for (int x = 0; x < img.width(); x++) {
|
||||
@@ -46,7 +40,8 @@ namespace {
|
||||
return colors.size();
|
||||
}
|
||||
|
||||
[[nodiscard]] std::unique_ptr<core::NostalgiaGraphic> imgToNg(QString argSrc, int argBpp) {
|
||||
[[nodiscard]]
|
||||
ox::UniquePtr<core::NostalgiaGraphic> imgToNg(QString argSrc, int argBpp) {
|
||||
QImage src(argSrc);
|
||||
|
||||
if (src.isNull()) {
|
||||
|
@@ -1,15 +1,9 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <ox/std/error.hpp>
|
||||
#include <ox/std/types.hpp>
|
||||
|
||||
@@ -19,16 +13,7 @@
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
[[nodiscard]] constexpr int pointToIdx(int w, int x, int y) noexcept {
|
||||
constexpr auto colLength = PixelsPerTile;
|
||||
const auto rowLength = (w / TileWidth) * colLength;
|
||||
const auto colStart = colLength * (x / TileWidth);
|
||||
const auto rowStart = rowLength * (y / TileHeight);
|
||||
const auto colOffset = x % TileWidth;
|
||||
const auto rowOffset = (y % TileHeight) * TileHeight;
|
||||
return colStart + colOffset + rowStart + rowOffset;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::unique_ptr<core::NostalgiaGraphic> imgToNg(QString argInPath, int argBpp = -1);
|
||||
[[nodiscard]]
|
||||
ox::UniquePtr<core::NostalgiaGraphic> imgToNg(ox::String argInPath, int argBpp = -1);
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <QBuffer>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,71 +1,22 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "new_tilesheet_wizard.hpp"
|
||||
#include "newpalettewizard.hpp"
|
||||
#include "import_tilesheet_wizard.hpp"
|
||||
#include "paletteeditor.hpp"
|
||||
#include "tilesheeteditor.hpp"
|
||||
|
||||
#include "module.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
QVector<studio::WizardMaker> Module::newWizards(const studio::Context *ctx) {
|
||||
return {
|
||||
{
|
||||
tr("Palette"),
|
||||
[ctx]() {
|
||||
QVector<QWizardPage*> pgs;
|
||||
pgs.push_back(new NewPaletteWizardPage(ctx));
|
||||
return pgs;
|
||||
}
|
||||
},
|
||||
{
|
||||
tr("Tile Sheet"),
|
||||
[ctx]() {
|
||||
QVector<QWizardPage*> pgs;
|
||||
pgs.push_back(new NewTilesheetWizardPage(ctx));
|
||||
return pgs;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
QVector<studio::WizardMaker> Module::importWizards(const studio::Context *ctx) {
|
||||
return {
|
||||
{
|
||||
tr("Tile Sheet"),
|
||||
[ctx]() {
|
||||
QVector<QWizardPage*> pgs;
|
||||
pgs.push_back(new ImportTilesheetWizardMainPage(ctx));
|
||||
pgs.push_back(new ImportTilesheetWizardPalettePage(ctx));
|
||||
return pgs;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
QVector<studio::EditorMaker> Module::editors(const studio::Context *ctx) {
|
||||
ox::Vector<studio::EditorMaker> Module::editors(core::Context *ctx) {
|
||||
return {
|
||||
{
|
||||
{"ng"},
|
||||
[ctx](QString path) {
|
||||
return new TileSheetEditor(path, ctx, ctx->tabParent);
|
||||
}
|
||||
},
|
||||
{
|
||||
{"npal"},
|
||||
[ctx](QString path) {
|
||||
return new PaletteEditor(path, ctx, ctx->tabParent);
|
||||
[ctx](const ox::String &path) {
|
||||
return new TileSheetEditor(ctx, path);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,31 +1,16 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QPluginLoader>
|
||||
|
||||
#include <nostalgia/studio/studio.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class Module: public QObject, public studio::Module {
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "net.drinkingtea.nostalgia.core.studio.Module" FILE "core-studio.json")
|
||||
Q_INTERFACES(nostalgia::studio::Module)
|
||||
|
||||
class Module: public studio::Module {
|
||||
public:
|
||||
QVector<studio::WizardMaker> newWizards(const studio::Context *ctx) override;
|
||||
|
||||
QVector<studio::WizardMaker> importWizards(const studio::Context *args) override;
|
||||
|
||||
QVector<studio::EditorMaker> editors(const studio::Context *ctx) override;
|
||||
|
||||
ox::Vector<studio::EditorMaker> editors(core::Context *ctx) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <QBuffer>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <QBuffer>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <QHeaderView>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
55
src/nostalgia/core/studio/ptidxconv.hpp
Normal file
55
src/nostalgia/core/studio/ptidxconv.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <nostalgia/common/point.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr int pointToIdx(int w, int x, int y) noexcept {
|
||||
constexpr auto colLength = PixelsPerTile;
|
||||
const auto rowLength = (w / TileWidth) * colLength;
|
||||
const auto colStart = colLength * (x / TileWidth);
|
||||
const auto rowStart = rowLength * (y / TileHeight);
|
||||
const auto colOffset = x % TileWidth;
|
||||
const auto rowOffset = (y % TileHeight) * TileHeight;
|
||||
return colStart + colOffset + rowStart + rowOffset;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr int ptToIdx(int x, int y, int c) noexcept {
|
||||
return pointToIdx(c * TileWidth, x, y);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr int ptToIdx(common::Point pt, int c) noexcept {
|
||||
return pointToIdx(c * TileWidth, pt.x, pt.y);
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr common::Point idxToPt(int i, int c) noexcept {
|
||||
const auto t = i / PixelsPerTile; // tile number
|
||||
const auto iti = i % PixelsPerTile; // in tile index
|
||||
const auto tc = t % c; // tile column
|
||||
const auto tr = t / c; // tile row
|
||||
const auto itx = iti % TileWidth; // in tile x
|
||||
const auto ity = iti / TileHeight; // in tile y
|
||||
return {
|
||||
itx + tc * TileWidth,
|
||||
ity + tr * TileHeight,
|
||||
};
|
||||
}
|
||||
|
||||
static_assert(idxToPt(4, 1) == common::Point{4, 0});
|
||||
static_assert(idxToPt(8, 1) == common::Point{0, 1});
|
||||
static_assert(idxToPt(8, 2) == common::Point{0, 1});
|
||||
static_assert(idxToPt(64, 2) == common::Point{8, 0});
|
||||
static_assert(idxToPt(128, 2) == common::Point{0, 8});
|
||||
static_assert(idxToPt(129, 2) == common::Point{1, 8});
|
||||
static_assert(idxToPt(192, 2) == common::Point{8, 8});
|
||||
static_assert(idxToPt(384, 8) == common::Point{48, 0});
|
||||
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/qml">
|
||||
<file>Pixel.qml</file>
|
||||
<file>Tile.qml</file>
|
||||
<file>TileSheetEditor.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,17 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QStringList>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QUndoStack>
|
||||
#include <QVariant>
|
||||
|
||||
#include <nostalgia/common/bounds.hpp>
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/glutils/glutils.hpp>
|
||||
#include <nostalgia/studio/studio.hpp>
|
||||
|
||||
#include "tilesheetpixelgrid.hpp"
|
||||
#include "tilesheetpixels.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
// Command IDs to use with QUndoCommand::id()
|
||||
@@ -35,7 +29,8 @@ enum class TileSheetTool: int {
|
||||
Fill,
|
||||
};
|
||||
|
||||
[[nodiscard]] constexpr auto toString(TileSheetTool t) noexcept {
|
||||
[[nodiscard]]
|
||||
constexpr auto toString(TileSheetTool t) noexcept {
|
||||
switch (t) {
|
||||
case TileSheetTool::Select:
|
||||
return "Select";
|
||||
@@ -49,14 +44,13 @@ enum class TileSheetTool: int {
|
||||
|
||||
struct PixelChunk {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.studio.PixelChunk";
|
||||
static constexpr auto Fields = 2;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
common::Point pt;
|
||||
int size = 0;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
ox::Error model(T *io, PixelChunk *c) {
|
||||
constexpr ox::Error model(T *io, PixelChunk *c) noexcept {
|
||||
io->template setTypeInfo<PixelChunk>();
|
||||
oxReturnError(io->field("pt", &c->pt));
|
||||
oxReturnError(io->field("size", &c->size));
|
||||
@@ -65,29 +59,31 @@ ox::Error model(T *io, PixelChunk *c) {
|
||||
|
||||
struct TileSheetClipboard {
|
||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.studio.TileSheetClipboard";
|
||||
static constexpr auto Fields = 3;
|
||||
static constexpr auto TypeVersion = 1;
|
||||
|
||||
template<typename T>
|
||||
friend ox::Error model(T*, TileSheetClipboard*);
|
||||
|
||||
protected:
|
||||
std::vector<int> m_pixels;
|
||||
ox::Vector<int> m_pixels;
|
||||
common::Point m_p1;
|
||||
common::Point m_p2;
|
||||
|
||||
public:
|
||||
void addPixel(int color);
|
||||
|
||||
[[nodiscard]] bool empty() const;
|
||||
[[nodiscard]]
|
||||
bool empty() const;
|
||||
|
||||
void pastePixels(common::Point pt, QVector<int> *tgt, int tgtColumns) const;
|
||||
void pastePixels(common::Point pt, ox::Vector<int> *tgt, int tgtColumns) const;
|
||||
|
||||
void setPoints(common::Point p1, common::Point p2);
|
||||
|
||||
[[nodiscard]] common::Point point1() const;
|
||||
[[nodiscard]]
|
||||
common::Point point1() const;
|
||||
|
||||
[[nodiscard]] common::Point point2() const;
|
||||
[[nodiscard]]
|
||||
common::Point point2() const;
|
||||
|
||||
};
|
||||
|
||||
@@ -100,176 +96,27 @@ ox::Error model(T *io, TileSheetClipboard *b) {
|
||||
return OxError(0);
|
||||
}
|
||||
|
||||
struct TileSheetEditorColorTableDelegate: public QStyledItemDelegate {
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &opt, const QModelIndex &idx) const;
|
||||
|
||||
};
|
||||
|
||||
class SheetData: public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
|
||||
Q_PROPERTY(int rows READ rows WRITE setRows NOTIFY rowsChanged)
|
||||
Q_PROPERTY(QVector<int> pixelSelected READ pixelSelected NOTIFY pixelSelectedChanged)
|
||||
Q_PROPERTY(QVector<int> pixels READ pixels NOTIFY pixelsChanged)
|
||||
Q_PROPERTY(QStringList palette READ palette NOTIFY paletteChanged)
|
||||
Q_PROPERTY(QString activeTool READ activeToolString)
|
||||
|
||||
private:
|
||||
class QQuickItem *m_prevPixelOperand = nullptr;
|
||||
QString m_tilesheetPath;
|
||||
QString m_currentPalettePath;
|
||||
uint64_t m_cmdIdx = 0;
|
||||
QUndoStack *m_cmdStack;
|
||||
QStringList m_palette;
|
||||
QVector<int> m_pixelSelected;
|
||||
QVector<int> m_pixels;
|
||||
common::Point m_selectionStart = {-1, -1};
|
||||
common::Point m_selectionEnd = {-1, -1};
|
||||
int m_columns = 1;
|
||||
int m_rows = 1;
|
||||
int m_selectedColor = 0;
|
||||
TileSheetTool m_activeTool = TileSheetTool::Draw;
|
||||
TileSheetClipboard m_clipboard;
|
||||
|
||||
public:
|
||||
explicit SheetData(QUndoStack*);
|
||||
|
||||
Q_INVOKABLE void fillPixel(QVariant pixel);
|
||||
|
||||
Q_INVOKABLE void selectPixel(QVariant pixel);
|
||||
|
||||
Q_INVOKABLE void updatePixel(QVariant pixel);
|
||||
|
||||
Q_INVOKABLE void beginCmd();
|
||||
|
||||
Q_INVOKABLE void endCmd();
|
||||
|
||||
Q_INVOKABLE void insertTileCmd(int tileIdx);
|
||||
|
||||
Q_INVOKABLE void deleteTileCmd(int tileIdx);
|
||||
|
||||
[[nodiscard]] int columns() const;
|
||||
|
||||
[[nodiscard]] int rows() const;
|
||||
|
||||
[[nodiscard]] const QVector<int> &pixelSelected() const;
|
||||
|
||||
[[nodiscard]] const QVector<int> &pixels() const;
|
||||
|
||||
[[nodiscard]] QStringList palette() const;
|
||||
|
||||
[[nodiscard]] QString palettePath() const;
|
||||
|
||||
void getFillPixels(bool *pixels, common::Point pt, int oldColor) const;
|
||||
|
||||
void load(const studio::Context *ctx, QString ngPath, QString palPath = "");
|
||||
|
||||
void reload(const studio::Context *ctx);
|
||||
|
||||
void save(const studio::Context *ctx, QString ngPath) const;
|
||||
|
||||
void setPalette(const NostalgiaPalette *pal);
|
||||
|
||||
void setPalette(const studio::Context *ctx, QString palPath);
|
||||
|
||||
void insertTile(int tileIdx, QVector<int> tileData = {});
|
||||
|
||||
QVector<int> deleteTile(int tileIdx);
|
||||
|
||||
void setSelectedColor(int index);
|
||||
|
||||
void modGteCmd(int val, int mod);
|
||||
|
||||
void modPixels(const QHash<int, int> &pixels, int inversion);
|
||||
|
||||
void setPixel(int index, int color);
|
||||
|
||||
void notifyUpdate();
|
||||
|
||||
[[nodiscard]] std::unique_ptr<NostalgiaGraphic> toNostalgiaGraphic() const;
|
||||
|
||||
[[nodiscard]] int activeTool() const;
|
||||
|
||||
[[nodiscard]] bool clipboardEmpty() const;
|
||||
|
||||
void cutToClipboard();
|
||||
|
||||
void cutToClipboard(TileSheetClipboard *cb);
|
||||
|
||||
void copyToClipboard();
|
||||
|
||||
void copyToClipboard(TileSheetClipboard *cb);
|
||||
|
||||
void pasteClipboard();
|
||||
|
||||
void applyClipboard(const TileSheetClipboard &cb);
|
||||
|
||||
void markSelection(common::Point selectionEnd);
|
||||
|
||||
public slots:
|
||||
void setColumns(int columns);
|
||||
|
||||
void setRows(int rows);
|
||||
|
||||
/**
|
||||
* Sets columns through a QUndoCommand.
|
||||
*/
|
||||
void updateColumns(int columns);
|
||||
|
||||
/**
|
||||
* Sets rows through a QUndoCommand.
|
||||
*/
|
||||
void updateRows(int rows);
|
||||
|
||||
void setActiveTool(int t);
|
||||
|
||||
private:
|
||||
void updatePixels(const NostalgiaGraphic *ng);
|
||||
|
||||
const char *activeToolString() const;
|
||||
|
||||
signals:
|
||||
void changeOccurred();
|
||||
|
||||
void columnsChanged(int);
|
||||
|
||||
void rowsChanged(int);
|
||||
|
||||
void pixelSelectedChanged(int pixelsSelected);
|
||||
|
||||
void pixelsChanged();
|
||||
|
||||
void paletteChanged();
|
||||
|
||||
};
|
||||
|
||||
|
||||
class TileSheetEditor: public studio::Editor {
|
||||
Q_OBJECT
|
||||
|
||||
private:
|
||||
TileSheetEditorColorTableDelegate m_colorTableDelegate;
|
||||
QString m_itemPath;
|
||||
QString m_itemName;
|
||||
const studio::Context *m_ctx = nullptr;
|
||||
SheetData m_sheetData;
|
||||
QButtonGroup m_toolBtns;
|
||||
class QSplitter *m_splitter = nullptr;
|
||||
struct LabeledSpinner *m_tilesX = nullptr;
|
||||
struct LabeledSpinner *m_tilesY = nullptr;
|
||||
class QQuickWidget* m_canvas = nullptr;
|
||||
struct {
|
||||
QComboBox *palette = nullptr;
|
||||
class QTableWidget *colorTable = nullptr;
|
||||
} m_colorPicker;
|
||||
ox::String m_itemPath;
|
||||
ox::String m_itemName;
|
||||
glutils::FrameBuffer m_framebuffer;
|
||||
TileSheetGrid m_pixelGrid;
|
||||
TileSheetPixels m_pixels;
|
||||
bool m_updated = false;
|
||||
NostalgiaGraphic m_img;
|
||||
AssetRef<NostalgiaPalette> m_pal;
|
||||
Context *m_ctx = nullptr;
|
||||
|
||||
public:
|
||||
TileSheetEditor(QString path, const studio::Context *ctx, QWidget *parent);
|
||||
TileSheetEditor(Context *ctx, const ox::String &path);
|
||||
|
||||
virtual ~TileSheetEditor();
|
||||
~TileSheetEditor() override = default;
|
||||
|
||||
QString itemName() const override;
|
||||
ox::String itemName() const noexcept override;
|
||||
|
||||
ox::String itemDisplayName() const noexcept override;
|
||||
|
||||
void exportFile() override;
|
||||
|
||||
@@ -279,34 +126,36 @@ class TileSheetEditor: public studio::Editor {
|
||||
|
||||
void paste() override;
|
||||
|
||||
void draw(core::Context*) noexcept override;
|
||||
|
||||
void glDraw() noexcept;
|
||||
|
||||
protected:
|
||||
void saveItem() override;
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
QWidget *setupColorPicker(QWidget *widget);
|
||||
|
||||
void setPalette();
|
||||
|
||||
void saveState();
|
||||
|
||||
void restoreState();
|
||||
|
||||
[[nodiscard]] QString paletteName(QString palettePath) const;
|
||||
[[nodiscard]]
|
||||
ox::String paletteName(const ox::String &palettePath) const;
|
||||
|
||||
[[nodiscard]] QString palettePath(QString palettePath) const;
|
||||
[[nodiscard]]
|
||||
ox::String palettePath(const ox::String &palettePath) const;
|
||||
|
||||
[[nodiscard]] QImage toQImage(NostalgiaGraphic *ng, NostalgiaPalette *npal) const;
|
||||
// slots
|
||||
public:
|
||||
ox::Error colorSelected() noexcept;
|
||||
|
||||
public slots:
|
||||
void colorSelected();
|
||||
ox::Error setColorTable() noexcept;
|
||||
|
||||
void setColorTable();
|
||||
|
||||
private slots:
|
||||
void updateAfterClicked();
|
||||
// slots
|
||||
private:
|
||||
ox::Error updateAfterClicked() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
90
src/nostalgia/core/studio/tilesheetpixelgrid.cpp
Normal file
90
src/nostalgia/core/studio/tilesheetpixelgrid.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/consts.hpp>
|
||||
#include "tilesheetpixelgrid.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Error TileSheetGrid::buildShader() noexcept {
|
||||
const auto pixelLineVshad = ox::sfmt(VShad, glutils::GlslVersion);
|
||||
const auto pixelLineFshad = ox::sfmt(FShad, glutils::GlslVersion);
|
||||
const auto pixelLineGshad = ox::sfmt(GShad, glutils::GlslVersion);
|
||||
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
|
||||
}
|
||||
|
||||
void TileSheetGrid::draw(bool update) noexcept {
|
||||
glUseProgram(m_shader);
|
||||
glBindVertexArray(m_bufferSet.vao);
|
||||
if (update) {
|
||||
glutils::sendVbo(m_bufferSet);
|
||||
}
|
||||
glDrawElements(GL_POINTS, static_cast<GLsizei>(m_bufferSet.elements.size()), GL_UNSIGNED_INT, nullptr);
|
||||
}
|
||||
|
||||
void TileSheetGrid::initBufferSet(const NostalgiaGraphic &img) noexcept {
|
||||
// vao
|
||||
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
||||
glBindVertexArray(m_bufferSet.vao);
|
||||
// vbo & ebo
|
||||
m_bufferSet.vbo = glutils::generateBuffer();
|
||||
m_bufferSet.ebo = glutils::generateBuffer();
|
||||
setBufferObjects(img, &m_bufferSet);
|
||||
glutils::sendVbo(m_bufferSet);
|
||||
glutils::sendEbo(m_bufferSet);
|
||||
// vbo layout
|
||||
const auto pt1Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt1"));
|
||||
glEnableVertexAttribArray(pt1Attr);
|
||||
glVertexAttribPointer(pt1Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float), nullptr);
|
||||
const auto pt2Attr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPt2"));
|
||||
glEnableVertexAttribArray(pt2Attr);
|
||||
glVertexAttribPointer(pt2Attr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
||||
}
|
||||
|
||||
void TileSheetGrid::setBufferObject(unsigned vertexRow, common::Point pt1, common::Point pt2, float *vbo, GLuint *ebo) noexcept {
|
||||
const auto ps = pixelSize();
|
||||
const auto x1 = static_cast<float>(pt1.x) * ps.x;
|
||||
const auto y1 = static_cast<float>(pt1.y) * ps.y;
|
||||
const auto x2 = static_cast<float>(pt2.x) * ps.x;
|
||||
const auto y2 = static_cast<float>(pt2.y) * ps.y;
|
||||
// don't worry, these memcpys gets optimized to something much more ideal
|
||||
const float vertices[VertexVboLength] = {x1, y1, x2, y2};
|
||||
memcpy(vbo, vertices, sizeof(vertices));
|
||||
const GLuint elms[VertexEboLength] = {vertexRow};
|
||||
memcpy(ebo, elms, sizeof(elms));
|
||||
}
|
||||
|
||||
void TileSheetGrid::setBufferObjects(const NostalgiaGraphic &img, glutils::BufferSet *bg) noexcept {
|
||||
const auto set = [bg](unsigned i, common::Point pt1, common::Point pt2) {
|
||||
const auto vbo = &bg->vertices[i * VertexVboLength];
|
||||
const auto ebo = &bg->elements[i * VertexEboLength];
|
||||
setBufferObject(i * VertexVboRows, pt1, pt2, vbo, ebo);
|
||||
};
|
||||
// set buffer lengths
|
||||
const auto width = img.columns * TileWidth;
|
||||
const auto height = img.rows * TileHeight;
|
||||
const auto tiles = static_cast<unsigned>(width * height);
|
||||
m_bufferSet.vertices.resize(tiles * VertexVboLength);
|
||||
m_bufferSet.elements.resize(tiles * VertexEboLength);
|
||||
// set buffers
|
||||
auto i = 0ull;
|
||||
for (auto x = 0; x < img.columns; ++x) {
|
||||
set(0, {x, 0}, {x, img.rows});
|
||||
++i;
|
||||
}
|
||||
for (auto y = 0; y < img.rows; ++y) {
|
||||
set(0, {0, y}, {img.columns, y});
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
ImVec2 TileSheetGrid::pixelSize() noexcept {
|
||||
const auto [sw, sh] = ImGui::GetContentRegionAvail();
|
||||
constexpr float ymod = 0.35f / 10.0f;
|
||||
const auto xmod = ymod * sh / sw;
|
||||
return {xmod, ymod};
|
||||
}
|
||||
|
||||
}
|
80
src/nostalgia/core/studio/tilesheetpixelgrid.hpp
Normal file
80
src/nostalgia/core/studio/tilesheetpixelgrid.hpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <nostalgia/common/point.hpp>
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/glutils/glutils.hpp>
|
||||
#include <nostalgia/studio/studio.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class TileSheetGrid {
|
||||
|
||||
private:
|
||||
static constexpr auto VertexVboRows = 1;
|
||||
static constexpr auto VertexVboRowLength = 4;
|
||||
static constexpr auto VertexVboLength = VertexVboRows * VertexVboRowLength;
|
||||
static constexpr auto VertexEboLength = 1;
|
||||
|
||||
static constexpr auto VShad = R"(
|
||||
{}
|
||||
in vec2 vPt1;
|
||||
in vec2 vPt2;
|
||||
out VS_OUT {
|
||||
vec2 pt1;
|
||||
vec2 pt2;
|
||||
} vs_out;
|
||||
void main() {
|
||||
vs_out.pt1 = vPt1;
|
||||
vs_out.pt2 = vPt2;
|
||||
gl_Position = vec4(vPt1, 0.0, 1.0);
|
||||
})";
|
||||
|
||||
static constexpr auto FShad = R"(
|
||||
{}
|
||||
in vec3 fColor;
|
||||
out vec4 outColor;
|
||||
void main() {
|
||||
outColor = vec4(0.4431, 0.4901, 0.4941, 1.0);
|
||||
})";
|
||||
|
||||
static constexpr auto GShad = R"glsl(
|
||||
{}
|
||||
in VS_OUT {
|
||||
vec2 pt1;
|
||||
vec2 pt2;
|
||||
} gs_in[];
|
||||
layout(line_strip, max_vertices = 2) out;
|
||||
void main() {
|
||||
//gl_Position = vec4(gs_in[0].pt1, 0, 0);
|
||||
//EmitVertex();
|
||||
//gl_Position = vec4(gs_in[0].pt2, 0, 0);
|
||||
//EmitVertex();
|
||||
//EndPrimitive();
|
||||
})glsl";
|
||||
|
||||
glutils::GLProgram m_shader;
|
||||
glutils::BufferSet m_bufferSet;
|
||||
|
||||
public:
|
||||
ox::Error buildShader() noexcept;
|
||||
|
||||
void draw(bool update) noexcept;
|
||||
|
||||
void initBufferSet(const NostalgiaGraphic &img) noexcept;
|
||||
|
||||
private:
|
||||
static void setBufferObject(unsigned vertexRow, common::Point pt1, common::Point pt2, float *vbo, GLuint *ebo) noexcept;
|
||||
|
||||
void setBufferObjects(const NostalgiaGraphic &img, glutils::BufferSet *bg) noexcept;
|
||||
|
||||
static class ImVec2 pixelSize() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
108
src/nostalgia/core/studio/tilesheetpixels.cpp
Normal file
108
src/nostalgia/core/studio/tilesheetpixels.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/consts.hpp>
|
||||
#include "ptidxconv.hpp"
|
||||
#include "tilesheetpixels.hpp"
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
ox::Error TileSheetPixels::buildShader() noexcept {
|
||||
const auto Vshad = ox::sfmt(VShad, glutils::GlslVersion);
|
||||
const auto Fshad = ox::sfmt(FShad, glutils::GlslVersion);
|
||||
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
|
||||
}
|
||||
|
||||
void TileSheetPixels::draw(bool update) noexcept {
|
||||
glUseProgram(m_shader);
|
||||
glBindVertexArray(m_bufferSet.vao);
|
||||
if (update) {
|
||||
glutils::sendVbo(m_bufferSet);
|
||||
}
|
||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(m_bufferSet.elements.size()), GL_UNSIGNED_INT, nullptr);
|
||||
}
|
||||
|
||||
void TileSheetPixels::initBufferSet(const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept {
|
||||
// vao
|
||||
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
||||
glBindVertexArray(m_bufferSet.vao);
|
||||
// vbo & ebo
|
||||
m_bufferSet.vbo = glutils::generateBuffer();
|
||||
m_bufferSet.ebo = glutils::generateBuffer();
|
||||
setBufferObjects(img, pal, &m_bufferSet);
|
||||
glutils::sendVbo(m_bufferSet);
|
||||
glutils::sendEbo(m_bufferSet);
|
||||
// vbo layout
|
||||
const auto posAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vPosition"));
|
||||
glEnableVertexAttribArray(posAttr);
|
||||
glVertexAttribPointer(posAttr, 2, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float), nullptr);
|
||||
const auto colorAttr = static_cast<GLuint>(glGetAttribLocation(m_shader, "vColor"));
|
||||
glEnableVertexAttribArray(colorAttr);
|
||||
glVertexAttribPointer(colorAttr, 3, GL_FLOAT, GL_FALSE, VertexVboRowLength * sizeof(float),
|
||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
||||
}
|
||||
|
||||
void TileSheetPixels::setPixelBufferObject(unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept {
|
||||
const auto [xmod, ymod] = pixelSize();
|
||||
x *= xmod;
|
||||
y *= -ymod;
|
||||
x -= 1.0f;
|
||||
y += 1.0f - ymod;
|
||||
//std::cout << x << ", " << y << ", " << (x + xmod) << ", " << (y + ymod) << '\n';
|
||||
const auto r = redf(color), g = greenf(color), b = bluef(color);
|
||||
// don't worry, these memcpys gets optimized to something much more ideal
|
||||
const float vertices[VertexVboLength] = {
|
||||
x, y, r, g, b, // bottom left
|
||||
x + xmod, y, r, g, b, // bottom right
|
||||
x + xmod, y + ymod, r, g, b, // top right
|
||||
x, y + ymod, r, g, b, // top left
|
||||
};
|
||||
memcpy(vbo, vertices, sizeof(vertices));
|
||||
const GLuint elms[VertexEboLength] = {
|
||||
vertexRow + 0, vertexRow + 1, vertexRow + 2,
|
||||
vertexRow + 2, vertexRow + 3, vertexRow + 0,
|
||||
};
|
||||
memcpy(ebo, elms, sizeof(elms));
|
||||
}
|
||||
|
||||
void TileSheetPixels::setBufferObjects(const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept {
|
||||
const auto setPixel = [bg, img, pal](std::size_t i, uint8_t p) {
|
||||
const auto color = pal.colors[p];
|
||||
const auto pt = idxToPt(i, img.columns);
|
||||
const auto fx = static_cast<float>(pt.x);
|
||||
const auto fy = static_cast<float>(pt.y);
|
||||
const auto vbo = &bg->vertices[i * VertexVboLength];
|
||||
const auto ebo = &bg->elements[i * VertexEboLength];
|
||||
setPixelBufferObject(i * VertexVboRows, fx, fy, color, vbo, ebo);
|
||||
};
|
||||
// set buffer lengths
|
||||
const auto width = img.columns * TileWidth;
|
||||
const auto height = img.rows * TileHeight;
|
||||
const auto tiles = static_cast<unsigned>(width * height);
|
||||
m_bufferSet.vertices.resize(tiles * VertexVboLength);
|
||||
m_bufferSet.elements.resize(tiles * VertexEboLength);
|
||||
// set pixels
|
||||
if (img.bpp == 4) {
|
||||
for (std::size_t i = 0; i < img.pixels.size(); ++i) {
|
||||
const auto colorIdx1 = img.pixels[i] & 0xF;
|
||||
const auto colorIdx2 = img.pixels[i] >> 4;
|
||||
setPixel(i * 2 + 0, colorIdx1);
|
||||
setPixel(i * 2 + 1, colorIdx2);
|
||||
}
|
||||
} else {
|
||||
for (std::size_t i = 0; i < img.pixels.size(); ++i) {
|
||||
const auto p = img.pixels[i];
|
||||
setPixel(i, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImVec2 TileSheetPixels::pixelSize() noexcept {
|
||||
const auto [sw, sh] = ImGui::GetContentRegionAvail();
|
||||
constexpr float ymod = 0.35f / 10.0f;
|
||||
const auto xmod = ymod * sh / sw;
|
||||
return {xmod, ymod};
|
||||
}
|
||||
|
||||
}
|
59
src/nostalgia/core/studio/tilesheetpixels.hpp
Normal file
59
src/nostalgia/core/studio/tilesheetpixels.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <imgui.h>
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
#include <nostalgia/glutils/glutils.hpp>
|
||||
#include <nostalgia/studio/studio.hpp>
|
||||
|
||||
namespace nostalgia::core {
|
||||
|
||||
class TileSheetPixels {
|
||||
|
||||
private:
|
||||
static constexpr auto VertexVboRows = 4;
|
||||
static constexpr auto VertexVboRowLength = 5;
|
||||
static constexpr auto VertexVboLength = VertexVboRows * VertexVboRowLength;
|
||||
static constexpr auto VertexEboLength = 6;
|
||||
static constexpr auto VShad = R"(
|
||||
{}
|
||||
in vec2 vPosition;
|
||||
in vec3 vColor;
|
||||
out vec3 fColor;
|
||||
void main() {
|
||||
gl_Position = vec4(vPosition, 0.0, 1.0);
|
||||
fColor = vColor;
|
||||
})";
|
||||
static constexpr auto FShad = R"(
|
||||
{}
|
||||
in vec3 fColor;
|
||||
out vec4 outColor;
|
||||
void main() {
|
||||
//outColor = vec4(0.0, 0.7, 1.0, 1.0);
|
||||
outColor = vec4(fColor, 1.0);
|
||||
})";
|
||||
|
||||
glutils::GLProgram m_shader;
|
||||
glutils::BufferSet m_bufferSet;
|
||||
|
||||
public:
|
||||
ox::Error buildShader() noexcept;
|
||||
|
||||
void draw(bool update) noexcept;
|
||||
|
||||
void initBufferSet(const NostalgiaGraphic &img, const NostalgiaPalette &pal) noexcept;
|
||||
|
||||
private:
|
||||
static void setPixelBufferObject(unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) noexcept;
|
||||
|
||||
void setBufferObjects(const NostalgiaGraphic &img, const NostalgiaPalette &pal, glutils::BufferSet *bg) noexcept;
|
||||
|
||||
static class ImVec2 pixelSize() noexcept;
|
||||
|
||||
};
|
||||
|
||||
}
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "util.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/gfx.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <array>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/bstring.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -26,7 +22,7 @@
|
||||
|
||||
namespace nostalgia::glutils {
|
||||
|
||||
constexpr auto GlslVersion = "#version 150";
|
||||
constexpr auto GlslVersion = "#version 330";
|
||||
|
||||
struct Empty {};
|
||||
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/memory.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <nostalgia/core/core.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "scene.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -43,4 +43,4 @@ install(
|
||||
BUNDLE DESTINATION .
|
||||
)
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(lib)
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
@@ -14,11 +10,11 @@
|
||||
|
||||
namespace nostalgia {
|
||||
|
||||
//[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
|
||||
//constexpr auto BuiltinModules = {
|
||||
// [] {
|
||||
// return ox::make_unique<core::Module>();
|
||||
// },
|
||||
//};
|
||||
[[maybe_unused]] // GCC warns about the existence of this "unused" constexpr list in a header file...
|
||||
constexpr auto BuiltinModules = {
|
||||
[] {
|
||||
return ox::make_unique<core::Module>();
|
||||
},
|
||||
};
|
||||
|
||||
}
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <imgui.h>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "configio.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/string.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/defines.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "module.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <filesystem>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "undostack.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "widget.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include "window.hpp"
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <ox/std/trace.hpp>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
|
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 - 2021 gary@drinkingtea.net
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright 2016 - 2021 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user