Skip to content

Commit

Permalink
Added public API for the Svg module
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 3, 2013
1 parent da8afad commit 5e68d0a
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 26 deletions.
Expand Up @@ -20,35 +20,38 @@
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_API_VECTORGRAPHIC_H
#define LIBDENG_API_VECTORGRAPHIC_H
#ifndef DOOMSDAY_API_VECTORGRAPHIC_H
#define DOOMSDAY_API_VECTORGRAPHIC_H

/// @addtogroup gl
///@{
#include <de/point.h>
#include "apis.h"

typedef uint32_t svgid_t;

#include <de/point.h>

typedef struct def_svgline_s {
uint numPoints;
const Point2Rawf* points;
} def_svgline_t;

#ifdef __cplusplus
extern "C" {
DENG_API_TYPEDEF(Svg)
{
de_api_t api;
void (*NewSvg)(svgid_t svgId, const def_svgline_t* lines, uint numLines);
void (*DrawSvg)(svgid_t svgId, const Point2Rawf* origin);
void (*DrawSvg2)(svgid_t svgId, const Point2Rawf* origin, float scale);
void (*DrawSvg3)(svgid_t svgId, const Point2Rawf* origin, float scale, float angle);
}
DENG_API_T(Svg);

#ifndef DENG_NO_API_MACROS_SVG
#define R_NewSvg _api_Svg.NewSvg
#define GL_DrawSvg _api_Svg.DrawSvg
#define GL_DrawSvg2 _api_Svg.DrawSvg2
#define GL_DrawSvg3 _api_Svg.DrawSvg3
#endif

void R_NewSvg(svgid_t svgId, const def_svgline_t* lines, uint numLines);

void GL_DrawSvg(svgid_t svgId, const Point2Rawf* origin);
void GL_DrawSvg2(svgid_t svgId, const Point2Rawf* origin, float scale);
void GL_DrawSvg3(svgid_t svgId, const Point2Rawf* origin, float scale, float angle);

#ifdef __cplusplus
} // extern "C"
#ifdef __DOOMSDAY__
DENG_USING_API(Svg);
#endif

///@}

#endif /* LIBDENG_API_VECTORGRAPHIC_H */
#endif /* DOOMSDAY_API_VECTORGRAPHIC_H */
9 changes: 6 additions & 3 deletions doomsday/engine/api/apis.h
Expand Up @@ -63,13 +63,16 @@ enum {
DE_API_SOUND_v1 = 1200, // 1.10
DE_API_SOUND_latest = DE_API_SOUND_v1,

DE_API_THINKER_v1 = 1300, // 1.10
DE_API_SVG_v1 = 1300, // 1.10
DE_API_SVG_latest = DE_API_SVG_v1,

DE_API_THINKER_v1 = 1400, // 1.10
DE_API_THINKER_latest = DE_API_THINKER_v1,

DE_API_URI_v1 = 1400, // 1.10
DE_API_URI_v1 = 1500, // 1.10
DE_API_URI_latest = DE_API_URI_v1,

DE_API_WAD_v1 = 1500, // 1.10
DE_API_WAD_v1 = 1600, // 1.10
DE_API_WAD_latest = DE_API_WAD_v1
};

Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_ui.h
Expand Up @@ -28,7 +28,7 @@

#include <de/animator.h>
#include "api_fontrender.h"
#include "dd_vectorgraphic.h"
#include "api_svg.h"

