Skip to content

Commit

Permalink
libcommon: Switched g_game.c, hu_menu.c to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Feb 18, 2014
1 parent 1363fdf commit afb1f2a
Show file tree
Hide file tree
Showing 22 changed files with 7,176 additions and 6,820 deletions.
4 changes: 2 additions & 2 deletions doomsday/plugins/common/common.pri
Expand Up @@ -88,7 +88,7 @@ SOURCES += \
$$common_src/g_controls.c \
$$common_src/g_defs.c \
$$common_src/g_eventsequence.cpp \
$$common_src/g_game.c \
$$common_src/g_game.cpp \
$$common_src/g_update.c \
$$common_src/gamerules.c \
$$common_src/gamestatereader.cpp \
Expand All @@ -100,7 +100,7 @@ SOURCES += \
$$common_src/hu_inventory.c \
$$common_src/hu_lib.c \
$$common_src/hu_log.c \
$$common_src/hu_menu.c \
$$common_src/hu_menu.cpp \
$$common_src/hu_msg.c \
$$common_src/hu_pspr.c \
$$common_src/hu_stuff.cpp \
Expand Down
118 changes: 116 additions & 2 deletions doomsday/plugins/common/include/hu_lib.h
Expand Up @@ -214,6 +214,10 @@ typedef struct mn_object_s {
int timer;
} mn_object_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_obtype_e MNObject_Type(const mn_object_t* obj);

struct mn_page_s* MNObject_Page(const mn_object_t* obj);
Expand Down Expand Up @@ -298,6 +302,10 @@ dd_bool MNObject_HasAction(mn_object_t* obj, mn_actionid_t action);
*/
int MNObject_ExecAction(mn_object_t* obj, mn_actionid_t action, void* paramaters);

#ifdef __cplusplus
} // extern "C"
#endif

