From: John Tsiombikas Date: Thu, 28 Jul 2016 14:09:56 +0000 (+0300) Subject: adding fs and icon renderers X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=vrfileman;a=commitdiff_plain;h=d0cc9ec2f92f149279ebc8f1c29d2be627074488 adding fs and icon renderers --- diff --git a/src/fs.h b/src/fs.h new file mode 100644 index 0000000..d58c621 --- /dev/null +++ b/src/fs.h @@ -0,0 +1,20 @@ +#ifndef FS_H_ +#define FS_H_ + +enum FSNodeType { + FSNODE_UNKNOWN, + FSNODE_FILE, + FSNODE_DIR, + FSNODE_DEV +}; + +class FSNode { +public: + FSNodeType type; + char *abs_path; + char *name, *suffix; + + void set_path(const char *s); +}; + +#endif // FS_H_ diff --git a/src/icon.cc b/src/icon.cc new file mode 100644 index 0000000..a72a6d0 --- /dev/null +++ b/src/icon.cc @@ -0,0 +1,69 @@ +#include +#include "icon.h" +#include "fs.h" +#include "meshgen.h" +#include "mesh.h" + +IconRenderer::~IconRenderer() +{ +} + +bool IconRenderer::init() +{ + return true; +} + +void IconRenderer::shutdown() +{ +} + + +// Shapes icon renderer +enum { + SHAPE_SPHERE, + SHAPE_BOX, + SHAPE_TORUS, + SHAPE_CONE, + NUM_SHAPES +}; + +struct ShapesIconsPriv { + Mesh *shape[NUM_SHAPES]; +}; + +ShapesIcons::ShapesIcons() +{ + priv = new ShapesIconsPriv; + memset(priv, 0, sizeof *priv); +} + +ShapesIcons::~ShapesIcons() +{ + shutdown(); + delete priv; +} + +bool ShapesIcons::init() +{ + for(int i=0; ishape[i] = new Mesh; + } + + gen_geosphere(priv->shape[SHAPE_SPHERE], 1.0, 2); + gen_box(priv->shape[SHAPE_BOX], 1, 1, 1); + gen_torus(priv->shape[SHAPE_TORUS], 0.9, 0.2, 16, 8); + gen_cone(priv->shape[SHAPE_CONE], 0.8, 1.0, 8, 2); + + return true; +} + +void ShapesIcons::shutdown() +{ + for(int i=0; ishape[i]; + } +} + +void ShapesIcons::draw(FSNode *node) const +{ +} diff --git a/src/icon.h b/src/icon.h new file mode 100644 index 0000000..e2b4fc1 --- /dev/null +++ b/src/icon.h @@ -0,0 +1,32 @@ +#ifndef ICON_H_ +#define ICON_H_ + +class FSNode; + +class IconRenderer { +public: + virtual ~IconRenderer(); + + virtual bool init(); + virtual void shutdown(); + + virtual void draw(FSNode *node) const = 0; +}; + +struct ShapesIconsPriv; + +class ShapesIcons : public IconRenderer { +private: + ShapesIconsPriv *priv; + +public: + ShapesIcons(); + ~ShapesIcons(); + + bool init(); + void shutdown(); + + void draw(FSNode *node) const; +}; + +#endif // ICON_H_