/**
* @defgroup gui GUI
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/engine.pro
Expand Up @@ -92,6 +92,7 @@ DENG_API_HEADERS = \
api/api_player.h \
api/api_plugin.h \
api/api_sound.h \
api/api_svg.h \
api/api_thinker.h \
api/api_uri.h \
api/api_wad.h \
Expand All @@ -102,7 +103,6 @@ DENG_API_HEADERS = \
api/dd_share.h \
api/dd_types.h \
api/dd_ui.h \
api/dd_vectorgraphic.h \
api/dd_version.h \
api/dd_world.h \
api/def_share.h \
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/include/gl/svg.h
Expand Up @@ -23,7 +23,7 @@
#ifndef LIBDENG_REFRESH_SVG_H
#define LIBDENG_REFRESH_SVG_H

#include "dd_vectorgraphic.h"
#include "api_svg.h"

struct svgline_s;
typedef struct svgline_s SvgLine;
Expand Down
11 changes: 11 additions & 0 deletions doomsday/engine/src/gl/gl_drawvectorgraphic.c
Expand Up @@ -21,6 +21,8 @@
* Boston, MA 02110-1301 USA
*/

#define DENG_NO_API_MACROS_SVG

#include <string.h>
#include <assert.h>

Expand Down Expand Up @@ -235,3 +237,12 @@ void R_NewSvg(svgid_t id, const def_svgline_t* lines, uint numLines)
// Add the new SVG to the global collection.
insertSvg(svg);
}

DENG_DECLARE_API(Svg) =
{
{ DE_API_SVG_latest },
R_NewSvg,
GL_DrawSvg,
GL_DrawSvg2,
GL_DrawSvg3
};
1 change: 1 addition & 0 deletions doomsday/engine/src/library.cpp
Expand Up @@ -185,6 +185,7 @@ void Library_PublishAPIs(Library *lib)
PUBLISH(_api_Player);
PUBLISH(_api_Plug);
PUBLISH(_api_S);
PUBLISH(_api_Svg);
PUBLISH(_api_Thinker);
PUBLISH(_api_Uri);
PUBLISH(_api_W);
Expand Down
1 change: 1 addition & 0 deletions doomsday/plugins/jdoom/include/d_api.h
Expand Up @@ -55,6 +55,7 @@ DENG_USING_API(MPE);
DENG_USING_API(Player);
DENG_USING_API(Plug);
DENG_USING_API(S);
DENG_USING_API(Svg);
DENG_USING_API(Thinker);
DENG_USING_API(Uri);
DENG_USING_API(W);
Expand Down
2 changes: 2 additions & 0 deletions doomsday/plugins/jdoom/src/d_api.c
Expand Up @@ -291,6 +291,7 @@ DENG_DECLARE_API(MPE);
DENG_DECLARE_API(Player);
DENG_DECLARE_API(Plug);
DENG_DECLARE_API(S);
DENG_DECLARE_API(Svg);
DENG_DECLARE_API(Thinker);
DENG_DECLARE_API(Uri);
DENG_DECLARE_API(W);
Expand All @@ -308,6 +309,7 @@ DENG_API_EXCHANGE(
DENG_GET_API(DE_API_PLAYER_latest, Player);
DENG_GET_API(DE_API_PLUGIN_latest, Plug);
DENG_GET_API(DE_API_SOUND_latest, S);
DENG_GET_API(DE_API_SVG_latest, Svg);
DENG_GET_API(DE_API_THINKER_latest, Thinker);
DENG_GET_API(DE_API_URI_latest, Uri);
DENG_GET_API(DE_API_WAD_latest, W);
Expand Down
2 changes: 1 addition & 1 deletion doomsday/server/server.pro
Expand Up @@ -86,6 +86,7 @@ DENG_API_HEADERS = \
$$SRC/api/api_player.h \
$$SRC/api/api_plugin.h \
$$SRC/api/api_sound.h \
$$SRC/api/api_svg.h \
$$SRC/api/api_thinker.h \
$$SRC/api/api_uri.h \
$$SRC/api/api_wad.h \
Expand All @@ -96,7 +97,6 @@ DENG_API_HEADERS = \
$$SRC/api/dd_share.h \
$$SRC/api/dd_types.h \
$$SRC/api/dd_ui.h \
$$SRC/api/dd_vectorgraphic.h \
$$SRC/api/dd_version.h \
$$SRC/api/dd_world.h \
$$SRC/api/def_share.h \
Expand Down

0 comments on commit 5e68d0a

Please sign in to comment.