Browse Source

forward declarations...

dmuratshin 9 years ago
parent
commit
73869afec7

+ 4 - 42
oxygine/src/Actor.h

@@ -1,5 +1,6 @@
 #pragma once
 #include "oxygine-include.h"
+#include "oxygine-forwards.h"
 #include "core/Object.h"
 #include "core/Renderer.h"
 #include "math/Rect.h"
@@ -10,49 +11,8 @@
 #include "TouchEvent.h"
 #include "Tween.h"
 
-
-
 namespace oxygine
 {
-    class Event;
-
-    typedef unsigned int dumpOptions;
-
-    class RenderState;
-    class UpdateState;
-    class Material;
-
-
-    DECLARE_SMART(Texture, spTexture);
-    DECLARE_SMART(Actor, spActor);
-    DECLARE_SMART(Clock, spClock);
-
-
-    typedef Closure<void (const UpdateState& us)> UpdateCallback;
-    typedef Closure<void (const RenderState& rs)> RenderCallback;
-
-    const int cloneOptionsDoNotCloneClildren = 0x01;
-    const int cloneOptionsResetTransform = 0x02;
-    typedef int cloneOptions;
-    typedef int copyOptions;//deprecated typedef
-
-
-#define DECLARE_COPYCLONE(type) type(const type &src, cloneOptions);\
-    virtual type* clone(cloneOptions opt=0) const {return new type(*this, opt);}\
-
-
-#define DECLARE_COPYCLONE_NEW(type)  type(const type &src, cloneOptions opt = 0){copyFrom(src, opt);}\
-    virtual type* clone(cloneOptions opt=0) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}\
-    virtual void copyFrom(const type &src, cloneOptions opt = 0);
-
-#define DECLARE_COPYCLONE_NEW2(type)  type(const type &src, cloneOptions opt = 0);\
-    virtual type* clone(cloneOptions opt=0) const;\
-    virtual void copyFrom(const type &src, cloneOptions opt = 0);
-
-#define CREATE_COPYCLONE_NEW(type) type::type(const type &src, cloneOptions opt){copyFrom(src, opt);}\
-    type* type::clone(cloneOptions opt) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}
-
-
     class TweenOptions
     {
     public:
@@ -77,7 +37,9 @@ namespace oxygine
         bool            _detach;
     };
 
