--- deliantra/Deliantra-Client/Client.xs 2007/12/26 20:46:39 1.241 +++ deliantra/Deliantra-Client/Client.xs 2007/12/26 21:03:21 1.242 @@ -122,12 +122,12 @@ #include "pango-fontmap.c" #include "pango-render.c" -typedef IV dc__Channel; -typedef SDL_RWops *dc__RW; -typedef Mix_Chunk *dc__MixChunk; -typedef Mix_Music *dc__MixMusic; +typedef IV DC__Channel; +typedef SDL_RWops *DC__RW; +typedef Mix_Chunk *DC__MixChunk; +typedef Mix_Music *DC__MixMusic; -typedef PangoFontDescription *dc__Font; +typedef PangoFontDescription *DC__Font; static int shape_attr_p (PangoLayoutRun *run) @@ -151,11 +151,11 @@ PangoLayout *pl; float r, g, b, a; // default color for rgba mode int base_height; - dc__Font font; + DC__Font font; rc_t *rc; -} *dc__Layout; +} *DC__Layout; -static dc__Font default_font; +static DC__Font default_font; static PangoContext *opengl_context; static PangoFontMap *opengl_fontmap; @@ -170,7 +170,7 @@ } static void -layout_update_font (dc__Layout self) +layout_update_font (DC__Layout self) { /* use a random scale factor to account for unknown descenders, 0.8 works * reasonably well with bitstream vera @@ -184,7 +184,7 @@ } static void -layout_get_pixel_size (dc__Layout self, int *w, int *h) +layout_get_pixel_size (DC__Layout self, int *w, int *h) { PangoRectangle rect; @@ -233,7 +233,7 @@ int32_t rows; maprow *row; -} *dc__Map; +} *DC__Map; static char * prepend (char *ptr, int sze, int inc) @@ -281,7 +281,7 @@ } static maprow * -map_get_row (dc__Map self, int y) +map_get_row (DC__Map self, int y) { if (0 > y) { @@ -329,13 +329,13 @@ } static mapcell * -map_get_cell (dc__Map self, int x, int y) +map_get_cell (DC__Map self, int x, int y) { return row_get_cell (map_get_row (self, y), x); } static void -map_clear (dc__Map self) +map_clear (DC__Map self) { int r; @@ -353,7 +353,7 @@ } static void -map_blank (dc__Map self, int x0, int y0, int w, int h) +map_blank (DC__Map self, int x0, int y0, int w, int h) { int x, y; maprow *row; @@ -500,13 +500,13 @@ return 1; } -MODULE = Deliantra::Client PACKAGE = dc +MODULE = Deliantra::Client PACKAGE = DC PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("dc", 1); + HV *stash = gv_stashpv ("DC", 1); static const struct { const char *name; IV iv; @@ -827,7 +827,7 @@ break; } - XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("dc::UI::Event", 1)))); + XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("DC::UI::Event", 1)))); } } @@ -1025,11 +1025,11 @@ #endif } -MODULE = Deliantra::Client PACKAGE = dc::Font +MODULE = Deliantra::Client PACKAGE = DC::Font PROTOTYPES: DISABLE -dc::Font +DC::Font new_from_file (SV *class, char *path, int id = 0) CODE: { @@ -1042,17 +1042,17 @@ RETVAL void -DESTROY (dc::Font self) +DESTROY (DC::Font self) CODE: pango_font_description_free (self); void -make_default (dc::Font self) +make_default (DC::Font self) PROTOTYPE: $ CODE: default_font = self; -MODULE = Deliantra::Client PACKAGE = dc::Layout +MODULE = Deliantra::Client PACKAGE = DC::Layout PROTOTYPES: DISABLE @@ -1068,7 +1068,7 @@ CODE: tc_restore (); -dc::Layout +DC::Layout new (SV *class) CODE: New (0, RETVAL, 1, struct cf_layout); @@ -1088,14 +1088,14 @@ RETVAL void -DESTROY (dc::Layout self) +DESTROY (DC::Layout self) CODE: g_object_unref (self->pl); rc_free (self->rc); Safefree (self); void -set_text (dc::Layout self, SV *text_) +set_text (DC::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1105,7 +1105,7 @@ } void -set_markup (dc::Layout self, SV *text_) +set_markup (DC::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1115,7 +1115,7 @@ } void -set_shapes (dc::Layout self, ...) +set_shapes (DC::Layout self, ...) CODE: { PangoAttrList *attrs = 0; @@ -1160,7 +1160,7 @@ } void -get_shapes (dc::Layout self) +get_shapes (DC::Layout self) PPCODE: { PangoLayoutIter *iter = pango_layout_get_iter (self->pl); @@ -1185,7 +1185,7 @@ } int -has_wrapped (dc::Layout self) +has_wrapped (DC::Layout self) CODE: { int lines = 1; @@ -1200,7 +1200,7 @@ RETVAL SV * -get_text (dc::Layout self) +get_text (DC::Layout self) CODE: RETVAL = newSVpv (pango_layout_get_text (self->pl), 0); sv_utf8_decode (RETVAL); @@ -1208,7 +1208,7 @@ RETVAL void -set_foreground (dc::Layout self, float r, float g, float b, float a = 1.) +set_foreground (DC::Layout self, float r, float g, float b, float a = 1.) CODE: self->r = r; self->g = g; @@ -1216,7 +1216,7 @@ self->a = a; void -set_font (dc::Layout self, dc::Font font = 0) +set_font (DC::Layout self, DC::Font font = 0) CODE: if (self->font != font) { @@ -1225,7 +1225,7 @@ } void -set_height (dc::Layout self, int base_height) +set_height (DC::Layout self, int base_height) CODE: if (self->base_height != base_height) { @@ -1234,22 +1234,22 @@ } void -set_width (dc::Layout self, int max_width = -1) +set_width (DC::Layout self, int max_width = -1) CODE: pango_layout_set_width (self->pl, max_width < 0 ? max_width : max_width * PANGO_SCALE); void -set_indent (dc::Layout self, int indent) +set_indent (DC::Layout self, int indent) CODE: pango_layout_set_indent (self->pl, indent * PANGO_SCALE); void -set_spacing (dc::Layout self, int spacing) +set_spacing (DC::Layout self, int spacing) CODE: pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); void -set_ellipsise (dc::Layout self, int ellipsise) +set_ellipsise (DC::Layout self, int ellipsise) CODE: pango_layout_set_ellipsize (self->pl, ellipsise == 1 ? PANGO_ELLIPSIZE_START @@ -1259,12 +1259,12 @@ ); void -set_single_paragraph_mode (dc::Layout self, int spm) +set_single_paragraph_mode (DC::Layout self, int spm) CODE: pango_layout_set_single_paragraph_mode (self->pl, !!spm); void -size (dc::Layout self) +size (DC::Layout self) PPCODE: { int w, h; @@ -1277,7 +1277,7 @@ } int -descent (dc::Layout self) +descent (DC::Layout self) CODE: { PangoRectangle rect; @@ -1289,7 +1289,7 @@ RETVAL int -xy_to_index (dc::Layout self, int x, int y) +xy_to_index (DC::Layout self, int x, int y) CODE: { int index, trailing; @@ -1300,7 +1300,7 @@ RETVAL void -cursor_pos (dc::Layout self, int index) +cursor_pos (DC::Layout self, int index) PPCODE: { PangoRectangle strong_pos; @@ -1313,7 +1313,7 @@ } void -index_to_line_x (dc::Layout self, int index, int trailing = 0) +index_to_line_x (DC::Layout self, int index, int trailing = 0) PPCODE: { int line, x; @@ -1327,7 +1327,7 @@ } void -line_x_to_index (dc::Layout self, int line, int x) +line_x_to_index (DC::Layout self, int line, int x) PPCODE: { PangoLayoutLine *lp; @@ -1352,7 +1352,7 @@ } void -render (dc::Layout self, float x, float y, int flags = 0) +render (DC::Layout self, float x, float y, int flags = 0) CODE: rc_clear (self->rc); pango_opengl_render_layout_subpixel ( @@ -1367,7 +1367,7 @@ pango_layout_context_changed (self->pl); void -draw (dc::Layout self) +draw (DC::Layout self) CODE: { glEnable (GL_TEXTURE_2D); @@ -1385,7 +1385,7 @@ glDisable (GL_TEXTURE_2D); } -MODULE = Deliantra::Client PACKAGE = dc::Texture +MODULE = Deliantra::Client PACKAGE = DC::Texture PROTOTYPES: ENABLE @@ -1474,11 +1474,11 @@ OUTPUT: RETVAL -MODULE = Deliantra::Client PACKAGE = dc::Map +MODULE = Deliantra::Client PACKAGE = DC::Map PROTOTYPES: DISABLE -dc::Map +DC::Map new (SV *class) CODE: New (0, RETVAL, 1, struct map); @@ -1496,7 +1496,7 @@ RETVAL void -DESTROY (dc::Map self) +DESTROY (DC::Map self) CODE: { map_clear (self); @@ -1506,18 +1506,18 @@ } void -resize (dc::Map self, int map_width, int map_height) +resize (DC::Map self, int map_width, int map_height) CODE: self->w = map_width; self->h = map_height; void -clear (dc::Map self) +clear (DC::Map self) CODE: map_clear (self); void -set_tileid (dc::Map self, int face, int tile) +set_tileid (DC::Map self, int face, int tile) CODE: { need_facenum (self, face); self->face2tile [face] = tile; @@ -1525,7 +1525,7 @@ } void -set_smooth (dc::Map self, int face, int smooth, int level) +set_smooth (DC::Map self, int face, int smooth, int level) CODE: { tileid texid; @@ -1548,7 +1548,7 @@ } void -set_texture (dc::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) +set_texture (DC::Map self, int texid, int name, int w, int h, float s, float t, int r, int g, int b, int a) CODE: { need_texid (self, texid); @@ -1578,7 +1578,7 @@ } int -ox (dc::Map self) +ox (DC::Map self) ALIAS: oy = 1 x = 2 @@ -1599,7 +1599,7 @@ RETVAL void -scroll (dc::Map self, int dx, int dy) +scroll (DC::Map self, int dx, int dy) CODE: { if (dx > 0) @@ -1625,7 +1625,7 @@ } SV * -map1a_update (dc::Map self, SV *data_, int extmap) +map1a_update (DC::Map self, SV *data_, int extmap) CODE: { uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); @@ -1724,7 +1724,7 @@ RETVAL SV * -mapmap (dc::Map self, int x0, int y0, int w, int h) +mapmap (DC::Map self, int x0, int y0, int w, int h) CODE: { int x1, x; @@ -1779,7 +1779,7 @@ RETVAL void -draw (dc::Map self, int mx, int my, int sw, int sh, int T) +draw (DC::Map self, int mx, int my, int sw, int sh, int T) CODE: { int x, y, z; @@ -2060,7 +2060,7 @@ } void -draw_magicmap (dc::Map self, int dx, int dy, int w, int h, unsigned char *data) +draw_magicmap (DC::Map self, int dx, int dy, int w, int h, unsigned char *data) CODE: { static float color[16][3] = { @@ -2120,7 +2120,7 @@ } void -fow_texture (dc::Map self, int mx, int my, int sw, int sh) +fow_texture (DC::Map self, int mx, int my, int sw, int sh) PPCODE: { int x, y; @@ -2201,7 +2201,7 @@ } SV * -get_rect (dc::Map self, int x0, int y0, int w, int h) +get_rect (DC::Map self, int x0, int y0, int w, int h) CODE: { int x, y, x1, y1; @@ -2276,7 +2276,7 @@ RETVAL void -set_rect (dc::Map self, int x0, int y0, uint8_t *data) +set_rect (DC::Map self, int x0, int y0, uint8_t *data) PPCODE: { int x, y, z; @@ -2339,9 +2339,9 @@ } } -MODULE = Deliantra::Client PACKAGE = dc::RW +MODULE = Deliantra::Client PACKAGE = DC::RW -dc::RW +DC::RW new (SV *class, SV *data_sv) CODE: { @@ -2353,7 +2353,7 @@ OUTPUT: RETVAL -dc::RW +DC::RW new_from_file (SV *class, const char *path, const char *mode = "rb") CODE: RETVAL = SDL_RWFromFile (path, mode); @@ -2363,15 +2363,15 @@ # fails on win32: # dc.xs(2268) : error C2059: syntax error : '(' #void -#close (dc::RW self) +#close (DC::RW self) # CODE: # (self->(close)) (self); -MODULE = Deliantra::Client PACKAGE = dc::Channel +MODULE = Deliantra::Client PACKAGE = DC::Channel PROTOTYPES: DISABLE -dc::Channel +DC::Channel find () CODE: { @@ -2394,50 +2394,50 @@ RETVAL void -halt (dc::Channel self) +halt (DC::Channel self) CODE: Mix_HaltChannel (self); void -expire (dc::Channel self, int ticks = -1) +expire (DC::Channel self, int ticks = -1) CODE: Mix_ExpireChannel (self, ticks); void -fade_out (dc::Channel self, int ticks = -1) +fade_out (DC::Channel self, int ticks = -1) CODE: Mix_FadeOutChannel (self, ticks); int -volume (dc::Channel self, int volume) +volume (DC::Channel self, int volume) CODE: RETVAL = Mix_Volume (self, CLAMP (volume, 0, 128)); OUTPUT: RETVAL void -unregister_all_effects (dc::Channel self) +unregister_all_effects (DC::Channel self) CODE: Mix_UnregisterAllEffects (self); void -set_panning (dc::Channel self, int left, int right) +set_panning (DC::Channel self, int left, int right) CODE: left = CLAMP (left , 0, 255); right = CLAMP (right, 0, 255); Mix_SetPanning (self, left, right); void -set_distance (dc::Channel self, int distance) +set_distance (DC::Channel self, int distance) CODE: Mix_SetDistance (self, CLAMP (distance, 0, 255)); void -set_position (dc::Channel self, int angle, int distance) +set_position (DC::Channel self, int angle, int distance) CODE: void -set_position_r (dc::Channel self, int dx, int dy, int maxdistance) +set_position_r (DC::Channel self, int dx, int dy, int maxdistance) CODE: { int distance = sqrtf (dx * dx + dy * dy) * (255.f / sqrtf (maxdistance * maxdistance)); @@ -2446,28 +2446,28 @@ } void -set_reverse_stereo (dc::Channel self, int flip) +set_reverse_stereo (DC::Channel self, int flip) CODE: Mix_SetReverseStereo (self, flip); -MODULE = Deliantra::Client PACKAGE = dc::MixChunk +MODULE = Deliantra::Client PACKAGE = DC::MixChunk PROTOTYPES: DISABLE -dc::MixChunk -new (SV *class, dc::RW rwops) +DC::MixChunk +new (SV *class, DC::RW rwops) CODE: RETVAL = Mix_LoadWAV_RW (rwops, 1); OUTPUT: RETVAL void -DESTROY (dc::MixChunk self) +DESTROY (DC::MixChunk self) CODE: Mix_FreeChunk (self); int -volume (dc::MixChunk self, int volume = -1) +volume (DC::MixChunk self, int volume = -1) CODE: if (items > 1) volume = CLAMP (volume, 0, 128); @@ -2475,8 +2475,8 @@ OUTPUT: RETVAL -dc::Channel -play (dc::MixChunk self, dc::Channel channel = -1, int loops = 0, int ticks = -1) +DC::Channel +play (DC::MixChunk self, DC::Channel channel = -1, int loops = 0, int ticks = -1) CODE: { RETVAL = Mix_PlayChannelTimed (channel, self, loops, ticks); @@ -2493,7 +2493,7 @@ OUTPUT: RETVAL -MODULE = Deliantra::Client PACKAGE = dc::MixMusic +MODULE = Deliantra::Client PACKAGE = DC::MixMusic int volume (int volume = -1) @@ -2515,37 +2515,37 @@ CODE: Mix_HaltMusic (); -dc::MixMusic -new (SV *class, dc::RW rwops) +DC::MixMusic +new (SV *class, DC::RW rwops) CODE: RETVAL = Mix_LoadMUS_RW (rwops); OUTPUT: RETVAL void -DESTROY (dc::MixMusic self) +DESTROY (DC::MixMusic self) CODE: Mix_FreeMusic (self); int -play (dc::MixMusic self, int loops = -1) +play (DC::MixMusic self, int loops = -1) CODE: RETVAL = Mix_PlayMusic (self, loops); OUTPUT: RETVAL void -fade_in_pos (dc::MixMusic self, int loops, int ms, double position) +fade_in_pos (DC::MixMusic self, int loops, int ms, double position) CODE: Mix_FadeInMusicPos (self, loops, ms, position); -MODULE = Deliantra::Client PACKAGE = dc::OpenGL +MODULE = Deliantra::Client PACKAGE = DC::OpenGL PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("dc::OpenGL", 1); + HV *stash = gv_stashpv ("DC::OpenGL", 1); static const struct { const char *name; IV iv; @@ -2884,7 +2884,7 @@ void glCallList (int list) -MODULE = Deliantra::Client PACKAGE = dc::UI::Base +MODULE = Deliantra::Client PACKAGE = DC::UI::Base PROTOTYPES: DISABLE @@ -2898,12 +2898,12 @@ BOOT: { - hover_gv = gv_fetchpv ("dc::UI::HOVER", 1, SVt_NV); + hover_gv = gv_fetchpv ("DC::UI::HOVER", 1, SVt_NV); - draw_x_gv = gv_fetchpv ("dc::UI::Base::draw_x", 1, SVt_NV); - draw_y_gv = gv_fetchpv ("dc::UI::Base::draw_y", 1, SVt_NV); - draw_w_gv = gv_fetchpv ("dc::UI::Base::draw_w", 1, SVt_NV); - draw_h_gv = gv_fetchpv ("dc::UI::Base::draw_h", 1, SVt_NV); + draw_x_gv = gv_fetchpv ("DC::UI::Base::draw_x", 1, SVt_NV); + draw_y_gv = gv_fetchpv ("DC::UI::Base::draw_y", 1, SVt_NV); + draw_w_gv = gv_fetchpv ("DC::UI::Base::draw_w", 1, SVt_NV); + draw_h_gv = gv_fetchpv ("DC::UI::Base::draw_h", 1, SVt_NV); } void @@ -2920,12 +2920,12 @@ double draw_x, draw_y; if (!SvROK (self)) - croak ("dc::Base::draw: %s not a reference", SvPV_nolen (self)); + croak ("DC::Base::draw: %s not a reference", SvPV_nolen (self)); hv = (HV *)SvRV (self); if (SvTYPE (hv) != SVt_PVHV) - croak ("dc::Base::draw: %s not a hashref", SvPV_nolen (self)); + croak ("DC::Base::draw: %s not a hashref", SvPV_nolen (self)); svp = hv_fetch (hv, "w", 1, 0); w = svp ? SvNV (*svp) : 0.; svp = hv_fetch (hv, "h", 1, 0); h = svp ? SvNV (*svp) : 0.;