Permalink
Browse files

added renderable naming and get renderable by name

  • Loading branch information...
RonenNess committed Nov 7, 2014
1 parent 22fbfed commit 9ece180c7d375bdc17e3fb15a3620c565a2d86e3
@@ -165,6 +165,16 @@ namespace Ness
}
}
RenderablePtr BaseNode::get_son(const String& name)
{
for (unsigned int i = 0; i < m_entities.size(); i++)
{
if (m_entities[i]->get_name() == name)
return m_entities[i];
}
return RenderablePtr();
}
void BaseNode::render(const CameraPtr& camera)
{
// if invisible skip
@@ -63,6 +63,10 @@ namespace Ness
NESSENGINE_API virtual unsigned int get_sons_count() const {return (unsigned int)m_entities.size();}
NESSENGINE_API virtual RenderablePtr get_son(unsigned int index) {return m_entities[index];}
// get son from name. will return empty ptr if not found.
// if there are multiple sons with the same name, will return the first one found.
NESSENGINE_API virtual RenderablePtr get_son(const String& name);
// called whenever transformations are updated
NESSENGINE_API virtual void transformations_update();
@@ -58,6 +58,7 @@ namespace Ness
bool m_visible; // should this renderable be displayed or not
int m_flags; // flags you can set on this renderable for any purpose
void* m_user_data; // optional user data you can attach to this object
String m_name; // optional name to assign to this renderable
public:
NESSENGINE_API RenderableAPI(Renderer* renderer) :
@@ -72,6 +73,10 @@ namespace Ness
NESSENGINE_API inline void set_visible(bool Visible) {m_visible = Visible;}
NESSENGINE_API inline bool is_visible() const {return m_visible;}
// set/get this entity name
NESSENGINE_API inline void set_name(const String& name) {m_name = name;}
NESSENGINE_API inline const String& get_name() const {return m_name;}
// set/get flags
NESSENGINE_API inline int get_flags() const {return m_flags;}
NESSENGINE_API inline void set_flags(int flags) {m_flags = flags;}
View
@@ -0,0 +1,68 @@
<!--- Don't mess with this line! --->{{Unreviewed|date={{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}}}}
<!--- Write your article below this line --->
{{Infobox Software
| name = Ness-Engine
| logo =
| screenshot =
| caption =
| developer = Ronen Ness
| latest_release_version = '''1.4.3'''
| latest_release_date = November 01, 2014
| latest_preview_version =
| latest_preview_date =
| operating_system = [[Cross-platform]]
| genre = [[Video game]]
| license = [[zlib License|zlib]]
| website = [http://www.ness-engine.com/|ness-engine.com]
}}
'''Ness-Engine''' is an [[open source]] 2D rendering engine written in [[C++|C++]] under the [[zlib License|zlib]] license.<ref name="ness-engine.com">http://www.ness-engine.com/</ref> It uses [[Simple DirectMedia Layer|SDL2.0]] for rendering and event handling.
== Design ==
The engine is primarily designed for an [[object-oriented]] approach to scene rendering; Every renderable object in the engine is either an entity or a scene node arranged in a [[Scene graph]] structure, transformations and other rendering effects are inherited from parent nodes to their sons.
== Languages ==
The engine is written in [[C++]] and currently have no bindings to other languages.
== Features ==
Ness-Engine provides the following graphic functions:
* [[Sprite (computer graphics) | Sprites]]:
** Support scaling, rotation, flipping, alpha blending, mod and additive blending, color tinting and opacity.
** Render on sprites, masking using external texture.
** Sprite sheet animation.
** Extendable sprite class.
* Rendering utilities:
** Built-in [[Z-order | z-ordering]].
** 2D lighting effects.
** [[Particle system | 2D Particles system]].
** 2D Camera object with limits and auto-focusing on given target.
** Built-in [[Tile engine | tile engine]], extendable into [[Isometric graphics in video games and pixel art | Isometric tile engine]].
** Built-in background scrolling / [[Parallax scrolling | Parallax scrolling]].
** Rendering targets that allows to render an entire scene or node onto a texture or sprite.
** Static nodes to render massive amount of static entities with low cost.
* Text:
** Built in text object with multi-lines support.
** Text supports all Sprite transformations and effects.
** Replaceable fonts, support any ttf format.
* File Types:
** Support textures from file types: [[Graphics Interchange Format | GIF]], [[BMP file format | BMP]], [[Portable Network Graphics | PNG]], [[JPEG | JPEG]].
* Input:
** Keyboard/mouse input manager.
* Shapes:
** Render shapes.
** filled/outlined.
==References==
<references />
<!--- After listing your sources please cite them using inline citations and place them after the information they cite. Please see http://en.wikipedia.org/wiki/Wikipedia:REFB for instructions on how to add citations. --->
*
*
*
*
==External links==
* [http://www.ness-engine.com/ Official website]
<!--- STOP! Be warned that by using this process instead of Articles for Creation, this article is subject to scrutiny. As an article in "mainspace", it will be DELETED if there are problems, not just declined. If you wish to use AfC, please return to the Wizard and continue from there. --->

0 comments on commit 9ece180

Please sign in to comment.