-    class Actor : public EventDispatcher, public intrusive_list_item<spActor>, public Serializable
+    DECLARE_SMART(Actor, spActor);
+
+    class Actor: public EventDispatcher, public intrusive_list_item<spActor>, public Serializable
     {
         typedef intrusive_list_item<spActor> intr_list;
     public:

+ 0 - 4
oxygine/src/AnimationFrame.h

@@ -6,9 +6,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(Texture, spTexture);
-    DECLARE_SMART(NativeTexture, spNativeTexture);
-
     class Diffuse
     {
     public:
@@ -28,7 +25,6 @@ namespace oxygine
         unsigned char pitch;
     };
 
-    class ResAnim;
     class AnimationFrame
     {
     public:

+ 6 - 5
oxygine/src/AsyncTask.h

@@ -1,25 +1,26 @@
 #pragma once
+#include "oxygine-include.h"
 #include "core/ThreadDispatcher.h"
 #include "EventDispatcher.h"
 #include "Event.h"
 
-namespace oxygine
-{
-
 #ifdef ERROR
 #undef ERROR
 #endif
 
+namespace oxygine
+{
     DECLARE_SMART(AsyncTask, spAsyncTask);
 
-    class AsyncTaskEvent : public Event
+    class AsyncTaskEvent: public Event
     {
     public:
         AsyncTaskEvent(eventType type, AsyncTask* t) : Event(type), task(t) {}
         AsyncTask* task;
     };
 
-    class AsyncTask : public EventDispatcher
+
+    class AsyncTask: public EventDispatcher
     {
     public:
         enum

+ 0 - 2
oxygine/src/Button.h

@@ -5,8 +5,6 @@ namespace oxygine
 {
     DECLARE_SMART(Button, spButton);
 
-    class ResAnim;
-
     class Button: public Sprite
     {
         INHERITED(Sprite);

+ 0 - 3
oxygine/src/Clock.h

@@ -4,9 +4,6 @@
 
 namespace oxygine
 {
-    class UpdateState;
-
-
     DECLARE_SMART(Clock, spClock);
     class Clock: public Object
     {

+ 0 - 2
oxygine/src/ColorRectSprite.h

@@ -23,8 +23,6 @@ namespace oxygine
 
     protected:
         void sizeChanged(const Vector2& size) OVERRIDE;
-
-    private:
     };
 }
 

+ 0 - 6
oxygine/src/DebugActor.h

@@ -5,12 +5,6 @@
 
 namespace oxygine
 {
-    class ResFontBM;
-    class ResAnim;
-    class Resources;
-
-    DECLARE_SMART(TextField, spTextField);
-    DECLARE_SMART(ColorRectSprite, spColorRectSprite);
     DECLARE_SMART(DebugActor, spDebugActor);
 
     /**DebugActor is helper class. It displays FPS, memory usage, other stats and dev tools buttons*/

+ 0 - 1
oxygine/src/Draggable.h

@@ -5,7 +5,6 @@
 
 namespace oxygine
 {
-    class TouchEvent;
     Vector2 convertPosUp(Actor* src, Actor* dest, const Vector2& pos, bool direction);
     Vector2 convertPosDown(Actor* src, Actor* dest, const Vector2& pos, bool direction);
 

+ 0 - 5
oxygine/src/Event.h

@@ -5,13 +5,8 @@
 #include "EventDispatcher.h"
 #undef OUT
 
-struct SDL_KeyboardEvent;
-
 namespace oxygine
 {
-    typedef int eventType;
-    DECLARE_SMART(EventDispatcher, spEventDispatcher);
-
     class Event
     {
     public:

+ 0 - 5
oxygine/src/EventDispatcher.h

@@ -6,10 +6,6 @@
 
 namespace oxygine
 {
-
-    typedef int eventType;
-    class Event;
-
 #define makefourcc(a,b,c,d) ( ((unsigned int)a) | (((unsigned int)b)<< 8) | (((unsigned int)c)<<16) | (((unsigned int)d)<<24))
 
 #ifdef OX_HAS_CPP11
@@ -26,7 +22,6 @@ namespace oxygine
 
 #define  EventID(str) EventIDc11(str)
 
-    typedef Closure<void (Event* ev)> EventCallback;
 
     DECLARE_SMART(EventDispatcher, spEventDispatcher);
     class EventDispatcher: public Object

+ 1 - 4
oxygine/src/Font.h

@@ -7,12 +7,9 @@
 #else
 #include <unordered_set>
 #endif
+
 namespace oxygine
 {
-    DECLARE_SMART(NativeTexture, spNativeTexture);
-
-    typedef unsigned int glyphOptions;
-
     struct glyph
     {
         RectF src;

+ 0 - 3
oxygine/src/HttpRequestTask.h

@@ -75,8 +75,5 @@ namespace oxygine
         bool _cacheEnabled;
         std::vector<unsigned char> _response;
         std::vector<unsigned char> _postData;
-
-        //size_t _loaded;
-        //size_t _total;
     };
 }

+ 0 - 4
oxygine/src/Input.h

@@ -6,10 +6,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(Stage, spStage);
-    class Actor;
-    class EventState;
-
     const int MAX_TOUCHES = 17;
 
     class Input

+ 0 - 1
oxygine/src/InputText.h

@@ -9,7 +9,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(TextField, spTextField);
     DECLARE_SMART(InputText, spInputText);
 
     class InputText: public EventDispatcher

+ 0 - 2
oxygine/src/MaskedRenderer.h

@@ -4,8 +4,6 @@
 
 namespace oxygine
 {
-
-
     class ClipUV
     {
     public:

+ 0 - 9
oxygine/src/Material.h

@@ -3,15 +3,6 @@
 
 namespace oxygine
 {
-    class RenderState;
-    class Actor;
-    class ClipRectActor;
-    class MaskedSprite;
-    class Sprite;
-    class TextField;
-    class ColorRectSprite;
-    class ProgressBar;
-
     class Material
     {
     public:

+ 0 - 3
oxygine/src/PointerState.h

@@ -5,9 +5,6 @@
 
 namespace oxygine
 {
-    class EventState;
-    class Actor;
-
     enum MouseButton
     {
         MouseButton_Touch = 0,

+ 0 - 2
oxygine/src/Polygon.h

@@ -4,8 +4,6 @@
 
 namespace oxygine
 {
-    class ResAnim;
-
     DECLARE_SMART(Polygon, spPolygon);
     class Polygon : public Sprite
     {

+ 0 - 5
oxygine/src/PostProcess.h

@@ -8,11 +8,6 @@
 
 namespace oxygine
 {
-    class Actor;
-    class ShaderProgram;
-    class PostProcessOptions;
-
-
     class PostProcessOptions
     {
     public:

+ 0 - 4
oxygine/src/RenderState.h

@@ -4,10 +4,6 @@
 
 namespace oxygine
 {
-    class Color;
-    class Event;
-    class Material;
-
     class RState
     {
     public:

+ 1 - 6
oxygine/src/STDMaterial.h

@@ -5,11 +5,7 @@
 
 namespace oxygine
 {
-    class ClipRectActor;
-    class Sprite;
-    class TextField;
-    class ColorRectSprite;
-
+    DECLARE_SMART(STDMaterial, spSTDMaterial);
     class STDMaterial : public Material
     {
     public:
@@ -32,7 +28,6 @@ namespace oxygine
         STDRenderer* getRenderer() { return _renderer; }
 
     protected:
-        //STDRenderer _renderer_;
         STDRenderer* _renderer;
     };
 

+ 1 - 3
oxygine/src/STDRenderer.h

@@ -1,11 +1,9 @@
 #pragma once
 #include "oxygine-include.h"
 #include "core/Renderer.h"
+
 namespace oxygine
 {
-    class UberShaderProgram;
-    DECLARE_SMART(STDMaterial, spSTDMaterial);
-
     class STDRenderer : public IElementRenderer
     {
     public:

+ 0 - 4
oxygine/src/Serializable.h

@@ -3,10 +3,6 @@
 
 namespace oxygine
 {
-    struct serializedata;
-    struct deserializedata;
-    struct deserializeLinkData;
-
     class Serializable
     {
     public:

+ 0 - 6
oxygine/src/Serialize.h

@@ -8,12 +8,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(Actor, spActor);
-
-    class Resource;
-    class ResAnim;
-    class ResFont;
-
     class creator
     {
     public:

+ 0 - 2
oxygine/src/SlidingActor.h

@@ -8,8 +8,6 @@
 namespace oxygine
 {
     DECLARE_SMART(SlidingActor, spSlidingActor);
-    DECLARE_SMART(DragHandler, spDragHandler);
-
     class SlidingActor: public Actor
     {
         INHERITED(Actor);

+ 0 - 2
oxygine/src/Sprite.h

@@ -10,8 +10,6 @@
 
 namespace oxygine
 {
-    class ResAnim;
-
     DECLARE_SMART(Sprite, spSprite);
     class Sprite : public VStyleActor
     {

+ 0 - 6
oxygine/src/Stage.h

@@ -2,16 +2,10 @@
 #include "oxygine-include.h"
 #include "Actor.h"
 
-#ifdef OXYGINE_SDL
-typedef struct SDL_Window SDL_Window;
-#endif
-
 
 namespace oxygine
 {
     DECLARE_SMART(Stage, spStage);
-
-    class DebugActor;
     class Stage : public Actor
     {
         INHERITED(Actor);

+ 1 - 8
oxygine/src/TextField.h

@@ -3,17 +3,10 @@
 #include "Actor.h"
 #include "TextStyle.h"
 #include "VisualStyle.h"
+
 namespace oxygine
 {
     DECLARE_SMART(TextField, spTextField);
-
-    namespace text
-    {
-        class Node;
-        struct Symbol;
-    }
-
-
     class TextField : public VStyleActor
     {
         INHERITED(VStyleActor);

+ 0 - 3
oxygine/src/TextStyle.h

@@ -5,9 +5,6 @@
 
 namespace oxygine
 {
-    class Font;
-    class ResFont;
-
     class TextStyle
     {
     public:

+ 0 - 3
oxygine/src/ThreadLoader.h

@@ -9,9 +9,6 @@
 namespace oxygine
 {
     DECLARE_SMART(ThreadLoader, spThreadLoader);
-    class Resources;
-    class Resource;
-
     class ThreadLoader: public EventDispatcher
     {
     public:

+ 9 - 4
oxygine/src/TouchEvent.h

@@ -1,10 +1,9 @@
 #pragma once
+#include "oxygine-include.h"
 #include "Event.h"
 #undef OUT
 namespace oxygine
 {
-    class PointerState;
-
     class TouchEvent : public Event
     {
     public:
@@ -27,8 +26,14 @@ namespace oxygine
 
         TouchEvent(eventType type, bool Bubbles = true, const Vector2& locPosition = Vector2(0, 0)) : Event(type, Bubbles), localPosition(locPosition), position(locPosition), mouseButton(MouseButton_Touch), pressure(1.0f), index(1) {}
 
-        Vector2 localPosition;//local position for Event::currentTarget actor
-        Vector2 position;//local position for Event::target actor
+        /**
+        position in local space for Event::currentTarget Actor
+        */
+        Vector2 localPosition;
+        /**
+        position in local space for Event::target actor
+        */
+        Vector2 position;
 
         float pressure;
 

+ 1 - 7
oxygine/src/Tween.h

@@ -13,10 +13,6 @@
 
 namespace oxygine
 {
-    class Tween;
-    class Actor;
-    class UpdateState;
-
     class TweenEvent : public Event
     {
     public:
@@ -32,14 +28,12 @@ namespace oxygine
         const UpdateState* us;
     };
 
-    class UpdateState;
-    class TweenOptions;
+
 
     const int TWEEN_COMPLETE_DT = std::numeric_limits<int>::max() / 2;
 
 
     DECLARE_SMART(Tween, spTween);
-
     class Tween : public EventDispatcher, public intrusive_list_item<spTween>
     {
         typedef intrusive_list_item<spTween> intr_list;

+ 0 - 5
oxygine/src/TweenAnim.h

@@ -3,11 +3,6 @@
 
 namespace oxygine
 {
-    class ResAnim;
-    class AnimationFrame;
-    class Sprite;
-    class UpdateState;
-
     /** A TweenAnim class
     *   use for playing per frame animation
     \code

+ 3 - 2
oxygine/src/TweenQueue.h

@@ -1,4 +1,5 @@
 #pragma once
+#include "oxygine-include.h"
 #include "Tween.h"
 
 namespace oxygine
@@ -41,7 +42,7 @@ namespace oxygine
         spTween add(const GS& gs, timeMS duration, int loops = 1, bool twoSides = false, timeMS delay = 0, Tween::EASE ease = Tween::ease_linear);
 
         template<class GS>
-        spTween add(const GS& gs, const TweenOptions &);
+        spTween add(const GS& gs, const TweenOptions&);
 
         void complete(timeMS deltaTime);
 
@@ -63,7 +64,7 @@ namespace oxygine
     }
 
     template<class GS>
-    spTween TweenQueue::add(const GS& gs, const TweenOptions &opt)
+    spTween TweenQueue::add(const GS& gs, const TweenOptions& opt)
     {
         return add(createTween2(gs, opt));
     }

+ 1 - 0
oxygine/src/UpdateState.h

@@ -1,5 +1,6 @@
 #pragma once
 #include "oxygine-include.h"
+
 namespace oxygine
 {
     class UpdateState

+ 0 - 1
oxygine/src/VisualStyle.h

@@ -4,7 +4,6 @@
 
 namespace oxygine
 {
-    class RenderState;
     class VisualStyle
     {
     public:

+ 1 - 3
oxygine/src/WebImage.h

@@ -1,13 +1,11 @@
 #pragma once
+#include "oxygine-include.h"
 #include "Actor.h"
 #include <string>
 
 namespace oxygine
 {
-    DECLARE_SMART(HttpRequestTask, spHttpRequestTask);
-    DECLARE_SMART(Sprite, spSprite);
     DECLARE_SMART(WebImage, spWebImage);
-
     class WebImage : public Actor
     {
         INHERITED(Actor);

+ 177 - 0
oxygine/src/oxygine-forwards.h

@@ -1,6 +1,183 @@
 #pragma  once
 #include "oxygine-include.h"
+#include "core/ref_counter.h"
+#include "core/intrusive_ptr.h"
+#include "closure/closure.h"
+
+
+#ifdef OXYGINE_SDL
+typedef struct SDL_Window SDL_Window;
+#endif
+
+struct SDL_KeyboardEvent;
+
+
 namespace oxygine
 {
+    namespace text
+    {
+        class Node;
+        struct Symbol;
+    }
+
+    class Event;
+
+    typedef unsigned int dumpOptions;
+    class UberShaderProgram;
+    class RenderState;
+    class UpdateState;
+    class Material;
+    class ResAnim;
+    class EventState;
+    class Actor;
+    class ResAnim;
+    class AnimationFrame;
+    class Sprite;
+    class UpdateState;
+    class PointerState;
+    class Resources;
+    class Resource;
+    class Font;
+    class ResFont;
+    class ClipRectActor;
+    class Sprite;
+    class TextField;
+    class ColorRectSprite;
+    class DebugActor;
+
+    DECLARE_SMART(HttpRequestTask, spHttpRequestTask);
+    DECLARE_SMART(Sprite, spSprite);
+    DECLARE_SMART(WebImage, spWebImage);
+
+
+    DECLARE_SMART(Texture, spTexture);
+    DECLARE_SMART(Actor, spActor);
+    DECLARE_SMART(Clock, spClock);
+    DECLARE_SMART(DragHandler, spDragHandler);
+
+    DECLARE_SMART(Actor, spActor);
+    DECLARE_SMART(Box9Sprite, spBox9Sprite);
+    DECLARE_SMART(Button, spButton);
+    DECLARE_SMART(ClipRectActor, spClipRectActor);
+    DECLARE_SMART(Clock, spClock);
+    DECLARE_SMART(ColorRectSprite, spColorRectSprite);
+    DECLARE_SMART(DebugActor, spDebugActor);
+    DECLARE_SMART(EventDispatcher, spEventDispatcher);
+    DECLARE_SMART(HttpRequestTask, spHttpRequestTask);
+    DECLARE_SMART(InputText, spInputText);
+    DECLARE_SMART(MaskedSprite, spMaskedSprite);
+
+    class Event;
+    class Material;
+    class PointerState;
+    DECLARE_SMART(Polygon, spPolygon);
+    DECLARE_SMART(ProgressBar, spProgressBar);
+    DECLARE_SMART(SlidingActor, spSlidingActor);
+    DECLARE_SMART(Sprite, spSprite);
+    DECLARE_SMART(Stage, spStage);
+    DECLARE_SMART(STDMaterial, spSTDMaterial);
+    DECLARE_SMART(TextField, spTextField);
+    DECLARE_SMART(ThreadLoader, spThreadLoader);
+    DECLARE_SMART(Tween, spTween);
+    DECLARE_SMART(TweenQueue, spTweenQueue);
+    DECLARE_SMART(WebImage, spWebImage);
+
+
+
+
+
+    class AnimationFrame;
+
+    class Resource;
+    class ResAnim;
+    class ResFont;
+
+    struct serializedata;
+    struct deserializedata;
+    struct deserializeLinkData;
+
+    class Color;
+    class Event;
+    class Material;
+
+    class Actor;
+    class ShaderProgram;
+    class PostProcessOptions;
+
+    class UpdateState;
+    class Tween;
+    class Actor;
+    class UpdateState;
+    class UpdateState;
+    class TweenOptions;
+
+    class RenderState;
+    class Actor;
+    class ClipRectActor;
+    class MaskedSprite;
+    class Sprite;
+    class TextField;
+    class ColorRectSprite;
+    class ProgressBar;
+    DECLARE_SMART(TextField, spTextField);
+
+    DECLARE_SMART(Stage, spStage);
+    class Actor;
+    class EventState;
+
+    DECLARE_SMART(NativeTexture, spNativeTexture);
+
+    typedef unsigned int glyphOptions;
+
+    typedef int eventType;
+    class Event;
+
+    typedef int eventType;
+    DECLARE_SMART(EventDispatcher, spEventDispatcher);
+    class TouchEvent;
+
+    class ResFontBM;
+    class ResAnim;
+    class Resources;
+
+    DECLARE_SMART(TextField, spTextField);
+    DECLARE_SMART(ColorRectSprite, spColorRectSprite);
+
+
+
+    DECLARE_SMART(Texture, spTexture);
+    DECLARE_SMART(NativeTexture, spNativeTexture);
+
+
+    DECLARE_SMART(STDMaterial, spSTDMaterial);
+    DECLARE_SMART(AsyncTask, spAsyncTask);
+
+    typedef Closure<void(Event* ev)> EventCallback;
+
+
+    typedef Closure<void(const UpdateState& us)> UpdateCallback;
+    typedef Closure<void(const RenderState& rs)> RenderCallback;
+    typedef int cloneOptions;
+    typedef int copyOptions;//deprecated typedef
+
+
+    const int cloneOptionsDoNotCloneClildren = 0x01;
+    const int cloneOptionsResetTransform = 0x02;
+
+
+#define DECLARE_COPYCLONE(type) type(const type &src, cloneOptions);\
+    virtual type* clone(cloneOptions opt=0) const {return new type(*this, opt);}\
+
+
+#define DECLARE_COPYCLONE_NEW(type)  type(const type &src, cloneOptions opt = 0){copyFrom(src, opt);}\
+    virtual type* clone(cloneOptions opt=0) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}\
+    virtual void copyFrom(const type &src, cloneOptions opt = 0);
+
+#define DECLARE_COPYCLONE_NEW2(type)  type(const type &src, cloneOptions opt = 0);\
+    virtual type* clone(cloneOptions opt=0) const;\
+    virtual void copyFrom(const type &src, cloneOptions opt = 0);
+
+#define CREATE_COPYCLONE_NEW(type) type::type(const type &src, cloneOptions opt){copyFrom(src, opt);}\
+    type* type::clone(cloneOptions opt) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}
 
 }

+ 1 - 3
oxygine/src/oxygine-include.h

@@ -1,6 +1,4 @@
 #pragma once
-#ifndef OXYGINE_INCLUDE
-#define OXYGINE_INCLUDE
 #include <assert.h>
 #include <string.h>
 #include <stdio.h>
@@ -176,4 +174,4 @@ namespace oxygine
     void fastFree(void* data);
 }
 
-#endif //OXYGINE_INCLUDE
+#include "oxygine-forwards.h"