typedef enum {
MENU_COLOR1 = 0,
MENU_COLOR2,
Expand Down Expand Up @@ -380,6 +388,10 @@ typedef struct mn_page_s {
int timer;
} mn_page_t;

#ifdef __cplusplus
extern "C" {
#endif

void MNPage_Initialize(mn_page_t* page);

/// Call the ticker routine for each object.
Expand Down Expand Up @@ -461,6 +473,10 @@ int MNPage_LineHeight(mn_page_t *page/*, lineOffset = 0*/);
/// @return Current time in tics since page activation.
int MNPage_Timer(mn_page_t* page);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* Rect objects.
*/
Expand All @@ -472,6 +488,10 @@ typedef struct mndata_rect_s {
patchid_t patch;
} mndata_rect_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNRect_New(void);
void MNRect_Delete(mn_object_t* ob);

Expand All @@ -488,6 +508,10 @@ void MNRect_UpdateGeometry(mn_object_t* ob, mn_page_t* page);
*/
void MNRect_SetBackgroundPatch(mn_object_t* ob, patchid_t patch);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* @defgroup mnTextFlags MNText Flags
*/
Expand All @@ -508,6 +532,10 @@ typedef struct mndata_text_s {
int flags;
} mndata_text_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNText_New(void);
void MNText_Delete(mn_object_t* ob);

Expand All @@ -517,6 +545,10 @@ void MNText_UpdateGeometry(mn_object_t* ob, mn_page_t* page);

int MNText_SetFlags(mn_object_t* ob, flagop_t op, int flags);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* @defgroup mnButtonFlags MNButton Flags
*/
Expand Down Expand Up @@ -544,6 +576,10 @@ typedef struct mndata_button_s {
int flags;
} mndata_button_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNButton_New(void);
void MNButton_Delete(mn_object_t* ob);

Expand All @@ -554,6 +590,10 @@ void MNButton_UpdateGeometry(mn_object_t* ob, mn_page_t* page);

int MNButton_SetFlags(mn_object_t* ob, flagop_t op, int flags);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* Edit field.
*/
Expand Down Expand Up @@ -587,6 +627,10 @@ typedef struct mndata_edit_s {
int data2;
} mndata_edit_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNEdit_New(void);
void MNEdit_Delete(mn_object_t* ob);

Expand Down Expand Up @@ -617,6 +661,10 @@ const ddstring_t* MNEdit_Text(mn_object_t* ob);
*/
void MNEdit_SetText(mn_object_t* ob, int flags, const char* string);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* List selection.
*/
Expand All @@ -641,6 +689,10 @@ typedef struct mndata_list_s {
int numvis;
} mndata_list_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNList_New(void);
void MNList_Delete(mn_object_t* ob);

Expand Down Expand Up @@ -693,6 +745,10 @@ dd_bool MNList_SelectItem(mn_object_t* ob, int flags, int itemIndex);
*/
dd_bool MNList_SelectItemByValue(mn_object_t* ob, int flags, int itemIndex);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* Color preview box.
*/
Expand All @@ -711,6 +767,10 @@ typedef struct mndata_colorbox_s {
void* data4;
} mndata_colorbox_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNColorBox_New(void);
void MNColorBox_Delete(mn_object_t* ob);

Expand Down Expand Up @@ -777,6 +837,10 @@ dd_bool MNColorBox_SetAlphaf(mn_object_t* ob, int flags, float alpha);
*/
dd_bool MNColorBox_CopyColor(mn_object_t* ob, int flags, const mn_object_t* otherObj);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* Graphical slider.
*/
Expand Down Expand Up @@ -811,6 +875,10 @@ typedef struct mndata_slider_s {
void* data5;
} mndata_slider_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNSlider_New(void);
void MNSlider_Delete(mn_object_t* ob);

Expand Down Expand Up @@ -839,6 +907,10 @@ float MNSlider_Value(const mn_object_t* ob);
*/
void MNSlider_SetValue(mn_object_t* ob, int flags, float value);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* Mobj preview visual.
*/
Expand All @@ -852,6 +924,10 @@ typedef struct mndata_mobjpreview_s {
int plrClass; /// Player class identifier.
} mndata_mobjpreview_t;

#ifdef __cplusplus
extern "C" {
#endif

mn_object_t* MNMobjPreview_New(void);
void MNMobjPreview_Delete(mn_object_t* ob);

Expand All @@ -864,6 +940,10 @@ void MNMobjPreview_SetTranslationMap(mn_object_t* ob, int tMap);
void MNMobjPreview_Drawer(mn_object_t* ob, const Point2Raw* origin);
void MNMobjPreview_UpdateGeometry(mn_object_t* ob, mn_page_t* page);

#ifdef __cplusplus
} // extern "C"
#endif

// Menu render state:
typedef struct mn_rendstate_s {
float pageAlpha;
Expand All @@ -872,7 +952,8 @@ typedef struct mn_rendstate_s {
float textColors[MENU_COLOR_COUNT][4];
fontid_t textFonts[MENU_FONT_COUNT];
} mn_rendstate_t;
extern const mn_rendstate_t* mnRendState;

DENG_EXTERN_C mn_rendstate_t const *mnRendState;

/**
* @defgroup menuEffectFlags Menu Effect Flags
Expand All @@ -885,6 +966,10 @@ extern const mn_rendstate_t* mnRendState;
#define MEF_EVERYTHING (MEF_TEXT_TYPEIN|MEF_TEXT_SHADOW|MEF_TEXT_GLITTER)
///@}

#ifdef __cplusplus
extern "C" {
#endif

short MN_MergeMenuEffectWithDrawTextFlags(short f);

mn_object_t* MN_MustFindObjectOnPage(mn_page_t* page, int group, int flags);
Expand All @@ -896,6 +981,10 @@ void MN_DrawPage(mn_page_t* page, float alpha, dd_bool showFocusCursor);
*/
void Hu_MenuCommand(menucommand_e cmd);

#ifdef __cplusplus
} // extern "C"
#endif

typedef enum {
GUI_NONE,
GUI_BOX,
Expand Down Expand Up @@ -982,6 +1071,10 @@ typedef struct uiwidget_s {
void* typedata;
} uiwidget_t;

#ifdef __cplusplus
extern "C" {
#endif

void GUI_DrawWidget(uiwidget_t* obj, const Point2Raw* origin);
void GUI_DrawWidgetXY(uiwidget_t* obj, int x, int y);

Expand Down Expand Up @@ -1018,6 +1111,10 @@ void UIWidget_SetMaximumSize(uiwidget_t* obj, const Size2Raw* size);

void UIWidget_SetMaximumWidth(uiwidget_t* obj, int width);

#ifdef __cplusplus
} // extern "C"
#endif

/**
* @defgroup uiWidgetGroupFlags UIWidget Group Flags
*/
Expand All @@ -1039,12 +1136,20 @@ typedef struct {
uiwidgetid_t* widgetIds;
} guidata_group_t;

#ifdef __cplusplus
extern "C" {
#endif

void UIGroup_AddWidget(uiwidget_t* obj, uiwidget_t* other);
int UIGroup_Flags(uiwidget_t* obj);
void UIGroup_SetFlags(uiwidget_t* obj, int flags);

void UIGroup_UpdateGeometry(uiwidget_t* obj);

#ifdef __cplusplus
} // extern "C"
#endif

typedef struct {
int value;
} guidata_health_t;
Expand Down Expand Up @@ -1206,6 +1311,10 @@ typedef struct {
} guidata_flight_t;
#endif

#ifdef __cplusplus
extern "C" {
#endif

void GUI_Register(void);

void GUI_Init(void);
Expand All @@ -1225,9 +1334,14 @@ uiwidgetid_t GUI_CreateWidget(guiwidgettype_t type, int player, int alignFlags,

uiwidgetid_t GUI_CreateGroup(int groupFlags, int player, int alignFlags, order_t order, int padding);

#ifdef __cplusplus
} // extern "C"
#endif

typedef struct ui_rendstate_s {
float pageAlpha;
} ui_rendstate_t;
extern const ui_rendstate_t* uiRendState;

DENG_EXTERN_C const ui_rendstate_t* uiRendState;

#endif /* LIBCOMMON_UI_LIBRARY_H */
6 changes: 3 additions & 3 deletions doomsday/plugins/common/include/hu_menu.h
Expand Up @@ -33,6 +33,9 @@
#include "dd_types.h"
#include "hu_lib.h"

DENG_EXTERN_C int menuTime;
DENG_EXTERN_C dd_bool menuNominatingQuickSaveSlot;

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -86,9 +89,6 @@ extern "C" {
#define MENU_CURSOR_FRAMECOUNT 2
#define MENU_CURSOR_TICSPERFRAME 8

extern int menuTime;
extern dd_bool menuNominatingQuickSaveSlot;

/// Register the console commands, variables, etc..., of this module.
void Hu_MenuRegister(void);

Expand Down

0 comments on commit afb1f2a

Please sign in to comment.