Compare commits
7 Commits
bd665cfc35
...
03a1a8abca
Author | SHA1 | Date | |
---|---|---|---|
03a1a8abca | |||
4e0ce57594 | |||
220f272867 | |||
79e6838ab3 | |||
78eeb30b15 | |||
8679f6b5a3 | |||
323d5d8d53 |
13
deps/ox/src/ox/std/CMakeLists.txt
vendored
13
deps/ox/src/ox/std/CMakeLists.txt
vendored
@ -38,10 +38,15 @@ add_library(
|
|||||||
trace.cpp
|
trace.cpp
|
||||||
typetraits.cpp
|
typetraits.cpp
|
||||||
uuid.cpp
|
uuid.cpp
|
||||||
|
vec.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
target_compile_options(OxStd PRIVATE -Wsign-conversion)
|
target_compile_options(OxStd PRIVATE -Wsign-conversion)
|
||||||
|
if(UNIX AND NOT APPLE)
|
||||||
|
target_compile_options(OxStd PUBLIC -export-dynamic)
|
||||||
|
#target_link_options(OxStd PUBLIC -W1,-E)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OX_BARE_METAL)
|
if(NOT OX_BARE_METAL)
|
||||||
@ -77,14 +82,15 @@ install(
|
|||||||
array.hpp
|
array.hpp
|
||||||
assert.hpp
|
assert.hpp
|
||||||
bit.hpp
|
bit.hpp
|
||||||
|
bounds.hpp
|
||||||
bstring.hpp
|
bstring.hpp
|
||||||
buffer.hpp
|
buffer.hpp
|
||||||
buildinfo.hpp
|
buildinfo.hpp
|
||||||
byteswap.hpp
|
byteswap.hpp
|
||||||
concepts.hpp
|
concepts.hpp
|
||||||
def.hpp
|
def.hpp
|
||||||
defines.hpp
|
|
||||||
defer.hpp
|
defer.hpp
|
||||||
|
defines.hpp
|
||||||
error.hpp
|
error.hpp
|
||||||
fmt.hpp
|
fmt.hpp
|
||||||
hardware.hpp
|
hardware.hpp
|
||||||
@ -96,12 +102,14 @@ install(
|
|||||||
memory.hpp
|
memory.hpp
|
||||||
new.hpp
|
new.hpp
|
||||||
optional.hpp
|
optional.hpp
|
||||||
|
point.hpp
|
||||||
random.hpp
|
random.hpp
|
||||||
ranges.hpp
|
ranges.hpp
|
||||||
serialize.hpp
|
serialize.hpp
|
||||||
|
size.hpp
|
||||||
|
stacktrace.hpp
|
||||||
std.hpp
|
std.hpp
|
||||||
stddef.hpp
|
stddef.hpp
|
||||||
stacktrace.hpp
|
|
||||||
string.hpp
|
string.hpp
|
||||||
stringview.hpp
|
stringview.hpp
|
||||||
strongint.hpp
|
strongint.hpp
|
||||||
@ -112,6 +120,7 @@ install(
|
|||||||
typetraits.hpp
|
typetraits.hpp
|
||||||
units.hpp
|
units.hpp
|
||||||
uuid.hpp
|
uuid.hpp
|
||||||
|
vec.hpp
|
||||||
vector.hpp
|
vector.hpp
|
||||||
writer.hpp
|
writer.hpp
|
||||||
DESTINATION
|
DESTINATION
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2015 - 2023 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/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -10,12 +14,12 @@
|
|||||||
|
|
||||||
#include "point.hpp"
|
#include "point.hpp"
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
namespace ox {
|
||||||
|
|
||||||
class Bounds {
|
class Bounds {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.geo.Bounds";
|
static constexpr auto TypeName = "net.drinkingtea.ox.Bounds";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
@ -1,5 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2015 - 2023 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/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -7,11 +11,11 @@
|
|||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
#include <ox/std/error.hpp>
|
#include <ox/std/error.hpp>
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
namespace ox {
|
||||||
|
|
||||||
class Point {
|
class Point {
|
||||||
public:
|
public:
|
||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.geo.Point";
|
static constexpr auto TypeName = "net.drinkingtea.ox.Point";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
@ -20,22 +24,22 @@ class Point {
|
|||||||
|
|
||||||
constexpr Point(int x, int y) noexcept;
|
constexpr Point(int x, int y) noexcept;
|
||||||
|
|
||||||
constexpr Point operator+(const geo::Point &p) const noexcept;
|
constexpr Point operator+(const Point &p) const noexcept;
|
||||||
|
|
||||||
constexpr Point operator-(const geo::Point &p) const noexcept;
|
constexpr Point operator-(const Point &p) const noexcept;
|
||||||
|
|
||||||
constexpr Point operator*(const geo::Point &p) const noexcept;
|
constexpr Point operator*(const Point &p) const noexcept;
|
||||||
|
|
||||||
constexpr Point operator/(const geo::Point &p) const noexcept;
|
constexpr Point operator/(const Point &p) const noexcept;
|
||||||
|
|
||||||
|
|
||||||
constexpr Point operator+=(const geo::Point &p) noexcept;
|
constexpr Point operator+=(const Point &p) noexcept;
|
||||||
|
|
||||||
constexpr Point operator-=(const geo::Point &p) noexcept;
|
constexpr Point operator-=(const Point &p) noexcept;
|
||||||
|
|
||||||
constexpr Point operator*=(const geo::Point &p) noexcept;
|
constexpr Point operator*=(const Point &p) noexcept;
|
||||||
|
|
||||||
constexpr Point operator/=(const geo::Point &p) noexcept;
|
constexpr Point operator/=(const Point &p) noexcept;
|
||||||
|
|
||||||
|
|
||||||
constexpr Point operator+(int i) const noexcept;
|
constexpr Point operator+(int i) const noexcept;
|
||||||
@ -67,53 +71,53 @@ constexpr Point::Point(int x, int y) noexcept {
|
|||||||
this->y = y;
|
this->y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator+(const geo::Point &p) const noexcept {
|
constexpr Point Point::operator+(const Point &p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.x += p.x;
|
out.x += p.x;
|
||||||
out.y += p.y;
|
out.y += p.y;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator-(const geo::Point &p) const noexcept {
|
constexpr Point Point::operator-(const Point &p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.x -= p.x;
|
out.x -= p.x;
|
||||||
out.y -= p.y;
|
out.y -= p.y;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator*(const geo::Point &p) const noexcept {
|
constexpr Point Point::operator*(const Point &p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.x *= p.x;
|
out.x *= p.x;
|
||||||
out.y *= p.y;
|
out.y *= p.y;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator/(const geo::Point &p) const noexcept {
|
constexpr Point Point::operator/(const Point &p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.x /= p.x;
|
out.x /= p.x;
|
||||||
out.y /= p.y;
|
out.y /= p.y;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator+=(const geo::Point &p) noexcept {
|
constexpr Point Point::operator+=(const Point &p) noexcept {
|
||||||
x += p.x;
|
x += p.x;
|
||||||
y += p.y;
|
y += p.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator-=(const geo::Point &p) noexcept {
|
constexpr Point Point::operator-=(const Point &p) noexcept {
|
||||||
x -= p.x;
|
x -= p.x;
|
||||||
y -= p.y;
|
y -= p.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator*=(const geo::Point &p) noexcept {
|
constexpr Point Point::operator*=(const Point &p) noexcept {
|
||||||
x *= p.x;
|
x *= p.x;
|
||||||
y *= p.y;
|
y *= p.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Point Point::operator/=(const geo::Point &p) noexcept {
|
constexpr Point Point::operator/=(const Point &p) noexcept {
|
||||||
x /= p.x;
|
x /= p.x;
|
||||||
y /= p.y;
|
y /= p.y;
|
||||||
return *this;
|
return *this;
|
@ -1,16 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2015 - 2023 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/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/error.hpp>
|
#include <ox/std/error.hpp>
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
namespace ox {
|
||||||
|
|
||||||
class Size {
|
class Size {
|
||||||
public:
|
public:
|
||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.geo.Size";
|
static constexpr auto TypeName = "net.drinkingtea.ox.Size";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
@ -19,22 +23,22 @@ class Size {
|
|||||||
|
|
||||||
constexpr Size(int width, int height) noexcept;
|
constexpr Size(int width, int height) noexcept;
|
||||||
|
|
||||||
constexpr Size operator+(geo::Size p) const noexcept;
|
constexpr Size operator+(Size p) const noexcept;
|
||||||
|
|
||||||
constexpr Size operator-(geo::Size p) const noexcept;
|
constexpr Size operator-(Size p) const noexcept;
|
||||||
|
|
||||||
constexpr Size operator*(geo::Size p) const noexcept;
|
constexpr Size operator*(Size p) const noexcept;
|
||||||
|
|
||||||
constexpr Size operator/(geo::Size p) const noexcept;
|
constexpr Size operator/(Size p) const noexcept;
|
||||||
|
|
||||||
|
|
||||||
constexpr Size operator+=(geo::Size p) noexcept;
|
constexpr Size operator+=(Size p) noexcept;
|
||||||
|
|
||||||
constexpr Size operator-=(geo::Size p) noexcept;
|
constexpr Size operator-=(Size p) noexcept;
|
||||||
|
|
||||||
constexpr Size operator*=(geo::Size p) noexcept;
|
constexpr Size operator*=(Size p) noexcept;
|
||||||
|
|
||||||
constexpr Size operator/=(geo::Size p) noexcept;
|
constexpr Size operator/=(Size p) noexcept;
|
||||||
|
|
||||||
|
|
||||||
constexpr Size operator+(int i) const noexcept;
|
constexpr Size operator+(int i) const noexcept;
|
||||||
@ -66,51 +70,51 @@ constexpr Size::Size(int width, int height) noexcept {
|
|||||||
this->height = height;
|
this->height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator+(geo::Size p) const noexcept {
|
constexpr Size Size::operator+(Size p) const noexcept {
|
||||||
p.width += width;
|
p.width += width;
|
||||||
p.height += height;
|
p.height += height;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator-(geo::Size p) const noexcept {
|
constexpr Size Size::operator-(Size p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.width -= p.width;
|
out.width -= p.width;
|
||||||
out.height -= p.height;
|
out.height -= p.height;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator*(geo::Size p) const noexcept {
|
constexpr Size Size::operator*(Size p) const noexcept {
|
||||||
p.width *= width;
|
p.width *= width;
|
||||||
p.height *= height;
|
p.height *= height;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator/(geo::Size p) const noexcept {
|
constexpr Size Size::operator/(Size p) const noexcept {
|
||||||
auto out = *this;
|
auto out = *this;
|
||||||
out.width /= p.width;
|
out.width /= p.width;
|
||||||
out.height /= p.height;
|
out.height /= p.height;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator+=(geo::Size p) noexcept {
|
constexpr Size Size::operator+=(Size p) noexcept {
|
||||||
width += p.width;
|
width += p.width;
|
||||||
height += p.height;
|
height += p.height;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator-=(geo::Size p) noexcept {
|
constexpr Size Size::operator-=(Size p) noexcept {
|
||||||
width -= p.width;
|
width -= p.width;
|
||||||
height -= p.height;
|
height -= p.height;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator*=(geo::Size p) noexcept {
|
constexpr Size Size::operator*=(Size p) noexcept {
|
||||||
width *= p.width;
|
width *= p.width;
|
||||||
height *= p.height;
|
height *= p.height;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Size Size::operator/=(geo::Size p) noexcept {
|
constexpr Size Size::operator/=(Size p) noexcept {
|
||||||
width /= p.width;
|
width /= p.width;
|
||||||
height /= p.height;
|
height /= p.height;
|
||||||
return *this;
|
return *this;
|
6
deps/ox/src/ox/std/std.hpp
vendored
6
deps/ox/src/ox/std/std.hpp
vendored
@ -11,11 +11,12 @@
|
|||||||
#include "array.hpp"
|
#include "array.hpp"
|
||||||
#include "assert.hpp"
|
#include "assert.hpp"
|
||||||
#include "bit.hpp"
|
#include "bit.hpp"
|
||||||
|
#include "bounds.hpp"
|
||||||
#include "bstring.hpp"
|
#include "bstring.hpp"
|
||||||
#include "byteswap.hpp"
|
#include "byteswap.hpp"
|
||||||
#include "concepts.hpp"
|
#include "concepts.hpp"
|
||||||
#include "defer.hpp"
|
|
||||||
#include "def.hpp"
|
#include "def.hpp"
|
||||||
|
#include "defer.hpp"
|
||||||
#include "defines.hpp"
|
#include "defines.hpp"
|
||||||
#include "error.hpp"
|
#include "error.hpp"
|
||||||
#include "fmt.hpp"
|
#include "fmt.hpp"
|
||||||
@ -28,9 +29,11 @@
|
|||||||
#include "memory.hpp"
|
#include "memory.hpp"
|
||||||
#include "new.hpp"
|
#include "new.hpp"
|
||||||
#include "optional.hpp"
|
#include "optional.hpp"
|
||||||
|
#include "point.hpp"
|
||||||
#include "random.hpp"
|
#include "random.hpp"
|
||||||
#include "realstd.hpp"
|
#include "realstd.hpp"
|
||||||
#include "serialize.hpp"
|
#include "serialize.hpp"
|
||||||
|
#include "size.hpp"
|
||||||
#include "stacktrace.hpp"
|
#include "stacktrace.hpp"
|
||||||
#include "stddef.hpp"
|
#include "stddef.hpp"
|
||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
@ -43,4 +46,5 @@
|
|||||||
#include "typetraits.hpp"
|
#include "typetraits.hpp"
|
||||||
#include "units.hpp"
|
#include "units.hpp"
|
||||||
#include "uuid.hpp"
|
#include "uuid.hpp"
|
||||||
|
#include "vec.hpp"
|
||||||
#include "vector.hpp"
|
#include "vector.hpp"
|
||||||
|
20
deps/ox/src/ox/std/vec.cpp
vendored
Normal file
20
deps/ox/src/ox/std/vec.cpp
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2015 - 2023 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ox/std/defines.hpp>
|
||||||
|
|
||||||
|
#include "vec.hpp"
|
||||||
|
|
||||||
|
namespace ox {
|
||||||
|
|
||||||
|
static_assert([] {
|
||||||
|
Vec2 v(1, 2);
|
||||||
|
return v.x == 1 && v.y == 2 && v[0] == 1 && v[1] == 2 && v.size() == 2;
|
||||||
|
}());
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2015 - 2023 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/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -17,7 +21,7 @@
|
|||||||
#include <ox/std/math.hpp>
|
#include <ox/std/math.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
namespace ox {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct Vec {
|
struct Vec {
|
||||||
@ -25,7 +29,7 @@ struct Vec {
|
|||||||
using value_type = T;
|
using value_type = T;
|
||||||
using size_type = std::size_t;
|
using size_type = std::size_t;
|
||||||
|
|
||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.geo.Point";
|
static constexpr auto TypeName = "net.drinkingtea.ox.Point";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
|
|
||||||
T x = 0;
|
T x = 0;
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
add_subdirectory(appmodules)
|
add_subdirectory(appmodules)
|
||||||
add_subdirectory(core)
|
add_subdirectory(core)
|
||||||
add_subdirectory(geo)
|
|
||||||
add_subdirectory(scene)
|
add_subdirectory(scene)
|
||||||
|
|
||||||
if(NOSTALGIA_BUILD_PLAYER)
|
if(NOSTALGIA_BUILD_PLAYER)
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
#include <nostalgia/geo/point.hpp>
|
#include <ox/std/point.hpp>
|
||||||
|
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
|
||||||
|
@ -7,17 +7,18 @@
|
|||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
#include <ox/model/desctypes.hpp>
|
#include <ox/model/desctypes.hpp>
|
||||||
#include <ox/std/buffer.hpp>
|
#include <ox/std/buffer.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
|
|
||||||
#include <keel/context.hpp>
|
#include <keel/context.hpp>
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
#include "event.hpp"
|
#include "event.hpp"
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
|
|
||||||
namespace nostalgia::core::gl {
|
namespace nostalgia::core::gl {
|
||||||
|
void setMainViewEnabled(core::Context *ctx, bool enabled) noexcept;
|
||||||
void drawMainView(core::Context*) noexcept;
|
void drawMainView(core::Context*) noexcept;
|
||||||
void setRenderSize(core::Context*, int width, int height) noexcept;
|
void setRenderSize(core::Context*, int width, int height) noexcept;
|
||||||
geo::Size getRenderSize(core::Context*) noexcept;
|
ox::Size getRenderSize(core::Context*) noexcept;
|
||||||
void clearRenderSize(core::Context *ctx) noexcept;
|
void clearRenderSize(core::Context *ctx) noexcept;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ namespace nostalgia::core::renderer {
|
|||||||
ox::Error init(Context *ctx) noexcept;
|
ox::Error init(Context *ctx) noexcept;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
namespace ox {
|
||||||
class Size;
|
class Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ class Context: public keel::Context {
|
|||||||
friend constexpr void setConstantRefresh(Context *ctx, bool) noexcept;
|
friend constexpr void setConstantRefresh(Context *ctx, bool) noexcept;
|
||||||
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
||||||
friend bool buttonDown(Context *ctx, Key) noexcept;
|
friend bool buttonDown(Context *ctx, Key) noexcept;
|
||||||
friend geo::Size getScreenSize(Context *ctx) noexcept;
|
friend ox::Size getScreenSize(Context *ctx) noexcept;
|
||||||
friend int getScreenHeight(Context *ctx) noexcept;
|
friend int getScreenHeight(Context *ctx) noexcept;
|
||||||
friend int getScreenWidth(Context *ctx) noexcept;
|
friend int getScreenWidth(Context *ctx) noexcept;
|
||||||
friend ox::Error initGfx(Context *ctx) noexcept;
|
friend ox::Error initGfx(Context *ctx) noexcept;
|
||||||
@ -105,9 +106,10 @@ class Context: public keel::Context {
|
|||||||
unsigned spriteSize,
|
unsigned spriteSize,
|
||||||
unsigned flipX) noexcept;
|
unsigned flipX) noexcept;
|
||||||
friend void hideSprite(Context *ctx, unsigned idx) noexcept;
|
friend void hideSprite(Context *ctx, unsigned idx) noexcept;
|
||||||
|
friend void gl::setMainViewEnabled(core::Context *ctx, bool enabled) noexcept;
|
||||||
friend void gl::drawMainView(core::Context*) noexcept;
|
friend void gl::drawMainView(core::Context*) noexcept;
|
||||||
friend void gl::setRenderSize(core::Context*, int width, int height) noexcept;
|
friend void gl::setRenderSize(core::Context*, int width, int height) noexcept;
|
||||||
friend geo::Size gl::getRenderSize(core::Context*) noexcept;
|
friend ox::Size gl::getRenderSize(core::Context*) noexcept;
|
||||||
friend void gl::clearRenderSize(core::Context *ctx) noexcept;
|
friend void gl::clearRenderSize(core::Context *ctx) noexcept;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
#include <ox/model/desctypes.hpp>
|
#include <ox/model/desctypes.hpp>
|
||||||
#include <ox/std/buffer.hpp>
|
#include <ox/std/buffer.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
|
|
||||||
#include <keel/context.hpp>
|
#include <keel/context.hpp>
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
#include <nostalgia/core/context.hpp>
|
#include <nostalgia/core/context.hpp>
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ int getScreenHeight(Context*) noexcept {
|
|||||||
return 160;
|
return 160;
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Size getScreenSize(Context*) noexcept {
|
ox::Size getScreenSize(Context*) noexcept {
|
||||||
return {240, 160};
|
return {240, 160};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/array.hpp>
|
#include <ox/std/array.hpp>
|
||||||
|
#include <ox/std/point.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
#include "color.hpp"
|
#include "color.hpp"
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
#include "ptidxconv.hpp"
|
#include "ptidxconv.hpp"
|
||||||
@ -18,12 +17,6 @@
|
|||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
|
|
||||||
namespace gl {
|
|
||||||
|
|
||||||
void setMainViewEnabled(bool) noexcept;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extern ox::Array<char, 128> charMap;
|
extern ox::Array<char, 128> charMap;
|
||||||
|
|
||||||
class Drawer {
|
class Drawer {
|
||||||
@ -75,7 +68,7 @@ int getScreenWidth(Context *ctx) noexcept;
|
|||||||
int getScreenHeight(Context *ctx) noexcept;
|
int getScreenHeight(Context *ctx) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
geo::Size getScreenSize(Context *ctx) noexcept;
|
ox::Size getScreenSize(Context *ctx) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
uint8_t bgStatus(Context *ctx) noexcept;
|
uint8_t bgStatus(Context *ctx) noexcept;
|
||||||
|
@ -2,12 +2,10 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glad/glad.h>
|
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
#include <keel/keel.hpp>
|
#include <keel/keel.hpp>
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/core/input.hpp>
|
|
||||||
#include <nostalgia/core/opengl/gfx.hpp>
|
#include <nostalgia/core/opengl/gfx.hpp>
|
||||||
|
|
||||||
#include "core.hpp"
|
#include "core.hpp"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
@ -246,7 +246,7 @@ int getScreenHeight(Context *ctx) noexcept {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Size getScreenSize(Context *ctx) noexcept {
|
ox::Size getScreenSize(Context *ctx) noexcept {
|
||||||
auto id = ctx->windowerData<GlfwImplData>();
|
auto id = ctx->windowerData<GlfwImplData>();
|
||||||
int w = 0, h = 0;
|
int w = 0, h = 0;
|
||||||
glfwGetFramebufferSize(id->window, &w, &h);
|
glfwGetFramebufferSize(id->window, &w, &h);
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <imgui_impl_opengl3.h>
|
#include <imgui_impl_opengl3.h>
|
||||||
|
|
||||||
#include <ox/std/array.hpp>
|
#include <ox/std/array.hpp>
|
||||||
#include <ox/std/fmt.hpp>
|
#include <ox/std/fmt.hpp>
|
||||||
|
#include <ox/std/vec.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/glutils/glutils.hpp>
|
#include <nostalgia/glutils/glutils.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/context.hpp>
|
#include <nostalgia/core/context.hpp>
|
||||||
@ -18,16 +18,6 @@ namespace nostalgia::core {
|
|||||||
|
|
||||||
void ImGui_Impl_NewFrame() noexcept;
|
void ImGui_Impl_NewFrame() noexcept;
|
||||||
|
|
||||||
namespace gl {
|
|
||||||
|
|
||||||
static bool mainViewEnabled = true;
|
|
||||||
|
|
||||||
void setMainViewEnabled(bool enabled) noexcept {
|
|
||||||
mainViewEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace renderer {
|
namespace renderer {
|
||||||
|
|
||||||
constexpr uint64_t TileRows = 128;
|
constexpr uint64_t TileRows = 128;
|
||||||
@ -73,11 +63,12 @@ struct GlImplData {
|
|||||||
glutils::GLProgram spriteShader;
|
glutils::GLProgram spriteShader;
|
||||||
int64_t prevFpsCheckTime = 0;
|
int64_t prevFpsCheckTime = 0;
|
||||||
uint64_t draws = 0;
|
uint64_t draws = 0;
|
||||||
|
bool mainViewEnabled = true;
|
||||||
ox::Array<CBB, 4> cbbs;
|
ox::Array<CBB, 4> cbbs;
|
||||||
SpriteBlockset spriteBlocks;
|
SpriteBlockset spriteBlocks;
|
||||||
ox::Array<Sprite, 128> spriteStates;
|
ox::Array<Sprite, 128> spriteStates;
|
||||||
ox::Array<Background, 4> backgrounds;
|
ox::Array<Background, 4> backgrounds;
|
||||||
ox::Optional<geo::Size> renderSize;
|
ox::Optional<ox::Size> renderSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr ox::StringView bgvshadTmpl = R"(
|
constexpr ox::StringView bgvshadTmpl = R"(
|
||||||
@ -448,7 +439,7 @@ void draw(Context *ctx) noexcept {
|
|||||||
glClearColor(0, 0, 0, 1);
|
glClearColor(0, 0, 0, 1);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
// render
|
// render
|
||||||
if (gl::mainViewEnabled) {
|
if (id->mainViewEnabled) {
|
||||||
gl::drawMainView(ctx);
|
gl::drawMainView(ctx);
|
||||||
}
|
}
|
||||||
for (const auto cd : ctx->drawers) {
|
for (const auto cd : ctx->drawers) {
|
||||||
@ -487,7 +478,7 @@ void setSprite(Context *ctx,
|
|||||||
//oxTracef("nostalgia::core::gfx::gl", "setSprite(ctx, {}, {}, {}, {}, {}, {}, {})",
|
//oxTracef("nostalgia::core::gfx::gl", "setSprite(ctx, {}, {}, {}, {}, {}, {}, {})",
|
||||||
// idx, x, y, tileIdx, spriteShape, spriteSize, flipX);
|
// idx, x, y, tileIdx, spriteShape, spriteSize, flipX);
|
||||||
// Tonc Table 8.4
|
// Tonc Table 8.4
|
||||||
static constexpr ox::Array<geo::Vec<unsigned>, 12> dimensions{
|
static constexpr ox::Array<ox::Vec<unsigned>, 12> dimensions{
|
||||||
// col 0
|
// col 0
|
||||||
{1, 1}, // 0, 0
|
{1, 1}, // 0, 0
|
||||||
{2, 2}, // 0, 1
|
{2, 2}, // 0, 1
|
||||||
@ -557,6 +548,11 @@ void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) no
|
|||||||
|
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
|
||||||
|
void setMainViewEnabled(core::Context *ctx, bool enabled) noexcept {
|
||||||
|
const auto id = ctx->rendererData<renderer::GlImplData>();
|
||||||
|
id->mainViewEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
void drawMainView(core::Context *ctx) noexcept {
|
void drawMainView(core::Context *ctx) noexcept {
|
||||||
const auto id = ctx->rendererData<renderer::GlImplData>();
|
const auto id = ctx->rendererData<renderer::GlImplData>();
|
||||||
renderer::drawBackgrounds(ctx, id);
|
renderer::drawBackgrounds(ctx, id);
|
||||||
@ -575,7 +571,7 @@ void clearRenderSize(core::Context *ctx) noexcept {
|
|||||||
id->renderSize.reset();
|
id->renderSize.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Size getRenderSize(core::Context *ctx) noexcept {
|
ox::Size getRenderSize(core::Context *ctx) noexcept {
|
||||||
const auto id = ctx->rendererData<renderer::GlImplData>();
|
const auto id = ctx->rendererData<renderer::GlImplData>();
|
||||||
if (id->renderSize.has_value()) {
|
if (id->renderSize.has_value()) {
|
||||||
return id->renderSize.value();
|
return id->renderSize.value();
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/array.hpp>
|
#include <ox/std/array.hpp>
|
||||||
|
#include <ox/std/point.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
#include "color.hpp"
|
#include "color.hpp"
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nostalgia/geo/point.hpp>
|
#include <ox/std/point.hpp>
|
||||||
|
|
||||||
#include "consts.hpp"
|
#include "consts.hpp"
|
||||||
|
|
||||||
@ -22,12 +22,12 @@ constexpr std::size_t ptToIdx(int x, int y, int c) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr std::size_t ptToIdx(const geo::Point &pt, int c) noexcept {
|
constexpr std::size_t ptToIdx(const ox::Point &pt, int c) noexcept {
|
||||||
return ptToIdx(pt.x, pt.y, c * TileWidth);
|
return ptToIdx(pt.x, pt.y, c * TileWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr geo::Point idxToPt(int i, int c) noexcept {
|
constexpr ox::Point idxToPt(int i, int c) noexcept {
|
||||||
// prevent divide by zeros
|
// prevent divide by zeros
|
||||||
if (!c) {
|
if (!c) {
|
||||||
++c;
|
++c;
|
||||||
@ -44,13 +44,13 @@ constexpr geo::Point idxToPt(int i, int c) noexcept {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static_assert(idxToPt(4, 1) == geo::Point{4, 0});
|
static_assert(idxToPt(4, 1) == ox::Point{4, 0});
|
||||||
static_assert(idxToPt(8, 1) == geo::Point{0, 1});
|
static_assert(idxToPt(8, 1) == ox::Point{0, 1});
|
||||||
static_assert(idxToPt(8, 2) == geo::Point{0, 1});
|
static_assert(idxToPt(8, 2) == ox::Point{0, 1});
|
||||||
static_assert(idxToPt(64, 2) == geo::Point{8, 0});
|
static_assert(idxToPt(64, 2) == ox::Point{8, 0});
|
||||||
static_assert(idxToPt(128, 2) == geo::Point{0, 8});
|
static_assert(idxToPt(128, 2) == ox::Point{0, 8});
|
||||||
static_assert(idxToPt(129, 2) == geo::Point{1, 8});
|
static_assert(idxToPt(129, 2) == ox::Point{1, 8});
|
||||||
static_assert(idxToPt(192, 2) == geo::Point{8, 8});
|
static_assert(idxToPt(192, 2) == ox::Point{8, 8});
|
||||||
static_assert(idxToPt(384, 8) == geo::Point{48, 0});
|
static_assert(idxToPt(384, 8) == ox::Point{48, 0});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
#include <lodepng.h>
|
#include <lodepng.h>
|
||||||
|
|
||||||
|
#include <ox/std/point.hpp>
|
||||||
#include <keel/media.hpp>
|
#include <keel/media.hpp>
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
|
|
||||||
#include "tilesheeteditor-imgui.hpp"
|
#include "tilesheeteditor-imgui.hpp"
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ void TileSheetEditorImGui::keyStateChanged(core::Key key, bool down) {
|
|||||||
void TileSheetEditorImGui::draw(core::Context*) noexcept {
|
void TileSheetEditorImGui::draw(core::Context*) noexcept {
|
||||||
const auto paneSize = ImGui::GetContentRegionAvail();
|
const auto paneSize = ImGui::GetContentRegionAvail();
|
||||||
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
const auto tileSheetParentSize = ImVec2(paneSize.x - m_palViewWidth, paneSize.y);
|
||||||
const auto fbSize = geo::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);
|
const auto fbSize = ox::Vec2(tileSheetParentSize.x - 16, tileSheetParentSize.y - 16);
|
||||||
ImGui::BeginChild("TileSheetView", tileSheetParentSize, true);
|
ImGui::BeginChild("TileSheetView", tileSheetParentSize, true);
|
||||||
{
|
{
|
||||||
drawTileSheet(fbSize);
|
drawTileSheet(fbSize);
|
||||||
@ -240,7 +240,7 @@ studio::UndoStack *TileSheetEditorImGui::undoStack() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
geo::Vec2 TileSheetEditorImGui::clickPos(const ImVec2 &winPos, geo::Vec2 clickPos) noexcept {
|
ox::Vec2 TileSheetEditorImGui::clickPos(const ImVec2 &winPos, ox::Vec2 clickPos) noexcept {
|
||||||
clickPos.x -= winPos.x + 10;
|
clickPos.x -= winPos.x + 10;
|
||||||
clickPos.y -= winPos.y + 10;
|
clickPos.y -= winPos.y + 10;
|
||||||
return clickPos;
|
return clickPos;
|
||||||
@ -274,9 +274,9 @@ void TileSheetEditorImGui::exportSubhseetToPng() noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
void TileSheetEditorImGui::drawTileSheet(const ox::Vec2 &fbSize) noexcept {
|
||||||
const auto winPos = ImGui::GetWindowPos();
|
const auto winPos = ImGui::GetWindowPos();
|
||||||
const auto fbSizei = geo::Size(static_cast<int>(fbSize.x), static_cast<int>(fbSize.y));
|
const auto fbSizei = ox::Size(static_cast<int>(fbSize.x), static_cast<int>(fbSize.y));
|
||||||
if (m_framebuffer.width != fbSizei.width || m_framebuffer.height != fbSizei.height) {
|
if (m_framebuffer.width != fbSizei.width || m_framebuffer.height != fbSizei.height) {
|
||||||
glutils::resizeInitFrameBuffer(&m_framebuffer, fbSizei.width, fbSizei.height);
|
glutils::resizeInitFrameBuffer(&m_framebuffer, fbSizei.width, fbSizei.height);
|
||||||
m_tileSheetEditor.resizeView(fbSize);
|
m_tileSheetEditor.resizeView(fbSize);
|
||||||
@ -296,7 +296,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
|||||||
ImVec2(1, 0));
|
ImVec2(1, 0));
|
||||||
// handle input, this must come after drawing
|
// handle input, this must come after drawing
|
||||||
const auto &io = ImGui::GetIO();
|
const auto &io = ImGui::GetIO();
|
||||||
const auto mousePos = geo::Vec2(io.MousePos);
|
const auto mousePos = ox::Vec2(io.MousePos);
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
const auto wheel = io.MouseWheel;
|
const auto wheel = io.MouseWheel;
|
||||||
const auto wheelh = io.MouseWheelH;
|
const auto wheelh = io.MouseWheelH;
|
||||||
@ -326,7 +326,7 @@ void TileSheetEditorImGui::drawTileSheet(const geo::Vec2 &fbSize) noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::BeginPopupContextItem("TileMenu", ImGuiPopupFlags_MouseButtonRight)) {
|
if (ImGui::BeginPopupContextItem("TileMenu", ImGuiPopupFlags_MouseButtonRight)) {
|
||||||
const auto popupPos = geo::Vec2(ImGui::GetWindowPos());
|
const auto popupPos = ox::Vec2(ImGui::GetWindowPos());
|
||||||
if (ImGui::MenuItem("Insert Tile")) {
|
if (ImGui::MenuItem("Insert Tile")) {
|
||||||
m_tileSheetEditor.insertTile(fbSize, clickPos(winPos, popupPos));
|
m_tileSheetEditor.insertTile(fbSize, clickPos(winPos, popupPos));
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
|
#include <ox/std/vec.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/glutils/glutils.hpp>
|
#include <nostalgia/glutils/glutils.hpp>
|
||||||
#include <nostalgia/studio/studio.hpp>
|
#include <nostalgia/studio/studio.hpp>
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class TileSheetEditorImGui: public studio::BaseEditor {
|
|||||||
glutils::FrameBuffer m_framebuffer;
|
glutils::FrameBuffer m_framebuffer;
|
||||||
TileSheetEditorView m_tileSheetEditor;
|
TileSheetEditorView m_tileSheetEditor;
|
||||||
float m_palViewWidth = 300;
|
float m_palViewWidth = 300;
|
||||||
geo::Vec2 m_prevMouseDownPos;
|
ox::Vec2 m_prevMouseDownPos;
|
||||||
Tool m_tool = Tool::Draw;
|
Tool m_tool = Tool::Draw;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -80,7 +80,7 @@ class TileSheetEditorImGui: public studio::BaseEditor {
|
|||||||
studio::UndoStack *undoStack() noexcept final;
|
studio::UndoStack *undoStack() noexcept final;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static geo::Vec2 clickPos(const ImVec2 &winPos, geo::Vec2 clickPos) noexcept;
|
static ox::Vec2 clickPos(const ImVec2 &winPos, ox::Vec2 clickPos) noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ox::Error saveItem() noexcept override;
|
ox::Error saveItem() noexcept override;
|
||||||
@ -112,7 +112,7 @@ class TileSheetEditorImGui: public studio::BaseEditor {
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
ox::String palettePath(const ox::String &palettePath) const;
|
ox::String palettePath(const ox::String &palettePath) const;
|
||||||
|
|
||||||
void drawTileSheet(const geo::Vec2 &fbSize) noexcept;
|
void drawTileSheet(const ox::Vec2 &fbSize) noexcept;
|
||||||
|
|
||||||
void drawPaletteSelector() noexcept;
|
void drawPaletteSelector() noexcept;
|
||||||
|
|
||||||
|
@ -30,8 +30,8 @@ class TileSheetClipboard: public ClipboardObject<TileSheetClipboard> {
|
|||||||
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.studio.TileSheetClipboard.Pixel";
|
static constexpr auto TypeName = "net.drinkingtea.nostalgia.core.studio.TileSheetClipboard.Pixel";
|
||||||
static constexpr auto TypeVersion = 1;
|
static constexpr auto TypeVersion = 1;
|
||||||
uint16_t colorIdx = 0;
|
uint16_t colorIdx = 0;
|
||||||
geo::Point pt;
|
ox::Point pt;
|
||||||
constexpr Pixel(uint16_t pColorIdx, geo::Point pPt) noexcept {
|
constexpr Pixel(uint16_t pColorIdx, ox::Point pPt) noexcept {
|
||||||
colorIdx = pColorIdx;
|
colorIdx = pColorIdx;
|
||||||
pt = pPt;
|
pt = pPt;
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ class TileSheetClipboard: public ClipboardObject<TileSheetClipboard> {
|
|||||||
ox::Vector<Pixel> m_pixels;
|
ox::Vector<Pixel> m_pixels;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr void addPixel(const geo::Point &pt, uint16_t colorIdx) noexcept {
|
constexpr void addPixel(const ox::Point &pt, uint16_t colorIdx) noexcept {
|
||||||
m_pixels.emplace_back(colorIdx, pt);
|
m_pixels.emplace_back(colorIdx, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ class CutPasteCommand: public TileSheetCommand {
|
|||||||
ox::Vector<Change> m_changes;
|
ox::Vector<Change> m_changes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
constexpr CutPasteCommand(TileSheet *img, const TileSheet::SubSheetIdx &subSheetIdx, const geo::Point &dstStart, const geo::Point &dstEnd, const TileSheetClipboard &cb) noexcept {
|
constexpr CutPasteCommand(TileSheet *img, const TileSheet::SubSheetIdx &subSheetIdx, const ox::Point &dstStart, const ox::Point &dstEnd, const TileSheetClipboard &cb) noexcept {
|
||||||
m_img = img;
|
m_img = img;
|
||||||
m_subSheetIdx = subSheetIdx;
|
m_subSheetIdx = subSheetIdx;
|
||||||
const auto &subsheet = m_img->getSubSheet(subSheetIdx);
|
const auto &subsheet = m_img->getSubSheet(subSheetIdx);
|
||||||
@ -553,7 +553,7 @@ void TileSheetEditorModel::cut() {
|
|||||||
const auto s = activeSubSheet();
|
const auto s = activeSubSheet();
|
||||||
for (int y = m_selectionBounds.y; y <= m_selectionBounds.y2(); ++y) {
|
for (int y = m_selectionBounds.y; y <= m_selectionBounds.y2(); ++y) {
|
||||||
for (int x = m_selectionBounds.x; x <= m_selectionBounds.x2(); ++x) {
|
for (int x = m_selectionBounds.x; x <= m_selectionBounds.x2(); ++x) {
|
||||||
auto pt = geo::Point(x, y);
|
auto pt = ox::Point(x, y);
|
||||||
const auto idx = s->idx(pt);
|
const auto idx = s->idx(pt);
|
||||||
const auto c = s->getPixel(m_img.bpp, idx);
|
const auto c = s->getPixel(m_img.bpp, idx);
|
||||||
pt.x -= m_selectionBounds.x;
|
pt.x -= m_selectionBounds.x;
|
||||||
@ -562,8 +562,8 @@ void TileSheetEditorModel::cut() {
|
|||||||
blankCb.addPixel(pt, 0);
|
blankCb.addPixel(pt, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin;
|
const auto pt1 = m_selectionOrigin == ox::Point(-1, -1) ? ox::Point(0, 0) : m_selectionOrigin;
|
||||||
const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight);
|
const auto pt2 = ox::Point(s->columns * TileWidth, s->rows * TileHeight);
|
||||||
setClipboardObject(m_ctx, std::move(cb));
|
setClipboardObject(m_ctx, std::move(cb));
|
||||||
pushCommand(ox::make<CutPasteCommand<CommandId::Cut>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
pushCommand(ox::make<CutPasteCommand<CommandId::Cut>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, blankCb));
|
||||||
}
|
}
|
||||||
@ -572,7 +572,7 @@ void TileSheetEditorModel::copy() {
|
|||||||
auto cb = ox::make_unique<TileSheetClipboard>();
|
auto cb = ox::make_unique<TileSheetClipboard>();
|
||||||
for (int y = m_selectionBounds.y; y <= m_selectionBounds.y2(); ++y) {
|
for (int y = m_selectionBounds.y; y <= m_selectionBounds.y2(); ++y) {
|
||||||
for (int x = m_selectionBounds.x; x <= m_selectionBounds.x2(); ++x) {
|
for (int x = m_selectionBounds.x; x <= m_selectionBounds.x2(); ++x) {
|
||||||
auto pt = geo::Point(x, y);
|
auto pt = ox::Point(x, y);
|
||||||
const auto s = activeSubSheet();
|
const auto s = activeSubSheet();
|
||||||
const auto idx = s->idx(pt);
|
const auto idx = s->idx(pt);
|
||||||
const auto c = s->getPixel(m_img.bpp, idx);
|
const auto c = s->getPixel(m_img.bpp, idx);
|
||||||
@ -592,8 +592,8 @@ void TileSheetEditorModel::paste() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto s = activeSubSheet();
|
const auto s = activeSubSheet();
|
||||||
const auto pt1 = m_selectionOrigin == geo::Point(-1, -1) ? geo::Point(0, 0) : m_selectionOrigin;
|
const auto pt1 = m_selectionOrigin == ox::Point(-1, -1) ? ox::Point(0, 0) : m_selectionOrigin;
|
||||||
const auto pt2 = geo::Point(s->columns * TileWidth, s->rows * TileHeight);
|
const auto pt2 = ox::Point(s->columns * TileWidth, s->rows * TileHeight);
|
||||||
pushCommand(ox::make<CutPasteCommand<CommandId::Paste>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
pushCommand(ox::make<CutPasteCommand<CommandId::Paste>>(&m_img, m_activeSubsSheetIdx, pt1, pt2, *cb));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,7 +621,7 @@ ox::Error TileSheetEditorModel::setPalette(const ox::String &path) noexcept {
|
|||||||
return OxError(0);
|
return OxError(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::drawCommand(const geo::Point &pt, std::size_t palIdx) noexcept {
|
void TileSheetEditorModel::drawCommand(const ox::Point &pt, std::size_t palIdx) noexcept {
|
||||||
const auto &activeSubSheet = m_img.getSubSheet(m_activeSubsSheetIdx);
|
const auto &activeSubSheet = m_img.getSubSheet(m_activeSubsSheetIdx);
|
||||||
if (pt.x >= activeSubSheet.columns * TileWidth || pt.y >= activeSubSheet.rows * TileHeight) {
|
if (pt.x >= activeSubSheet.columns * TileWidth || pt.y >= activeSubSheet.rows * TileHeight) {
|
||||||
return;
|
return;
|
||||||
@ -664,7 +664,7 @@ void TileSheetEditorModel::setActiveSubsheet(const TileSheet::SubSheetIdx &idx)
|
|||||||
this->activeSubsheetChanged.emit(m_activeSubsSheetIdx);
|
this->activeSubsheetChanged.emit(m_activeSubsSheetIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::fill(const geo::Point &pt, int palIdx) noexcept {
|
void TileSheetEditorModel::fill(const ox::Point &pt, int palIdx) noexcept {
|
||||||
const auto &s = m_img.getSubSheet(m_activeSubsSheetIdx);
|
const auto &s = m_img.getSubSheet(m_activeSubsSheetIdx);
|
||||||
// build idx list
|
// build idx list
|
||||||
ox::Array<bool, PixelsPerTile> updateMap = {};
|
ox::Array<bool, PixelsPerTile> updateMap = {};
|
||||||
@ -689,7 +689,7 @@ void TileSheetEditorModel::fill(const geo::Point &pt, int palIdx) noexcept {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::select(const geo::Point &pt) noexcept {
|
void TileSheetEditorModel::select(const ox::Point &pt) noexcept {
|
||||||
if (!m_selectionOngoing) {
|
if (!m_selectionOngoing) {
|
||||||
m_selectionOrigin = pt;
|
m_selectionOrigin = pt;
|
||||||
m_selectionOngoing = true;
|
m_selectionOngoing = true;
|
||||||
@ -755,16 +755,16 @@ bool TileSheetEditorModel::pixelSelected(std::size_t idx) const noexcept {
|
|||||||
return m_selectionBounds.contains(pt);
|
return m_selectionBounds.contains(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorModel::getFillPixels(bool *pixels, const geo::Point &pt, int oldColor) const noexcept {
|
void TileSheetEditorModel::getFillPixels(bool *pixels, const ox::Point &pt, int oldColor) const noexcept {
|
||||||
const auto &activeSubSheet = *this->activeSubSheet();
|
const auto &activeSubSheet = *this->activeSubSheet();
|
||||||
const auto tileIdx = [activeSubSheet](const geo::Point &pt) noexcept {
|
const auto tileIdx = [activeSubSheet](const ox::Point &pt) noexcept {
|
||||||
return ptToIdx(pt, activeSubSheet.columns) / PixelsPerTile;
|
return ptToIdx(pt, activeSubSheet.columns) / PixelsPerTile;
|
||||||
};
|
};
|
||||||
// get points
|
// get points
|
||||||
const auto leftPt = pt + geo::Point(-1, 0);
|
const auto leftPt = pt + ox::Point(-1, 0);
|
||||||
const auto rightPt = pt + geo::Point(1, 0);
|
const auto rightPt = pt + ox::Point(1, 0);
|
||||||
const auto topPt = pt + geo::Point(0, -1);
|
const auto topPt = pt + ox::Point(0, -1);
|
||||||
const auto bottomPt = pt + geo::Point(0, 1);
|
const auto bottomPt = pt + ox::Point(0, 1);
|
||||||
// calculate indices
|
// calculate indices
|
||||||
const auto idx = ptToIdx(pt, activeSubSheet.columns);
|
const auto idx = ptToIdx(pt, activeSubSheet.columns);
|
||||||
const auto leftIdx = ptToIdx(leftPt, activeSubSheet.columns);
|
const auto leftIdx = ptToIdx(leftPt, activeSubSheet.columns);
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/bounds.hpp>
|
||||||
|
#include <ox/std/point.hpp>
|
||||||
#include <ox/std/trace.hpp>
|
#include <ox/std/trace.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/geo/bounds.hpp>
|
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
#include <nostalgia/studio/studio.hpp>
|
#include <nostalgia/studio/studio.hpp>
|
||||||
|
|
||||||
namespace nostalgia::core {
|
namespace nostalgia::core {
|
||||||
@ -30,8 +30,8 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
Context *m_ctx = nullptr;
|
Context *m_ctx = nullptr;
|
||||||
ox::String m_path;
|
ox::String m_path;
|
||||||
bool m_selectionOngoing = false;
|
bool m_selectionOngoing = false;
|
||||||
geo::Point m_selectionOrigin = {-1, -1};
|
ox::Point m_selectionOrigin = {-1, -1};
|
||||||
geo::Bounds m_selectionBounds = {{-1, -1}, {-1, -1}};
|
ox::Bounds m_selectionBounds = {{-1, -1}, {-1, -1}};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TileSheetEditorModel(Context *ctx, ox::String path);
|
TileSheetEditorModel(Context *ctx, ox::String path);
|
||||||
@ -58,7 +58,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
|
|
||||||
ox::Error setPalette(const ox::String &path) noexcept;
|
ox::Error setPalette(const ox::String &path) noexcept;
|
||||||
|
|
||||||
void drawCommand(const geo::Point &pt, std::size_t palIdx) noexcept;
|
void drawCommand(const ox::Point &pt, std::size_t palIdx) noexcept;
|
||||||
|
|
||||||
void endDrawCommand() noexcept;
|
void endDrawCommand() noexcept;
|
||||||
|
|
||||||
@ -91,9 +91,9 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
return m_activeSubsSheetIdx;
|
return m_activeSubsSheetIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fill(const geo::Point &pt, int palIdx) noexcept;
|
void fill(const ox::Point &pt, int palIdx) noexcept;
|
||||||
|
|
||||||
void select(const geo::Point &pt) noexcept;
|
void select(const ox::Point &pt) noexcept;
|
||||||
|
|
||||||
void completeSelection() noexcept;
|
void completeSelection() noexcept;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ class TileSheetEditorModel: public ox::SignalHandler {
|
|||||||
bool pixelSelected(std::size_t idx) const noexcept;
|
bool pixelSelected(std::size_t idx) const noexcept;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void getFillPixels(bool *pixels, const geo::Point &pt, int oldColor) const noexcept;
|
void getFillPixels(bool *pixels, const ox::Point &pt, int oldColor) const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void pushCommand(studio::UndoCommand *cmd) noexcept;
|
void pushCommand(studio::UndoCommand *cmd) noexcept;
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nostalgia/core/consts.hpp>
|
#include <ox/std/point.hpp>
|
||||||
#include <keel/media.hpp>
|
#include <keel/media.hpp>
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
|
#include <nostalgia/core/consts.hpp>
|
||||||
|
|
||||||
#include "tilesheeteditorview.hpp"
|
#include "tilesheeteditorview.hpp"
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ void TileSheetEditorView::draw() noexcept {
|
|||||||
m_pixelGridDrawer.draw(updated(), m_scrollOffset);
|
m_pixelGridDrawer.draw(updated(), m_scrollOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::scrollV(const geo::Vec2 &paneSz, float wheel, bool zoomMod) noexcept {
|
void TileSheetEditorView::scrollV(const ox::Vec2 &paneSz, float wheel, bool zoomMod) noexcept {
|
||||||
const auto pixelSize = m_pixelsDrawer.pixelSize(paneSz);
|
const auto pixelSize = m_pixelsDrawer.pixelSize(paneSz);
|
||||||
const ImVec2 sheetSize(pixelSize.x * static_cast<float>(m_model.activeSubSheet()->columns) * TileWidth,
|
const ImVec2 sheetSize(pixelSize.x * static_cast<float>(m_model.activeSubSheet()->columns) * TileWidth,
|
||||||
pixelSize.y * static_cast<float>(m_model.activeSubSheet()->rows) * TileHeight);
|
pixelSize.y * static_cast<float>(m_model.activeSubSheet()->rows) * TileHeight);
|
||||||
@ -42,7 +43,7 @@ void TileSheetEditorView::scrollV(const geo::Vec2 &paneSz, float wheel, bool zoo
|
|||||||
m_scrollOffset.y = ox::clamp(m_scrollOffset.y, 0.f, sheetSize.y / 2);
|
m_scrollOffset.y = ox::clamp(m_scrollOffset.y, 0.f, sheetSize.y / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::scrollH(const geo::Vec2 &paneSz, float wheelh) noexcept {
|
void TileSheetEditorView::scrollH(const ox::Vec2 &paneSz, float wheelh) noexcept {
|
||||||
const auto pixelSize = m_pixelsDrawer.pixelSize(paneSz);
|
const auto pixelSize = m_pixelsDrawer.pixelSize(paneSz);
|
||||||
const ImVec2 sheetSize(pixelSize.x * static_cast<float>(m_model.activeSubSheet()->columns) * TileWidth,
|
const ImVec2 sheetSize(pixelSize.x * static_cast<float>(m_model.activeSubSheet()->columns) * TileWidth,
|
||||||
pixelSize.y * static_cast<float>(m_model.activeSubSheet()->rows) * TileHeight);
|
pixelSize.y * static_cast<float>(m_model.activeSubSheet()->rows) * TileHeight);
|
||||||
@ -50,31 +51,31 @@ void TileSheetEditorView::scrollH(const geo::Vec2 &paneSz, float wheelh) noexcep
|
|||||||
m_scrollOffset.x = ox::clamp(m_scrollOffset.x, -(sheetSize.x / 2), 0.f);
|
m_scrollOffset.x = ox::clamp(m_scrollOffset.x, -(sheetSize.x / 2), 0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::insertTile(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept {
|
void TileSheetEditorView::insertTile(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept {
|
||||||
const auto pt = clickPoint(paneSize, clickPos);
|
const auto pt = clickPoint(paneSize, clickPos);
|
||||||
const auto s = m_model.activeSubSheet();
|
const auto s = m_model.activeSubSheet();
|
||||||
const auto tileIdx = ptToIdx(pt, s->columns) / PixelsPerTile;
|
const auto tileIdx = ptToIdx(pt, s->columns) / PixelsPerTile;
|
||||||
m_model.insertTiles(m_model.activeSubSheetIdx(), tileIdx, 1);
|
m_model.insertTiles(m_model.activeSubSheetIdx(), tileIdx, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::deleteTile(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept {
|
void TileSheetEditorView::deleteTile(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept {
|
||||||
const auto pt = clickPoint(paneSize, clickPos);
|
const auto pt = clickPoint(paneSize, clickPos);
|
||||||
const auto s = m_model.activeSubSheet();
|
const auto s = m_model.activeSubSheet();
|
||||||
const auto tileIdx = ptToIdx(pt, s->columns) / PixelsPerTile;
|
const auto tileIdx = ptToIdx(pt, s->columns) / PixelsPerTile;
|
||||||
m_model.deleteTiles(m_model.activeSubSheetIdx(), tileIdx, 1);
|
m_model.deleteTiles(m_model.activeSubSheetIdx(), tileIdx, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::clickDraw(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept {
|
void TileSheetEditorView::clickDraw(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept {
|
||||||
const auto pt = clickPoint(paneSize, clickPos);
|
const auto pt = clickPoint(paneSize, clickPos);
|
||||||
m_model.drawCommand(pt, m_palIdx);
|
m_model.drawCommand(pt, m_palIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::clickSelect(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept {
|
void TileSheetEditorView::clickSelect(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept {
|
||||||
const auto pt = clickPoint(paneSize, clickPos);
|
const auto pt = clickPoint(paneSize, clickPos);
|
||||||
m_model.select(pt);
|
m_model.select(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::clickFill(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept {
|
void TileSheetEditorView::clickFill(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept {
|
||||||
const auto pt = clickPoint(paneSize, clickPos);
|
const auto pt = clickPoint(paneSize, clickPos);
|
||||||
m_model.fill(pt, static_cast<int>(m_palIdx));
|
m_model.fill(pt, static_cast<int>(m_palIdx));
|
||||||
}
|
}
|
||||||
@ -84,7 +85,7 @@ void TileSheetEditorView::releaseMouseButton() noexcept {
|
|||||||
m_model.completeSelection();
|
m_model.completeSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetEditorView::resizeView(const geo::Vec2 &sz) noexcept {
|
void TileSheetEditorView::resizeView(const ox::Vec2 &sz) noexcept {
|
||||||
m_viewSize = sz;
|
m_viewSize = sz;
|
||||||
initView();
|
initView();
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ void TileSheetEditorView::initView() noexcept {
|
|||||||
m_pixelGridDrawer.initBufferSet(m_viewSize, *m_model.activeSubSheet());
|
m_pixelGridDrawer.initBufferSet(m_viewSize, *m_model.activeSubSheet());
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Point TileSheetEditorView::clickPoint(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) const noexcept {
|
ox::Point TileSheetEditorView::clickPoint(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) const noexcept {
|
||||||
auto [x, y] = clickPos;
|
auto [x, y] = clickPos;
|
||||||
const auto pixDrawSz = m_pixelsDrawer.pixelSize(paneSize);
|
const auto pixDrawSz = m_pixelsDrawer.pixelSize(paneSize);
|
||||||
x /= paneSize.x;
|
x /= paneSize.x;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/vec.hpp>
|
||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/glutils/glutils.hpp>
|
#include <nostalgia/glutils/glutils.hpp>
|
||||||
#include <nostalgia/studio/studio.hpp>
|
#include <nostalgia/studio/studio.hpp>
|
||||||
|
|
||||||
@ -42,10 +42,10 @@ class TileSheetEditorView: public ox::SignalHandler {
|
|||||||
TileSheetEditorModel m_model;
|
TileSheetEditorModel m_model;
|
||||||
TileSheetGrid m_pixelGridDrawer;
|
TileSheetGrid m_pixelGridDrawer;
|
||||||
TileSheetPixels m_pixelsDrawer;
|
TileSheetPixels m_pixelsDrawer;
|
||||||
geo::Vec2 m_viewSize;
|
ox::Vec2 m_viewSize;
|
||||||
float m_pixelSizeMod = 1;
|
float m_pixelSizeMod = 1;
|
||||||
bool m_updated = false;
|
bool m_updated = false;
|
||||||
geo::Vec2 m_scrollOffset;
|
ox::Vec2 m_scrollOffset;
|
||||||
std::size_t m_palIdx = 0;
|
std::size_t m_palIdx = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -55,23 +55,23 @@ class TileSheetEditorView: public ox::SignalHandler {
|
|||||||
|
|
||||||
void draw() noexcept;
|
void draw() noexcept;
|
||||||
|
|
||||||
void insertTile(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept;
|
void insertTile(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept;
|
||||||
|
|
||||||
void deleteTile(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept;
|
void deleteTile(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept;
|
||||||
|
|
||||||
void clickDraw(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept;
|
void clickDraw(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept;
|
||||||
|
|
||||||
void clickSelect(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept;
|
void clickSelect(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept;
|
||||||
|
|
||||||
void clickFill(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) noexcept;
|
void clickFill(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) noexcept;
|
||||||
|
|
||||||
void releaseMouseButton() noexcept;
|
void releaseMouseButton() noexcept;
|
||||||
|
|
||||||
void scrollV(const geo::Vec2 &paneSz, float wheel, bool zoomMod) noexcept;
|
void scrollV(const ox::Vec2 &paneSz, float wheel, bool zoomMod) noexcept;
|
||||||
|
|
||||||
void scrollH(const geo::Vec2 &paneSz, float wheel) noexcept;
|
void scrollH(const ox::Vec2 &paneSz, float wheel) noexcept;
|
||||||
|
|
||||||
void resizeView(const geo::Vec2 &sz) noexcept;
|
void resizeView(const ox::Vec2 &sz) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr const TileSheet &img() const noexcept;
|
constexpr const TileSheet &img() const noexcept;
|
||||||
@ -111,7 +111,7 @@ class TileSheetEditorView: public ox::SignalHandler {
|
|||||||
private:
|
private:
|
||||||
void initView() noexcept;
|
void initView() noexcept;
|
||||||
|
|
||||||
geo::Point clickPoint(const geo::Vec2 &paneSize, const geo::Vec2 &clickPos) const noexcept;
|
ox::Point clickPoint(const ox::Vec2 &paneSize, const ox::Vec2 &clickPos) const noexcept;
|
||||||
|
|
||||||
ox::Error setActiveSubsheet(const TileSheet::SubSheetIdx &idx) noexcept;
|
ox::Error setActiveSubsheet(const TileSheet::SubSheetIdx &idx) noexcept;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nostalgia/core/consts.hpp>
|
#include <nostalgia/core/consts.hpp>
|
||||||
@ -18,7 +18,7 @@ ox::Error TileSheetGrid::buildShader() noexcept {
|
|||||||
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
|
return glutils::buildShaderProgram(pixelLineVshad, pixelLineFshad, pixelLineGshad).moveTo(&m_shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetGrid::draw(bool update, const geo::Vec2 &scroll) noexcept {
|
void TileSheetGrid::draw(bool update, const ox::Vec2 &scroll) noexcept {
|
||||||
glLineWidth(3 * m_pixelSizeMod * 0.5f);
|
glLineWidth(3 * m_pixelSizeMod * 0.5f);
|
||||||
glUseProgram(m_shader);
|
glUseProgram(m_shader);
|
||||||
glBindVertexArray(m_bufferSet.vao);
|
glBindVertexArray(m_bufferSet.vao);
|
||||||
@ -32,7 +32,7 @@ void TileSheetGrid::draw(bool update, const geo::Vec2 &scroll) noexcept {
|
|||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetGrid::initBufferSet(const geo::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept {
|
void TileSheetGrid::initBufferSet(const ox::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept {
|
||||||
// vao
|
// vao
|
||||||
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
||||||
glBindVertexArray(m_bufferSet.vao);
|
glBindVertexArray(m_bufferSet.vao);
|
||||||
@ -54,7 +54,7 @@ void TileSheetGrid::initBufferSet(const geo::Vec2 &paneSize, const TileSheet::Su
|
|||||||
reinterpret_cast<void*>(4 * sizeof(float)));
|
reinterpret_cast<void*>(4 * sizeof(float)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetGrid::setBufferObject(geo::Point pt1, geo::Point pt2, Color32 c, float *vbo, const geo::Vec2 &pixSize) noexcept {
|
void TileSheetGrid::setBufferObject(ox::Point pt1, ox::Point pt2, Color32 c, float *vbo, const ox::Vec2 &pixSize) noexcept {
|
||||||
const auto x1 = static_cast<float>(pt1.x) * pixSize.x - 1.f;
|
const auto x1 = static_cast<float>(pt1.x) * pixSize.x - 1.f;
|
||||||
const auto y1 = 1.f - static_cast<float>(pt1.y) * pixSize.y;
|
const auto y1 = 1.f - static_cast<float>(pt1.y) * pixSize.y;
|
||||||
const auto x2 = static_cast<float>(pt2.x) * pixSize.x - 1.f;
|
const auto x2 = static_cast<float>(pt2.x) * pixSize.x - 1.f;
|
||||||
@ -64,9 +64,9 @@ void TileSheetGrid::setBufferObject(geo::Point pt1, geo::Point pt2, Color32 c, f
|
|||||||
memcpy(vbo, vertices, sizeof(vertices));
|
memcpy(vbo, vertices, sizeof(vertices));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetGrid::setBufferObjects(const geo::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept {
|
void TileSheetGrid::setBufferObjects(const ox::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept {
|
||||||
const auto pixSize = pixelSize(paneSize);
|
const auto pixSize = pixelSize(paneSize);
|
||||||
const auto set = [&](unsigned i, geo::Point pt1, geo::Point pt2, Color32 c) {
|
const auto set = [&](unsigned i, ox::Point pt1, ox::Point pt2, Color32 c) {
|
||||||
const auto vbo = &m_bufferSet.vertices[i * VertexVboLength];
|
const auto vbo = &m_bufferSet.vertices[i * VertexVboLength];
|
||||||
setBufferObject(pt1, pt2, c, vbo, pixSize);
|
setBufferObject(pt1, pt2, c, vbo, pixSize);
|
||||||
};
|
};
|
||||||
@ -100,7 +100,7 @@ void TileSheetGrid::setBufferObjects(const geo::Vec2 &paneSize, const TileSheet:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Vec2 TileSheetGrid::pixelSize(const geo::Vec2 &paneSize) const noexcept {
|
ox::Vec2 TileSheetGrid::pixelSize(const ox::Vec2 &paneSize) const noexcept {
|
||||||
const auto [sw, sh] = paneSize;
|
const auto [sw, sh] = paneSize;
|
||||||
constexpr float ymod = 0.35f / 10.0f;
|
constexpr float ymod = 0.35f / 10.0f;
|
||||||
const auto xmod = ymod * sh / sw;
|
const auto xmod = ymod * sh / sw;
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/glutils/glutils.hpp>
|
#include <nostalgia/glutils/glutils.hpp>
|
||||||
#include <nostalgia/studio/studio.hpp>
|
#include <nostalgia/studio/studio.hpp>
|
||||||
|
|
||||||
@ -67,17 +65,17 @@ class TileSheetGrid {
|
|||||||
|
|
||||||
ox::Error buildShader() noexcept;
|
ox::Error buildShader() noexcept;
|
||||||
|
|
||||||
void draw(bool update, const geo::Vec2 &scroll) noexcept;
|
void draw(bool update, const ox::Vec2 &scroll) noexcept;
|
||||||
|
|
||||||
void initBufferSet(const geo::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept;
|
void initBufferSet(const ox::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setBufferObject(geo::Point pt1, geo::Point pt2, Color32 c, float *vbo, const geo::Vec2 &pixSize) noexcept;
|
static void setBufferObject(ox::Point pt1, ox::Point pt2, Color32 c, float *vbo, const ox::Vec2 &pixSize) noexcept;
|
||||||
|
|
||||||
void setBufferObjects(const geo::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept;
|
void setBufferObjects(const ox::Vec2 &paneSize, const TileSheet::SubSheet &subsheet) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
geo::Vec2 pixelSize(const geo::Vec2 &paneSize) const noexcept;
|
ox::Vec2 pixelSize(const ox::Vec2 &paneSize) const noexcept;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nostalgia/core/consts.hpp>
|
#include <nostalgia/core/consts.hpp>
|
||||||
@ -22,7 +22,7 @@ ox::Error TileSheetPixels::buildShader() noexcept {
|
|||||||
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
|
return glutils::buildShaderProgram(Vshad, Fshad).moveTo(&m_shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::draw(bool update, const geo::Vec2 &scroll) noexcept {
|
void TileSheetPixels::draw(bool update, const ox::Vec2 &scroll) noexcept {
|
||||||
glUseProgram(m_shader);
|
glUseProgram(m_shader);
|
||||||
glBindVertexArray(m_bufferSet.vao);
|
glBindVertexArray(m_bufferSet.vao);
|
||||||
if (update) {
|
if (update) {
|
||||||
@ -35,7 +35,7 @@ void TileSheetPixels::draw(bool update, const geo::Vec2 &scroll) noexcept {
|
|||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::initBufferSet(geo::Vec2 const&paneSize) noexcept {
|
void TileSheetPixels::initBufferSet(ox::Vec2 const&paneSize) noexcept {
|
||||||
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
m_bufferSet.vao = glutils::generateVertexArrayObject();
|
||||||
m_bufferSet.vbo = glutils::generateBuffer();
|
m_bufferSet.vbo = glutils::generateBuffer();
|
||||||
m_bufferSet.ebo = glutils::generateBuffer();
|
m_bufferSet.ebo = glutils::generateBuffer();
|
||||||
@ -50,14 +50,14 @@ void TileSheetPixels::initBufferSet(geo::Vec2 const&paneSize) noexcept {
|
|||||||
reinterpret_cast<void*>(2 * sizeof(float)));
|
reinterpret_cast<void*>(2 * sizeof(float)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::update(geo::Vec2 const&paneSize) noexcept {
|
void TileSheetPixels::update(ox::Vec2 const&paneSize) noexcept {
|
||||||
glBindVertexArray(m_bufferSet.vao);
|
glBindVertexArray(m_bufferSet.vao);
|
||||||
setBufferObjects(paneSize);
|
setBufferObjects(paneSize);
|
||||||
glutils::sendVbo(m_bufferSet);
|
glutils::sendVbo(m_bufferSet);
|
||||||
glutils::sendEbo(m_bufferSet);
|
glutils::sendEbo(m_bufferSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
geo::Vec2 TileSheetPixels::pixelSize(const geo::Vec2 &paneSize) const noexcept {
|
ox::Vec2 TileSheetPixels::pixelSize(const ox::Vec2 &paneSize) const noexcept {
|
||||||
const auto [sw, sh] = paneSize;
|
const auto [sw, sh] = paneSize;
|
||||||
constexpr float ymod = 0.35f / 10.0f;
|
constexpr float ymod = 0.35f / 10.0f;
|
||||||
const auto xmod = ymod * sh / sw;
|
const auto xmod = ymod * sh / sw;
|
||||||
@ -65,7 +65,7 @@ geo::Vec2 TileSheetPixels::pixelSize(const geo::Vec2 &paneSize) const noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::setPixelBufferObject(
|
void TileSheetPixels::setPixelBufferObject(
|
||||||
geo::Vec2 const&paneSize,
|
ox::Vec2 const&paneSize,
|
||||||
unsigned vertexRow,
|
unsigned vertexRow,
|
||||||
float x, float y,
|
float x, float y,
|
||||||
Color16 color,
|
Color16 color,
|
||||||
@ -92,7 +92,7 @@ void TileSheetPixels::setPixelBufferObject(
|
|||||||
memcpy(ebo, elms.data(), sizeof(elms));
|
memcpy(ebo, elms.data(), sizeof(elms));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileSheetPixels::setBufferObjects(const geo::Vec2 &paneSize) noexcept {
|
void TileSheetPixels::setBufferObjects(const ox::Vec2 &paneSize) noexcept {
|
||||||
// set buffer lengths
|
// set buffer lengths
|
||||||
const auto subSheet = m_model->activeSubSheet();
|
const auto subSheet = m_model->activeSubSheet();
|
||||||
const auto pal = m_model->pal();
|
const auto pal = m_model->pal();
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ox/std/vec.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
#include <nostalgia/core/gfx.hpp>
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/glutils/glutils.hpp>
|
#include <nostalgia/glutils/glutils.hpp>
|
||||||
#include <nostalgia/studio/studio.hpp>
|
#include <nostalgia/studio/studio.hpp>
|
||||||
|
|
||||||
@ -49,19 +50,19 @@ class TileSheetPixels {
|
|||||||
|
|
||||||
ox::Error buildShader() noexcept;
|
ox::Error buildShader() noexcept;
|
||||||
|
|
||||||
void draw(bool update, const geo::Vec2 &scroll) noexcept;
|
void draw(bool update, const ox::Vec2 &scroll) noexcept;
|
||||||
|
|
||||||
void initBufferSet(geo::Vec2 const&paneSize) noexcept;
|
void initBufferSet(ox::Vec2 const&paneSize) noexcept;
|
||||||
|
|
||||||
void update(geo::Vec2 const&paneSize) noexcept;
|
void update(ox::Vec2 const&paneSize) noexcept;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
geo::Vec2 pixelSize(const geo::Vec2 &paneSize) const noexcept;
|
ox::Vec2 pixelSize(const ox::Vec2 &paneSize) const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setPixelBufferObject(const geo::Vec2 &paneS, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) const noexcept;
|
void setPixelBufferObject(const ox::Vec2 &paneS, unsigned vertexRow, float x, float y, Color16 color, float *vbo, GLuint *ebo) const noexcept;
|
||||||
|
|
||||||
void setBufferObjects(const geo::Vec2 &paneS) noexcept;
|
void setBufferObjects(const ox::Vec2 &paneS) noexcept;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/std/array.hpp>
|
#include <ox/std/array.hpp>
|
||||||
|
#include <ox/std/point.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
#include <ox/model/def.hpp>
|
#include <ox/model/def.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/point.hpp>
|
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
#include "color.hpp"
|
#include "color.hpp"
|
||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
@ -122,7 +122,7 @@ struct TileSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto idx(const geo::Point &pt) const noexcept {
|
constexpr auto idx(const ox::Point &pt) const noexcept {
|
||||||
return ptToIdx(pt, columns);
|
return ptToIdx(pt, columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,13 +130,13 @@ struct TileSheet {
|
|||||||
* Reads all pixels of this sheet or its children into the given pixel list
|
* Reads all pixels of this sheet or its children into the given pixel list
|
||||||
* @param pixels
|
* @param pixels
|
||||||
*/
|
*/
|
||||||
constexpr void readPixelsTo(ox::Vector<uint8_t> *pPixels, int8_t bpp) const noexcept {
|
constexpr void readPixelsTo(ox::Vector<uint8_t> *pPixels, int8_t pBpp) const noexcept {
|
||||||
if (subsheets.size()) {
|
if (!subsheets.empty()) {
|
||||||
for (auto &s: subsheets) {
|
for (auto &s: subsheets) {
|
||||||
s.readPixelsTo(pPixels);
|
s.readPixelsTo(pPixels);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bpp == 4) {
|
if (pBpp == 4) {
|
||||||
for (auto p: this->pixels) {
|
for (auto p: this->pixels) {
|
||||||
pPixels->emplace_back(p & 0b1111);
|
pPixels->emplace_back(p & 0b1111);
|
||||||
pPixels->emplace_back(p >> 4);
|
pPixels->emplace_back(p >> 4);
|
||||||
@ -154,7 +154,7 @@ struct TileSheet {
|
|||||||
* @param pixels
|
* @param pixels
|
||||||
*/
|
*/
|
||||||
constexpr void readPixelsTo(ox::Vector<uint8_t> *pPixels) const noexcept {
|
constexpr void readPixelsTo(ox::Vector<uint8_t> *pPixels) const noexcept {
|
||||||
if (subsheets.size()) {
|
if (!subsheets.empty()) {
|
||||||
for (auto &s: subsheets) {
|
for (auto &s: subsheets) {
|
||||||
s.readPixelsTo(pPixels);
|
s.readPixelsTo(pPixels);
|
||||||
}
|
}
|
||||||
@ -203,19 +203,19 @@ struct TileSheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto getPixel4Bpp(const geo::Point &pt) const noexcept {
|
constexpr auto getPixel4Bpp(const ox::Point &pt) const noexcept {
|
||||||
const auto idx = ptToIdx(pt, columns);
|
const auto idx = ptToIdx(pt, columns);
|
||||||
return getPixel4Bpp(idx);
|
return getPixel4Bpp(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto getPixel8Bpp(const geo::Point &pt) const noexcept {
|
constexpr auto getPixel8Bpp(const ox::Point &pt) const noexcept {
|
||||||
const auto idx = ptToIdx(pt, columns);
|
const auto idx = ptToIdx(pt, columns);
|
||||||
return getPixel8Bpp(idx);
|
return getPixel8Bpp(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto getPixel(int8_t pBpp, const geo::Point &pt) const noexcept {
|
constexpr auto getPixel(int8_t pBpp, const ox::Point &pt) const noexcept {
|
||||||
const auto idx = ptToIdx(pt, columns);
|
const auto idx = ptToIdx(pt, columns);
|
||||||
return getPixel(pBpp, idx);
|
return getPixel(pBpp, idx);
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ struct TileSheet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr void setPixel(int8_t pBpp, const geo::Point &pt, uint8_t palIdx) noexcept {
|
constexpr void setPixel(int8_t pBpp, const ox::Point &pt, uint8_t palIdx) noexcept {
|
||||||
const auto idx = ptToIdx(pt, columns);
|
const auto idx = ptToIdx(pt, columns);
|
||||||
setPixel(pBpp, idx, palIdx);
|
setPixel(pBpp, idx, palIdx);
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ struct TileSheet {
|
|||||||
const auto currentIdx = pIdx[pIdxIt];
|
const auto currentIdx = pIdx[pIdxIt];
|
||||||
if (pSubsheet->subsheets.size() <= currentIdx) {
|
if (pSubsheet->subsheets.size() <= currentIdx) {
|
||||||
auto out = pIdx;
|
auto out = pIdx;
|
||||||
if (pSubsheet->subsheets.size()) {
|
if (!pSubsheet->subsheets.empty()) {
|
||||||
out.back().value = pSubsheet->subsheets.size() - 1;
|
out.back().value = pSubsheet->subsheets.size() - 1;
|
||||||
} else {
|
} else {
|
||||||
out.pop_back();
|
out.pop_back();
|
||||||
@ -471,7 +471,7 @@ struct TileSheet {
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto getPixel4Bpp(
|
constexpr auto getPixel4Bpp(
|
||||||
const geo::Point &pt,
|
const ox::Point &pt,
|
||||||
const SubSheetIdx &subsheetIdx) const noexcept {
|
const SubSheetIdx &subsheetIdx) const noexcept {
|
||||||
oxAssert(bpp == 4, "TileSheet::getPixel4Bpp: wrong bpp");
|
oxAssert(bpp == 4, "TileSheet::getPixel4Bpp: wrong bpp");
|
||||||
auto &s = this->getSubSheet(subsheetIdx);
|
auto &s = this->getSubSheet(subsheetIdx);
|
||||||
@ -481,7 +481,7 @@ struct TileSheet {
|
|||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr auto getPixel8Bpp(
|
constexpr auto getPixel8Bpp(
|
||||||
const geo::Point &pt,
|
const ox::Point &pt,
|
||||||
const SubSheetIdx &subsheetIdx) const noexcept {
|
const SubSheetIdx &subsheetIdx) const noexcept {
|
||||||
oxAssert(bpp == 8, "TileSheet::getPixel8Bpp: wrong bpp");
|
oxAssert(bpp == 8, "TileSheet::getPixel8Bpp: wrong bpp");
|
||||||
auto &s = this->getSubSheet(subsheetIdx);
|
auto &s = this->getSubSheet(subsheetIdx);
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
|
|
||||||
add_library(
|
|
||||||
NostalgiaGeo OBJECT
|
|
||||||
vec.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(
|
|
||||||
NostalgiaGeo PUBLIC
|
|
||||||
OxStd
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
bounds.hpp
|
|
||||||
geo.hpp
|
|
||||||
point.hpp
|
|
||||||
size.hpp
|
|
||||||
vec.hpp
|
|
||||||
DESTINATION
|
|
||||||
include/nostalgia/geo
|
|
||||||
)
|
|
@ -1,9 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "bounds.hpp"
|
|
||||||
#include "point.hpp"
|
|
||||||
#include "size.hpp"
|
|
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ox/std/defines.hpp>
|
|
||||||
|
|
||||||
#include "vec.hpp"
|
|
||||||
|
|
||||||
namespace nostalgia::geo {
|
|
||||||
|
|
||||||
static_assert([] {
|
|
||||||
Vec2 v(1, 2);
|
|
||||||
return v.x == 1 && v.y == 2 && v[0] == 1 && v[1] == 2 && v.size() == 2;
|
|
||||||
}());
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ox/std/assert.hpp>
|
#include <ox/std/assert.hpp>
|
||||||
@ -46,6 +46,13 @@ template struct GLObject<deleteVertexArray>;
|
|||||||
template struct GLObject<deleteProgram>;
|
template struct GLObject<deleteProgram>;
|
||||||
template struct GLObject<deleteShader>;
|
template struct GLObject<deleteShader>;
|
||||||
|
|
||||||
|
|
||||||
|
void bind(const FrameBuffer &fb) noexcept {
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
||||||
|
glViewport(0, 0, fb.width, fb.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static ox::Result<GLShader> buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept {
|
static ox::Result<GLShader> buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept {
|
||||||
GLShader shader(glCreateShader(shaderType));
|
GLShader shader(glCreateShader(shaderType));
|
||||||
glShaderSource(shader, 1, &src, nullptr);
|
glShaderSource(shader, 1, &src, nullptr);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -134,6 +134,8 @@ struct FrameBuffer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void bind(const FrameBuffer &fb) noexcept;
|
||||||
|
|
||||||
|
|
||||||
ox::Result<GLProgram> buildShaderProgram(const GLchar *vert, const GLchar *frag, const GLchar *geo = nullptr) noexcept;
|
ox::Result<GLProgram> buildShaderProgram(const GLchar *vert, const GLchar *frag, const GLchar *geo = nullptr) noexcept;
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ add_library(
|
|||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
NostalgiaScene PUBLIC
|
NostalgiaScene PUBLIC
|
||||||
NostalgiaCore
|
NostalgiaCore
|
||||||
NostalgiaGeo
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
#include <ox/fs/fs.hpp>
|
#include <ox/fs/fs.hpp>
|
||||||
#include <ox/std/error.hpp>
|
#include <ox/std/error.hpp>
|
||||||
|
#include <ox/std/size.hpp>
|
||||||
#include <ox/std/types.hpp>
|
#include <ox/std/types.hpp>
|
||||||
#include <ox/std/vector.hpp>
|
#include <ox/std/vector.hpp>
|
||||||
|
|
||||||
#include <nostalgia/core/tilesheet.hpp>
|
#include <nostalgia/core/tilesheet.hpp>
|
||||||
#include <nostalgia/geo/size.hpp>
|
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ struct SceneDoc {
|
|||||||
TileMap tiles;
|
TileMap tiles;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr geo::Size size(std::size_t layerIdx) const noexcept {
|
constexpr ox::Size size(std::size_t layerIdx) const noexcept {
|
||||||
const auto &layer = this->tiles[layerIdx];
|
const auto &layer = this->tiles[layerIdx];
|
||||||
const auto rowCnt = static_cast<int>(layer.size());
|
const auto rowCnt = static_cast<int>(layer.size());
|
||||||
if (!rowCnt) {
|
if (!rowCnt) {
|
||||||
@ -170,7 +170,7 @@ struct SceneStatic {
|
|||||||
constexpr Tile tile(std::size_t i) noexcept {
|
constexpr Tile tile(std::size_t i) noexcept {
|
||||||
return {tileMapIdx[i], tileType[i], layerAttachments[i]};
|
return {tileMapIdx[i], tileType[i], layerAttachments[i]};
|
||||||
}
|
}
|
||||||
constexpr auto setDimensions(geo::Size dim) noexcept {
|
constexpr auto setDimensions(ox::Size dim) noexcept {
|
||||||
columns = dim.width;
|
columns = dim.width;
|
||||||
rows = dim.height;
|
rows = dim.height;
|
||||||
const auto tileCnt = static_cast<unsigned>(columns * rows);
|
const auto tileCnt = static_cast<unsigned>(columns * rows);
|
||||||
|
@ -14,11 +14,7 @@ ox::Vector<studio::EditorMaker> StudioModule::editors(core::Context *ctx) noexce
|
|||||||
{
|
{
|
||||||
{"nscn"},
|
{"nscn"},
|
||||||
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
[ctx](ox::CRStringView path) -> ox::Result<studio::BaseEditor*> {
|
||||||
try {
|
return ox::makeCatch<SceneEditorImGui>(ctx, path);
|
||||||
return ox::make<SceneEditorImGui>(ctx, path);
|
|
||||||
} catch (const ox::Exception &ex) {
|
|
||||||
return ex.toError();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <nostalgia/core/gfx.hpp>
|
|
||||||
#include <keel/media.hpp>
|
#include <keel/media.hpp>
|
||||||
#include <ox/std/memory.hpp>
|
|
||||||
|
#include <nostalgia/core/gfx.hpp>
|
||||||
|
|
||||||
#include "sceneeditor-imgui.hpp"
|
#include "sceneeditor-imgui.hpp"
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ ox::CRString SceneEditorImGui::itemDisplayName() const noexcept {
|
|||||||
|
|
||||||
void SceneEditorImGui::draw(core::Context*) noexcept {
|
void SceneEditorImGui::draw(core::Context*) noexcept {
|
||||||
const auto paneSize = ImGui::GetContentRegionAvail();
|
const auto paneSize = ImGui::GetContentRegionAvail();
|
||||||
const geo::Size fbSize{
|
const ox::Size fbSize{
|
||||||
static_cast<int>(paneSize.x),
|
static_cast<int>(paneSize.x),
|
||||||
static_cast<int>(paneSize.y)};
|
static_cast<int>(paneSize.y)};
|
||||||
m_view.draw(fbSize.width, fbSize.height);
|
m_view.draw(fbSize.width, fbSize.height);
|
||||||
@ -46,7 +46,7 @@ void SceneEditorImGui::draw(core::Context*) noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorImGui::onActivated() noexcept {
|
void SceneEditorImGui::onActivated() noexcept {
|
||||||
m_view.setupScene();
|
oxLogError(m_view.setupScene());
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Error SceneEditorImGui::saveItem() noexcept {
|
ox::Error SceneEditorImGui::saveItem() noexcept {
|
||||||
|
@ -2,31 +2,29 @@
|
|||||||
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <nostalgia/core/gfx.hpp>
|
||||||
|
|
||||||
#include "sceneeditorview.hpp"
|
#include "sceneeditorview.hpp"
|
||||||
|
|
||||||
namespace nostalgia::scene {
|
namespace nostalgia::scene {
|
||||||
|
|
||||||
SceneEditorView::SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept:
|
SceneEditorView::SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept:
|
||||||
m_ctx(*ctx),
|
m_ctx(ctx),
|
||||||
m_sceneStatic(sceneStatic),
|
m_sceneStatic(sceneStatic),
|
||||||
m_scene(m_sceneStatic) {
|
m_scene(m_sceneStatic) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorView::setupScene() noexcept {
|
ox::Error SceneEditorView::setupScene() noexcept {
|
||||||
oxIgnoreError(m_scene.setupDisplay(&m_ctx));
|
return m_scene.setupDisplay(m_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SceneEditorView::draw(int width, int height) noexcept {
|
void SceneEditorView::draw(int width, int height) noexcept {
|
||||||
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
if (width != m_frameBuffer.width || height != m_frameBuffer.height) {
|
||||||
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
|
glutils::resizeInitFrameBuffer(&m_frameBuffer, width, height);
|
||||||
core::gl::setRenderSize(&m_ctx, width, height);
|
|
||||||
oxIgnoreError(m_scene.setupDisplay(&m_ctx));
|
|
||||||
}
|
}
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, m_frameBuffer);
|
glutils::bind(m_frameBuffer);
|
||||||
glViewport(0, 0, m_frameBuffer.width, m_frameBuffer.height);
|
core::gl::setRenderSize(m_ctx, width, height);
|
||||||
// draw begin
|
core::gl::drawMainView(m_ctx);
|
||||||
core::gl::drawMainView(&m_ctx);
|
|
||||||
// draw end
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace nostalgia::scene {
|
|||||||
class SceneEditorView {
|
class SceneEditorView {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
core::Context &m_ctx;
|
core::Context *const m_ctx = nullptr;
|
||||||
const SceneStatic &m_sceneStatic;
|
const SceneStatic &m_sceneStatic;
|
||||||
Scene m_scene;
|
Scene m_scene;
|
||||||
glutils::FrameBuffer m_frameBuffer;
|
glutils::FrameBuffer m_frameBuffer;
|
||||||
@ -21,7 +21,7 @@ class SceneEditorView {
|
|||||||
public:
|
public:
|
||||||
SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept;
|
SceneEditorView(core::Context *ctx, const SceneStatic &sceneStatic) noexcept;
|
||||||
|
|
||||||
void setupScene() noexcept;
|
ox::Error setupScene() noexcept;
|
||||||
|
|
||||||
void draw(int width, int height) noexcept;
|
void draw(int width, int height) noexcept;
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <ox/event/signal.hpp>
|
#include <ox/event/signal.hpp>
|
||||||
#include <ox/std/string.hpp>
|
#include <ox/std/string.hpp>
|
||||||
|
#include <ox/std/vec.hpp>
|
||||||
|
|
||||||
#include <nostalgia/geo/vec.hpp>
|
|
||||||
#include <nostalgia/core/context.hpp>
|
#include <nostalgia/core/context.hpp>
|
||||||
|
|
||||||
#include "imguiuitl.hpp"
|
#include "imguiuitl.hpp"
|
||||||
@ -17,7 +17,7 @@ namespace nostalgia::studio {
|
|||||||
|
|
||||||
class Popup {
|
class Popup {
|
||||||
private:
|
private:
|
||||||
geo::Vec2 m_size;
|
ox::Vec2 m_size;
|
||||||
ox::String m_title;
|
ox::String m_title;
|
||||||
public:
|
public:
|
||||||
// emits path parameter
|
// emits path parameter
|
||||||
@ -35,7 +35,7 @@ class Popup {
|
|||||||
virtual void draw(core::Context *ctx) noexcept = 0;
|
virtual void draw(core::Context *ctx) noexcept = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
constexpr void setSize(geo::Size sz) noexcept {
|
constexpr void setSize(ox::Size sz) noexcept {
|
||||||
m_size = {static_cast<float>(sz.width), static_cast<float>(sz.height)};
|
m_size = {static_cast<float>(sz.width), static_cast<float>(sz.height)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ static ox::Error run(ox::UniquePtr<ox::FileSystem> fs) noexcept {
|
|||||||
core::setUpdateHandler(ctx.get(), updateHandler);
|
core::setUpdateHandler(ctx.get(), updateHandler);
|
||||||
core::setKeyEventHandler(ctx.get(), keyEventHandler);
|
core::setKeyEventHandler(ctx.get(), keyEventHandler);
|
||||||
core::setConstantRefresh(ctx.get(), false);
|
core::setConstantRefresh(ctx.get(), false);
|
||||||
core::gl::setMainViewEnabled(false);
|
core::gl::setMainViewEnabled(ctx.get(), false);
|
||||||
studio::StudioContext studioCtx;
|
studio::StudioContext studioCtx;
|
||||||
core::setApplicationData(ctx.get(), &studioCtx);
|
core::setApplicationData(ctx.get(), &studioCtx);
|
||||||
StudioUI ui(ctx.get());
|
StudioUI ui(ctx.get());
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
* Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
#include <nostalgia/geo/bounds.hpp>
|
|
||||||
|
|
||||||
#include "projectexplorer.hpp"
|
#include "projectexplorer.hpp"
|
||||||
|
|
||||||
namespace nostalgia {
|
namespace nostalgia {
|
||||||
|
@ -45,7 +45,7 @@ StudioUI::StudioUI(core::Context *ctx) noexcept {
|
|||||||
for (const auto &f : config.openFiles) {
|
for (const auto &f : config.openFiles) {
|
||||||
auto openFileErr = openFileActiveTab(f, config.activeTabItemName == f);
|
auto openFileErr = openFileActiveTab(f, config.activeTabItemName == f);
|
||||||
if (openFileErr) {
|
if (openFileErr) {
|
||||||
oxErrorf("Could not open editor: {}\n", toStr(openFileErr));
|
oxErrorf("\nCould not open editor for file:\n\t{}\nReason:\n\t{}\n", f, toStr(openFileErr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user