--- deliantra/Deliantra-Client/Client.xs 2007/12/26 18:09:30 1.240 +++ deliantra/Deliantra-Client/Client.xs 2007/12/26 20:46:39 1.241 @@ -122,12 +122,12 @@ #include "pango-fontmap.c" #include "pango-render.c" -typedef IV CFPlus__Channel; -typedef SDL_RWops *CFPlus__RW; -typedef Mix_Chunk *CFPlus__MixChunk; -typedef Mix_Music *CFPlus__MixMusic; +typedef IV dc__Channel; +typedef SDL_RWops *dc__RW; +typedef Mix_Chunk *dc__MixChunk; +typedef Mix_Music *dc__MixMusic; -typedef PangoFontDescription *CFPlus__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; - CFPlus__Font font; + dc__Font font; rc_t *rc; -} *CFPlus__Layout; +} *dc__Layout; -static CFPlus__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 (CFPlus__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 (CFPlus__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; -} *CFPlus__Map; +} *dc__Map; static char * prepend (char *ptr, int sze, int inc) @@ -281,7 +281,7 @@ } static maprow * -map_get_row (CFPlus__Map self, int y) +map_get_row (dc__Map self, int y) { if (0 > y) { @@ -329,13 +329,13 @@ } static mapcell * -map_get_cell (CFPlus__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 (CFPlus__Map self) +map_clear (dc__Map self) { int r; @@ -353,7 +353,7 @@ } static void -map_blank (CFPlus__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 = CFPlus PACKAGE = CFPlus +MODULE = Deliantra::Client PACKAGE = dc PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("CFPlus", 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 ("CFPlus::UI::Event", 1)))); + XPUSHs (sv_2mortal (sv_bless (newRV_noinc ((SV *)hv), gv_stashpv ("dc::UI::Event", 1)))); } } @@ -1025,11 +1025,11 @@ #endif } -MODULE = CFPlus PACKAGE = CFPlus::Font +MODULE = Deliantra::Client PACKAGE = dc::Font PROTOTYPES: DISABLE -CFPlus::Font +dc::Font new_from_file (SV *class, char *path, int id = 0) CODE: { @@ -1042,17 +1042,17 @@ RETVAL void -DESTROY (CFPlus::Font self) +DESTROY (dc::Font self) CODE: pango_font_description_free (self); void -make_default (CFPlus::Font self) +make_default (dc::Font self) PROTOTYPE: $ CODE: default_font = self; -MODULE = CFPlus PACKAGE = CFPlus::Layout +MODULE = Deliantra::Client PACKAGE = dc::Layout PROTOTYPES: DISABLE @@ -1068,7 +1068,7 @@ CODE: tc_restore (); -CFPlus::Layout +dc::Layout new (SV *class) CODE: New (0, RETVAL, 1, struct cf_layout); @@ -1088,14 +1088,14 @@ RETVAL void -DESTROY (CFPlus::Layout self) +DESTROY (dc::Layout self) CODE: g_object_unref (self->pl); rc_free (self->rc); Safefree (self); void -set_text (CFPlus::Layout self, SV *text_) +set_text (dc::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1105,7 +1105,7 @@ } void -set_markup (CFPlus::Layout self, SV *text_) +set_markup (dc::Layout self, SV *text_) CODE: { STRLEN textlen; @@ -1115,7 +1115,7 @@ } void -set_shapes (CFPlus::Layout self, ...) +set_shapes (dc::Layout self, ...) CODE: { PangoAttrList *attrs = 0; @@ -1160,7 +1160,7 @@ } void -get_shapes (CFPlus::Layout self) +get_shapes (dc::Layout self) PPCODE: { PangoLayoutIter *iter = pango_layout_get_iter (self->pl); @@ -1185,7 +1185,7 @@ } int -has_wrapped (CFPlus::Layout self) +has_wrapped (dc::Layout self) CODE: { int lines = 1; @@ -1200,7 +1200,7 @@ RETVAL SV * -get_text (CFPlus::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 (CFPlus::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 (CFPlus::Layout self, CFPlus::Font font = 0) +set_font (dc::Layout self, dc::Font font = 0) CODE: if (self->font != font) { @@ -1225,7 +1225,7 @@ } void -set_height (CFPlus::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 (CFPlus::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 (CFPlus::Layout self, int indent) +set_indent (dc::Layout self, int indent) CODE: pango_layout_set_indent (self->pl, indent * PANGO_SCALE); void -set_spacing (CFPlus::Layout self, int spacing) +set_spacing (dc::Layout self, int spacing) CODE: pango_layout_set_spacing (self->pl, spacing * PANGO_SCALE); void -set_ellipsise (CFPlus::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 (CFPlus::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 (CFPlus::Layout self) +size (dc::Layout self) PPCODE: { int w, h; @@ -1277,7 +1277,7 @@ } int -descent (CFPlus::Layout self) +descent (dc::Layout self) CODE: { PangoRectangle rect; @@ -1289,7 +1289,7 @@ RETVAL int -xy_to_index (CFPlus::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 (CFPlus::Layout self, int index) +cursor_pos (dc::Layout self, int index) PPCODE: { PangoRectangle strong_pos; @@ -1313,7 +1313,7 @@ } void -index_to_line_x (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::Layout self) +draw (dc::Layout self) CODE: { glEnable (GL_TEXTURE_2D); @@ -1385,7 +1385,7 @@ glDisable (GL_TEXTURE_2D); } -MODULE = CFPlus PACKAGE = CFPlus::Texture +MODULE = Deliantra::Client PACKAGE = dc::Texture PROTOTYPES: ENABLE @@ -1474,11 +1474,11 @@ OUTPUT: RETVAL -MODULE = CFPlus PACKAGE = CFPlus::Map +MODULE = Deliantra::Client PACKAGE = dc::Map PROTOTYPES: DISABLE -CFPlus::Map +dc::Map new (SV *class) CODE: New (0, RETVAL, 1, struct map); @@ -1496,7 +1496,7 @@ RETVAL void -DESTROY (CFPlus::Map self) +DESTROY (dc::Map self) CODE: { map_clear (self); @@ -1506,18 +1506,18 @@ } void -resize (CFPlus::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 (CFPlus::Map self) +clear (dc::Map self) CODE: map_clear (self); void -set_tileid (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::Map self) +ox (dc::Map self) ALIAS: oy = 1 x = 2 @@ -1599,7 +1599,7 @@ RETVAL void -scroll (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::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 (CFPlus::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 = CFPlus PACKAGE = CFPlus::RW +MODULE = Deliantra::Client PACKAGE = dc::RW -CFPlus::RW +dc::RW new (SV *class, SV *data_sv) CODE: { @@ -2353,7 +2353,7 @@ OUTPUT: RETVAL -CFPlus::RW +dc::RW new_from_file (SV *class, const char *path, const char *mode = "rb") CODE: RETVAL = SDL_RWFromFile (path, mode); @@ -2361,17 +2361,17 @@ RETVAL # fails on win32: -# CFPlus.xs(2268) : error C2059: syntax error : '(' +# dc.xs(2268) : error C2059: syntax error : '(' #void -#close (CFPlus::RW self) +#close (dc::RW self) # CODE: # (self->(close)) (self); -MODULE = CFPlus PACKAGE = CFPlus::Channel +MODULE = Deliantra::Client PACKAGE = dc::Channel PROTOTYPES: DISABLE -CFPlus::Channel +dc::Channel find () CODE: { @@ -2394,50 +2394,50 @@ RETVAL void -halt (CFPlus::Channel self) +halt (dc::Channel self) CODE: Mix_HaltChannel (self); void -expire (CFPlus::Channel self, int ticks = -1) +expire (dc::Channel self, int ticks = -1) CODE: Mix_ExpireChannel (self, ticks); void -fade_out (CFPlus::Channel self, int ticks = -1) +fade_out (dc::Channel self, int ticks = -1) CODE: Mix_FadeOutChannel (self, ticks); int -volume (CFPlus::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 (CFPlus::Channel self) +unregister_all_effects (dc::Channel self) CODE: Mix_UnregisterAllEffects (self); void -set_panning (CFPlus::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 (CFPlus::Channel self, int distance) +set_distance (dc::Channel self, int distance) CODE: Mix_SetDistance (self, CLAMP (distance, 0, 255)); void -set_position (CFPlus::Channel self, int angle, int distance) +set_position (dc::Channel self, int angle, int distance) CODE: void -set_position_r (CFPlus::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 (CFPlus::Channel self, int flip) +set_reverse_stereo (dc::Channel self, int flip) CODE: Mix_SetReverseStereo (self, flip); -MODULE = CFPlus PACKAGE = CFPlus::MixChunk +MODULE = Deliantra::Client PACKAGE = dc::MixChunk PROTOTYPES: DISABLE -CFPlus::MixChunk -new (SV *class, CFPlus::RW rwops) +dc::MixChunk +new (SV *class, dc::RW rwops) CODE: RETVAL = Mix_LoadWAV_RW (rwops, 1); OUTPUT: RETVAL void -DESTROY (CFPlus::MixChunk self) +DESTROY (dc::MixChunk self) CODE: Mix_FreeChunk (self); int -volume (CFPlus::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 -CFPlus::Channel -play (CFPlus::MixChunk self, CFPlus::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 = CFPlus PACKAGE = CFPlus::MixMusic +MODULE = Deliantra::Client PACKAGE = dc::MixMusic int volume (int volume = -1) @@ -2515,37 +2515,37 @@ CODE: Mix_HaltMusic (); -CFPlus::MixMusic -new (SV *class, CFPlus::RW rwops) +dc::MixMusic +new (SV *class, dc::RW rwops) CODE: RETVAL = Mix_LoadMUS_RW (rwops); OUTPUT: RETVAL void -DESTROY (CFPlus::MixMusic self) +DESTROY (dc::MixMusic self) CODE: Mix_FreeMusic (self); int -play (CFPlus::MixMusic self, int loops = -1) +play (dc::MixMusic self, int loops = -1) CODE: RETVAL = Mix_PlayMusic (self, loops); OUTPUT: RETVAL void -fade_in_pos (CFPlus::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 = CFPlus PACKAGE = CFPlus::OpenGL +MODULE = Deliantra::Client PACKAGE = dc::OpenGL PROTOTYPES: ENABLE BOOT: { - HV *stash = gv_stashpv ("CFPlus::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 = CFPlus PACKAGE = CFPlus::UI::Base +MODULE = Deliantra::Client PACKAGE = dc::UI::Base PROTOTYPES: DISABLE @@ -2898,12 +2898,12 @@ BOOT: { - hover_gv = gv_fetchpv ("CFPlus::UI::HOVER", 1, SVt_NV); + hover_gv = gv_fetchpv ("dc::UI::HOVER", 1, SVt_NV); - draw_x_gv = gv_fetchpv ("CFPlus::UI::Base::draw_x", 1, SVt_NV); - draw_y_gv = gv_fetchpv ("CFPlus::UI::Base::draw_y", 1, SVt_NV); - draw_w_gv = gv_fetchpv ("CFPlus::UI::Base::draw_w", 1, SVt_NV); - draw_h_gv = gv_fetchpv ("CFPlus::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 ("CFPlus::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 ("CFPlus::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.;