00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __ALICEML_H__
00028 #define __ALICEML_H__
00029
00030 #include "aliceml_config.h"
00031 #include "aliceml_color.h"
00032 #include "aliceml_rect.h"
00033 #include "aliceml_string.h"
00034
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038
00042 typedef enum ML_BoolIdentifier {
00044 ML_VERTICAL,
00046 ML_CONTINUE_TO_PAUSE,
00048 ML_WAIT,
00050 ML_PAUSE,
00052 ML_AUTO_NEWLINE,
00054 ML_AUTO_NEWPAGE,
00056 ML_CHAR_AUTO_HIDE,
00058 ML_CHAR_SHOWING,
00060 ML_CHAR_HIDING,
00062 ML_AUTO_REFRESH,
00063 } ML_BoolIdentifier;
00064
00068 typedef enum ML_IntIdentifier {
00070 ML_AUTOMODE_NEWLINE_WAIT,
00072 ML_AUTOMODE_NEWPAGE_WAIT,
00074 ML_AUTOMODE_PAUSE_WAIT,
00075
00077 ML_TEXT_ALIGN,
00079 ML_LINE_SPACE,
00081 ML_CHAR_SPACE,
00082
00084 ML_FONT_SIZE,
00086 ML_FONT_STYLE,
00088 ML_RUBY_SIZE,
00090 ML_RUBY_OFFSET,
00091
00093 ML_TEXT_SPEED,
00095 ML_CHAR_SHOW_TIME,
00097 ML_CHAR_SHOWING_TIME,
00099 ML_CHAR_HIDING_TIME,
00100 } ML_IntIdentifier;
00101
00105 typedef enum ML_Mode {
00106 ML_MODE_NORMAL,
00107 ML_MODE_AUTO,
00108 ML_MODE_SKIP,
00109 ML_MODE_SUSPEND,
00110 } ML_Mode;
00111
00115 typedef enum ML_TextAlign {
00116 ML_ALIGN_CENTER,
00117 ML_ALIGN_TOP,
00118 ML_ALIGN_BOTTOM,
00119 ML_ALIGN_LEFT = ML_ALIGN_TOP,
00120 ML_ALIGN_RIGHT = ML_ALIGN_BOTTOM,
00121 } ML_TextAlign;
00122
00129 typedef int ML_FontStyle;
00130 #define ML_FONTSTYLE_REGULAR 0x0000
00131 #define ML_FONTSTYLE_BOLD 0x0001
00132 #define ML_FONTSTYLE_ITALIC 0x0002
00133 #define ML_FONTSTYLE_UNDERLINE 0x0004
00134 #define ML_FONTSTYLE_SHADOW 0x0008
00135 #define ML_FONTSTYLE_HEMMING 0x0010
00136 #define ML_FONTSTYLE_VERTICAL 0x0020
00137
00138
00139 typedef struct ML_Message ML_Message;
00140 typedef struct ML_Backend ML_Backend;
00141 typedef struct ML_Surface ML_Surface;
00142 typedef struct ML_Command ML_Command;
00143 typedef struct ML_Font ML_Font;
00144
00146 typedef void (ALICEMLCALL *ML_Callback)(ML_Message *message);
00147
00149 typedef int (ALICEMLCALL *ML_Callback_Insert)(void *elem);
00150
00152 typedef void (ALICEMLCALL *ML_Callback_Remove)(void *elem);
00153
00155 typedef int (ALICEMLCALL *ML_Comparator)(const void *elem1, const void *elem2);
00156
00158 typedef void (ALICEMLCALL *ML_Callback_Text)(ML_Message *message);
00159
00161 #define ML_has_flag(var, flag) (((var) & (flag)) != 0)
00162
00164 #define ML_abs(x) ((x) >= 0 ? (x) : -(x))
00165
00167 #define ML_max(x, y) ((x) > (y) ? (x) : (y))
00168
00170 #define ML_min(x, y) ((x) < (y) ? (x) : (y))
00171
00173 #define ML_median(x, min_value, max_value) ML_min((max_value), ML_max((min_value), (x)))
00174
00176 ALICEMLAPI void * ALICEMLCALL ML_malloc(ML_size size);
00177
00179 ALICEMLAPI void ALICEMLCALL ML_free(void *ptr);
00180
00182 ALICEMLAPI void * ALICEMLCALL ML_pooled_malloc(ML_size size);
00183
00185 ALICEMLAPI void ALICEMLCALL ML_pooled_free(void *ptr);
00186
00187
00189 ALICEMLAPI ML_Message * ALICEMLCALL ML_CreateMessage(ML_Surface *surface);
00190
00192 ALICEMLAPI ML_Message * ALICEMLCALL ML_CreateMessageWithSharedSurface(ML_Surface *surface);
00193
00195 ALICEMLAPI void ALICEMLCALL ML_DestroyMessage(ML_Message *message);
00196
00198 ALICEMLAPI ML_Surface * ML_CreateSurfaceFromBackend(ML_Backend *backend, void *abstract_surface);
00199
00201 ALICEMLAPI void ALICEMLCALL ML_DestroySurface(ML_Surface *surface);
00202
00204 ALICEMLAPI ML_Surface * ALICEMLCALL ML_GetSurface(ML_Message *message);
00205
00207 ALICEMLAPI void ALICEMLCALL ML_SetPrivateData(ML_Message *message, void *data);
00208
00210 ALICEMLAPI void * ALICEMLCALL ML_GetPrivateData(ML_Message *message);
00211
00213 ALICEMLAPI int ALICEMLCALL ML_Enable(ML_Message *message, ML_BoolIdentifier id);
00214
00216 ALICEMLAPI int ALICEMLCALL ML_Disable(ML_Message *message, ML_BoolIdentifier id);
00217
00219 ALICEMLAPI int ALICEMLCALL ML_SetBool(ML_Message *message, ML_BoolIdentifier id, ML_bool value);
00220
00222 ALICEMLAPI ML_bool ALICEMLCALL ML_IsEnabled(ML_Message *message, ML_BoolIdentifier id);
00223
00225 ALICEMLAPI ML_bool ALICEMLCALL ML_IsDisabled(ML_Message *message, ML_BoolIdentifier id);
00226
00228 #define ML_GetBool ML_IsEnabled
00229
00231 ALICEMLAPI int ALICEMLCALL ML_SetInteger(ML_Message *message, ML_IntIdentifier id, int value);
00232
00234 ALICEMLAPI int ALICEMLCALL ML_GetInteger(ML_Message *message, ML_IntIdentifier id, int *value);
00235
00237 ALICEMLAPI int ALICEMLCALL ML_PushContext(ML_Message *message);
00238
00240 ALICEMLAPI int ALICEMLCALL ML_PopContext(ML_Message *message);
00241
00243 ALICEMLAPI int ALICEMLCALL ML_PushFont(ML_Message *message);
00244
00246 ALICEMLAPI int ALICEMLCALL ML_PopFont(ML_Message *message);
00247
00249 ALICEMLAPI int ALICEMLCALL ML_SetMode(ML_Message *message, ML_Mode mode);
00250
00252 ALICEMLAPI int ALICEMLCALL ML_SetAutoModeWait(ML_Message *message, int newline_wait, int newpage_wait, int pause_wait);
00253
00255 ALICEMLAPI int ALICEMLCALL ML_SetNextCharTime(ML_Message *message, int next_char_time);
00256
00258 ALICEMLAPI int ALICEMLCALL ML_SetTextShowTime(ML_Message *message, int char_showing_time, int char_show_time, int char_hiding_time);
00259
00261 ALICEMLAPI int ALICEMLCALL ML_SetLineStyle(ML_Message *message, ML_TextAlign align, int line_space, int char_space);
00262
00264 ALICEMLAPI int ALICEMLCALL ML_SetDefaultFontFace(ML_Message *message, int index);
00265
00267 ALICEMLAPI int ALICEMLCALL ML_SetFontFaceFromStr(ML_Message *message, const char *font_name, int index, ML_bool is_fullpath);
00268
00270 ALICEMLAPI int ALICEMLCALL ML_SetFontFaceFromString(ML_Message *message, ML_String8 *font_name, int index, ML_bool is_fullpath);
00271
00273 ALICEMLAPI int ALICEMLCALL ML_SetFontSize(ML_Message *message, int size);
00274
00276 ALICEMLAPI int ALICEMLCALL ML_SetFontStyle(ML_Message *message, ML_FontStyle style);
00277
00279 ALICEMLAPI int ALICEMLCALL ML_SetFontColor4ub(ML_Message *message, ML_uint8 r, ML_uint8 g, ML_uint8 b, ML_uint8 a);
00280
00282 ALICEMLAPI int ALICEMLCALL ML_SetShadowColor4ub(ML_Message *message, ML_uint8 r, ML_uint8 g, ML_uint8 b, ML_uint8 a);
00283
00285 ALICEMLAPI int ALICEMLCALL ML_SetShadowOffset(ML_Message *message, int offset_x, int offset_y);
00286
00288 ALICEMLAPI int ALICEMLCALL ML_SetHemmingColor4ub(ML_Message *message, ML_uint8 r, ML_uint8 g, ML_uint8 b, ML_uint8 a);
00289
00291 ALICEMLAPI int ALICEMLCALL ML_SetHemmingWidth(ML_Message *message, int width_x, int width_y);
00292
00294 ALICEMLAPI int ALICEMLCALL ML_SetRubyStyle(ML_Message *message, int ruby_size, int ruby_offset);
00295
00297 ALICEMLAPI int ALICEMLCALL ML_SetPosition(ML_Message *message, int left, int top);
00298
00300 ALICEMLAPI int ALICEMLCALL ML_SetSize(ML_Message *message, int width, int height);
00301
00303 ALICEMLAPI int ALICEMLCALL ML_SetBounds(ML_Message *message, int left, int top, int width, int height);
00304
00306 ALICEMLAPI int ALICEMLCALL ML_SetMargin(ML_Message *message, int marginl, int margint, int marginr, int marginb);
00307
00309 ALICEMLAPI int ALICEMLCALL ML_SetCallbackText(ML_Message *message, ML_Callback_Text callback);
00310
00312 ALICEMLAPI int ALICEMLCALL ML_Update(ML_Message *message, int dt);
00313
00315 ALICEMLAPI int ALICEMLCALL ML_Refresh(ML_Message *message);
00316
00318 ALICEMLAPI int ALICEMLCALL ML_NextPage(ML_Message *message);
00319
00321 ALICEMLAPI int ALICEMLCALL ML_PrevPage(ML_Message *message);
00322
00324 ALICEMLAPI int ALICEMLCALL ML_SetLastPage(ML_Message *message);
00325
00327 ALICEMLAPI int ALICEMLCALL ML_Background(ML_Message *message, int dt, ML_bool is_sleep);
00328
00330 ALICEMLAPI int ALICEMLCALL ML_Continue(ML_Message *message);
00331
00333 ALICEMLAPI int ALICEMLCALL ML_DrawText(ML_Message *message);
00334
00336 ALICEMLAPI int ALICEMLCALL ML_SetLastPage(ML_Message *message);
00337
00339 ALICEMLAPI int ALICEMLCALL ML_AddCharUCS4(ML_Message *message, ML_char32 c);
00340 ALICEMLAPI int ALICEMLCALL ML_AddCharUTF16(ML_Message *message, ML_char16 c);
00341 ALICEMLAPI int ALICEMLCALL ML_AddCharUTF8(ML_Message *message, ML_char8 c);
00342
00344 ALICEMLAPI int ALICEMLCALL ML_AddTextlUCS4(ML_Message *message, const ML_char32 *text, ML_size length);
00345 ALICEMLAPI int ALICEMLCALL ML_AddTextlUTF16(ML_Message *message, const ML_char16 *text, ML_size length);
00346 ALICEMLAPI int ALICEMLCALL ML_AddTextlUTF8(ML_Message *message, const ML_char8 *text, ML_size length);
00347
00349 ALICEMLAPI int ALICEMLCALL ML_AddTextUCS4(ML_Message *message, const ML_char32 *text);
00350 ALICEMLAPI int ALICEMLCALL ML_AddTextUTF16(ML_Message *message, const ML_char16 *text);
00351 ALICEMLAPI int ALICEMLCALL ML_AddTextUTF8(ML_Message *message, const ML_char8 *text);
00352
00354 ALICEMLAPI int ALICEMLCALL ML_AddTextWithRubyUCS4(ML_Message *message, const ML_char32 *text, const ML_char32 *reading);
00355 ALICEMLAPI int ALICEMLCALL ML_AddTextWithRubyUTF16(ML_Message *message, const ML_char16 *text, const ML_char16 *reading);
00356 ALICEMLAPI int ALICEMLCALL ML_AddTextWithRubyUTF8(ML_Message *message, const ML_char8 *text, const ML_char8 *reading);
00357
00359 ALICEMLAPI int ALICEMLCALL ML_AddLinklUCS4(ML_Message *message, int id, const ML_char32 *text, ML_size length);
00360 ALICEMLAPI int ALICEMLCALL ML_AddLinklUTF16(ML_Message *message, int id, const ML_char16 *text, ML_size length);
00361 ALICEMLAPI int ALICEMLCALL ML_AddLinklUTF8(ML_Message *message, int id, const ML_char8 *text, ML_size length);
00362
00364 ALICEMLAPI int ALICEMLCALL ML_AddLinkUCS4(ML_Message *message, int id, const ML_char32 *text);
00365 ALICEMLAPI int ALICEMLCALL ML_AddLinkUTF16(ML_Message *message, int id, const ML_char16 *text);
00366 ALICEMLAPI int ALICEMLCALL ML_AddLinkUTF8(ML_Message *message, int id, const ML_char8 *text);
00367
00368 #if ML_WCHAR_SIZE == 4
00369 #define ML_AddCharWChar ML_AddCharUCS4
00370 #define ML_AddTextlWChar ML_AddTextlUCS4
00371 #define ML_AddTextWChar ML_AddTextUCS4
00372 #define ML_AddLinklWChar ML_AddLinklUCS4
00373 #define ML_AddLinkWChar ML_AddLinkUCS4
00374 #define ML_AddTextWithRubyWChar ML_AddTextWithRubyUCS4
00375 #else
00376 #define ML_AddCharWChar ML_AddCharUTF16
00377 #define ML_AddTextlWChar ML_AddTextlUTF16
00378 #define ML_AddTextWChar ML_AddTextUTF16
00379 #define ML_AddLinklWChar ML_AddLinklUTF16
00380 #define ML_AddLinkWChar ML_AddLinkUTF16
00381 #define ML_AddTextWithRubyWChar ML_AddTextWithRubyUTF16
00382 #endif
00383
00385
00386
00388 ALICEMLAPI int ALICEMLCALL ML_AddCommand(ML_Message *message, ML_Command *command);
00389
00391 ALICEMLAPI int ALICEMLCALL ML_AddNewLine(ML_Message *message);
00392
00394 ALICEMLAPI int ALICEMLCALL ML_AddNewPage(ML_Message *message);
00395
00397 ALICEMLAPI int ALICEMLCALL ML_AddPause(ML_Message *message);
00398
00400 ALICEMLAPI int ALICEMLCALL ML_AddWait(ML_Message *message, int time, ML_bool can_skip);
00401
00403 ALICEMLAPI int ALICEMLCALL ML_MakeHistory(ML_Message *from, ML_Message *to);
00404
00406 ALICEMLAPI int ALICEMLCALL ML_Clear(ML_Message *message);
00407
00409 ALICEMLAPI ML_bool ALICEMLCALL ML_IsCommandFull(ML_Message *message);
00410
00412 ALICEMLAPI ML_size ALICEMLCALL ML_GetCommandSize(ML_Message *message);
00413
00415 ALICEMLAPI int ALICEMLCALL ML_AddAvoidRect(ML_Message *message, ML_Rect *rect);
00416
00418 ALICEMLAPI int ALICEMLCALL ML_GetAvoidRectSize(ML_Message *message);
00419
00421 ALICEMLAPI ML_Rect * ALICEMLCALL ML_GetAvoidRect(ML_Message *message, int i);
00422
00424 ALICEMLAPI void ALICEMLCALL ML_ClearAvoidRect(ML_Message *message);
00425
00427 ALICEMLAPI int ALICEMLCALL ML_AddDirtyRect(ML_Message *message, ML_Rect *rect);
00428
00430 ALICEMLAPI int ALICEMLCALL ML_GetDirtyRectSize(ML_Message *message);
00431
00433 ALICEMLAPI ML_Rect * ALICEMLCALL ML_GetDirtyRect(ML_Message *message, int i);
00434
00436 ALICEMLAPI ML_bool ALICEMLCALL ML_IntersectDirtyRect(ML_Message *message, ML_Rect *rect);
00437
00439 ALICEMLAPI int ALICEMLCALL ML_GetLinkID(ML_Message *message, int x, int y);
00440
00441
00443 ALICEMLAPI void ALICEMLCALL ML_SetError(const char *format, ...);
00444
00446 ALICEMLAPI const char * ALICEMLCALL ML_GetError();
00447
00449 ALICEMLAPI void ALICEMLCALL ML_ClearError();
00450
00452 ALICEMLAPI int ALICEMLCALL ML_CheckMemory();
00453
00458 ALICEMLAPI ML_String8 * ALICEMLCALL ML_MakeFontPath(const ML_char8 *fontfile);
00459
00461 ALICEMLAPI ML_String8 * ALICEMLCALL ML_GetDefaultFont();
00462
00464 ALICEMLAPI ML_uint32 ALICEMLCALL ML_GetTicks();
00465
00467 ALICEMLAPI int ALICEMLCALL ML_Delay(ML_uint32 time);
00468
00469 #ifdef __cplusplus
00470 }
00471 #endif
00472
00473 #endif
00474