mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-17 20:45:23 +00:00
Curve glyph tweaks, faster ModalWindow animation
This commit is contained in:
@@ -97,7 +97,50 @@ class FileBrowser : public ModalWindow
|
||||
}
|
||||
} m_fileFieldBind;
|
||||
|
||||
ViewChild<std::unique_ptr<ScrollView>> m_fileScroll;
|
||||
struct TableDataBind : ITableDataBinding
|
||||
{
|
||||
std::string m_nameCol = "Name";
|
||||
std::vector<std::string> m_names = {"One", "Two", "Three"};
|
||||
|
||||
std::string m_typeCol = "Type";
|
||||
std::vector<std::string> m_types = {"t1", "t2", "t3"};
|
||||
|
||||
std::string m_sizeCol = "Size";
|
||||
std::vector<std::string> m_sizes = {"s1", "s2", "s3"};
|
||||
|
||||
size_t columnCount() const {return 3;}
|
||||
size_t rowCount() const {return 3;}
|
||||
|
||||
const std::string* header(size_t cIdx) const
|
||||
{
|
||||
switch (cIdx)
|
||||
{
|
||||
case 0:
|
||||
return &m_nameCol;
|
||||
case 1:
|
||||
return &m_typeCol;
|
||||
case 2:
|
||||
return &m_sizeCol;
|
||||
default: break;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::string* cell(size_t cIdx, size_t rIdx) const
|
||||
{
|
||||
switch (cIdx)
|
||||
{
|
||||
case 0:
|
||||
return &m_names.at(rIdx);
|
||||
case 1:
|
||||
return &m_types.at(rIdx);
|
||||
case 2:
|
||||
return &m_sizes.at(rIdx);
|
||||
default: break;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
} m_fileListingBind;
|
||||
ViewChild<std::unique_ptr<Table>> m_fileListing;
|
||||
|
||||
public:
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Specter
|
||||
{
|
||||
class ModalWindow : public View
|
||||
{
|
||||
unsigned m_frame = 0;
|
||||
unsigned m_contentStartFrame = 0;
|
||||
int m_frame = 0;
|
||||
int m_contentStartFrame = 0;
|
||||
float m_lineTime = 0.0;
|
||||
|
||||
enum class Phase
|
||||
@@ -29,6 +29,7 @@ class ModalWindow : public View
|
||||
Zeus::CColor m_windowBgClear;
|
||||
Zeus::CColor m_line1;
|
||||
Zeus::CColor m_line2;
|
||||
Zeus::CColor m_line2Clear;
|
||||
|
||||
ViewBlock m_viewBlock;
|
||||
boo::IGraphicsBufferD* m_viewBlockBuf;
|
||||
@@ -39,7 +40,9 @@ class ModalWindow : public View
|
||||
} m_verts;
|
||||
|
||||
void setLineVerts(int width, int height, float pf, float t);
|
||||
void setLineVertsOut(int width, int height, float pf, float t);
|
||||
void setLineColors(float t);
|
||||
void setLineColorsOut(float t);
|
||||
void setFillVerts(int width, int height, float pf);
|
||||
void setFillColors(float t);
|
||||
|
||||
@@ -59,6 +62,8 @@ public:
|
||||
ModalWindow(ViewResources& res, View& parentView, const RectangleConstraint& constraint);
|
||||
void think();
|
||||
bool skipBuildInAnimation();
|
||||
void close();
|
||||
bool closed() const {return m_phase >= Phase::BuildOut;}
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
||||
@@ -20,6 +20,11 @@ private:
|
||||
|
||||
public:
|
||||
ScrollView(ViewResources& res, View& parentView);
|
||||
void setContentView(View* v)
|
||||
{
|
||||
m_contentView = v;
|
||||
updateSize();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,14 +2,66 @@
|
||||
#define SPECTER_TABLE_HPP
|
||||
|
||||
#include "View.hpp"
|
||||
#include "ScrollView.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
#define SPECTER_TABLE_MAX_ROWS 128
|
||||
|
||||
enum class SortDirection
|
||||
{
|
||||
None,
|
||||
Ascending,
|
||||
Descending
|
||||
};
|
||||
|
||||
struct ITableDataBinding
|
||||
{
|
||||
virtual size_t columnCount() const=0;
|
||||
virtual size_t rowCount() const=0;
|
||||
virtual const std::string* header(size_t cIdx) const {return nullptr;}
|
||||
virtual const std::string* cell(size_t cIdx, size_t rIdx) const {return nullptr;}
|
||||
};
|
||||
|
||||
struct ITableStateBinding
|
||||
{
|
||||
virtual float columnSplit(size_t cIdx) {return -1.0;}
|
||||
virtual void setColumnSplit(size_t cIdx, float split) {}
|
||||
virtual SortDirection sort(size_t cIdx) {return SortDirection::None;}
|
||||
virtual void setSort(size_t cIdx, SortDirection dir) {}
|
||||
};
|
||||
|
||||
class Table : public View
|
||||
{
|
||||
ITableDataBinding* m_data;
|
||||
ITableStateBinding* m_state;
|
||||
|
||||
SolidShaderVert m_verts[SPECTER_TABLE_MAX_ROWS * 6];
|
||||
boo::IGraphicsBufferD* m_vertsBuf = nullptr;
|
||||
boo::IVertexFormat* m_vtxFmt = nullptr; /* OpenGL only */
|
||||
boo::IShaderDataBinding* m_shaderBinding = nullptr;
|
||||
|
||||
ViewChild<std::unique_ptr<ScrollView>> m_scroll;
|
||||
|
||||
struct RowsView : public View
|
||||
{
|
||||
Table& m_t;
|
||||
RowsView(Table& t, ViewResources& res) : View(res, t), m_t(t) {}
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
} m_rowsView;
|
||||
|
||||
public:
|
||||
Table(ViewResources& res, View& parentView);
|
||||
Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state=nullptr);
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&);
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public:
|
||||
template <class ViewPtrType>
|
||||
struct ViewChild
|
||||
{
|
||||
ViewPtrType m_view;
|
||||
ViewPtrType m_view = ViewPtrType();
|
||||
bool m_mouseIn = false;
|
||||
int m_mouseDown = 0;
|
||||
|
||||
@@ -280,6 +280,14 @@ struct ViewChild
|
||||
m_mouseIn = false;
|
||||
}
|
||||
}
|
||||
|
||||
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll)
|
||||
{
|
||||
if (!m_view)
|
||||
return;
|
||||
if (m_mouseIn)
|
||||
m_view->scroll(coord, scroll);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user