ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/Client.xs
(Generate patch)

Comparing deliantra/Deliantra-Client/Client.xs (file contents):
Revision 1.121 by root, Fri Jun 23 20:28:19 2006 UTC vs.
Revision 1.123 by root, Wed Jun 28 23:41:11 2006 UTC

837 CODE: 837 CODE:
838{ 838{
839 PangoAttrList *attrs = 0; 839 PangoAttrList *attrs = 0;
840 const char *text = pango_layout_get_text (self->pl); 840 const char *text = pango_layout_get_text (self->pl);
841 const char *pos = text; 841 const char *pos = text;
842 int arg = 2; 842 int arg = 4;
843 843
844 while (arg < items && (pos = strstr (pos, OBJ_STR))) 844 while (arg < items && (pos = strstr (pos, OBJ_STR)))
845 { 845 {
846 PangoRectangle rect; 846 PangoRectangle inkrect, rect;
847 PangoAttribute *attr; 847 PangoAttribute *attr;
848 848
849 int x = SvIV (ST (arg - 3));
850 int y = SvIV (ST (arg - 2));
849 int w = SvIV (ST (arg - 1)); 851 int w = SvIV (ST (arg - 1));
850 int h = SvIV (ST (arg)); 852 int h = SvIV (ST (arg ));
851 853
852 arg += 2;
853
854 rect.x = 0; 854 inkrect.x = 0;
855 inkrect.y = 0;
856 inkrect.width = 0;
857 inkrect.height = 0;
858
859 rect.x = x * PANGO_SCALE;
855 rect.y = -h * PANGO_SCALE; 860 rect.y = y * PANGO_SCALE;
856 rect.width = w * PANGO_SCALE; 861 rect.width = w * PANGO_SCALE;
857 rect.height = h * PANGO_SCALE; 862 rect.height = h * PANGO_SCALE;
858 863
859 if (!attrs) 864 if (!attrs)
860 attrs = pango_layout_get_attributes (self->pl); 865 attrs = pango_layout_get_attributes (self->pl);
861 866
862 attr = pango_attr_shape_new (&rect, &rect); 867 attr = pango_attr_shape_new (&inkrect, &rect);
863 attr->start_index = pos - text; 868 attr->start_index = pos - text;
864 attr->end_index = attr->start_index + sizeof (OBJ_STR) - 1; 869 attr->end_index = attr->start_index + sizeof (OBJ_STR) - 1;
865 pango_attr_list_insert (attrs, attr); 870 pango_attr_list_insert (attrs, attr);
866 871
872 arg += 4;
867 pos += sizeof (OBJ_STR) - 1; 873 pos += sizeof (OBJ_STR) - 1;
868 } 874 }
869 875
870 if (attrs) 876 if (attrs)
871 pango_layout_set_attributes (self->pl, attrs); 877 pango_layout_set_attributes (self->pl, attrs);
984 990
985 EXTEND (SP, 2); 991 EXTEND (SP, 2);
986 PUSHs (sv_2mortal (newSViv (w))); 992 PUSHs (sv_2mortal (newSViv (w)));
987 PUSHs (sv_2mortal (newSViv (h))); 993 PUSHs (sv_2mortal (newSViv (h)));
988} 994}
995
996int
997descent (CFClient::Layout self)
998 CODE:
999{
1000 PangoRectangle rect;
1001 PangoLayoutLine *line = pango_layout_get_line (self->pl, 0);
1002 pango_layout_line_get_pixel_extents (line, 0, &rect);
1003 RETVAL = PANGO_DESCENT (rect);
1004}
1005 OUTPUT:
1006 RETVAL
989 1007
990int 1008int
991xy_to_index (CFClient::Layout self, int x, int y) 1009xy_to_index (CFClient::Layout self, int x, int y)
992 CODE: 1010 CODE:
993{ 1011{
1510void 1528void
1511draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data) 1529draw_magicmap (CFClient::Map self, int dx, int dy, int w, int h, unsigned char *data)
1512 CODE: 1530 CODE:
1513{ 1531{
1514 static float color[16][3] = { 1532 static float color[16][3] = {
1515 { 0.00, 0.00, 0.00 }, 1533 { 0.00F, 0.00F, 0.00F },
1516 { 1.00, 1.00, 1.00 }, 1534 { 1.00F, 1.00F, 1.00F },
1517 { 0.00, 0.00, 0.55 }, 1535 { 0.00F, 0.00F, 0.55F },
1518 { 1.00, 0.00, 0.00 }, 1536 { 1.00F, 0.00F, 0.00F },
1519 1537
1520 { 1.00, 0.54, 0.00 }, 1538 { 1.00F, 0.54F, 0.00F },
1521 { 0.11, 0.56, 1.00 }, 1539 { 0.11F, 0.56F, 1.00F },
1522 { 0.93, 0.46, 0.00 }, 1540 { 0.93F, 0.46F, 0.00F },
1523 { 0.18, 0.54, 0.34 }, 1541 { 0.18F, 0.54F, 0.34F },
1524 1542
1525 { 0.56, 0.73, 0.56 }, 1543 { 0.56F, 0.73F, 0.56F },
1526 { 0.80, 0.80, 0.80 }, 1544 { 0.80F, 0.80F, 0.80F },
1527 { 0.55, 0.41, 0.13 }, 1545 { 0.55F, 0.41F, 0.13F },
1528 { 0.99, 0.77, 0.26 }, 1546 { 0.99F, 0.77F, 0.26F },
1529 1547
1530 { 0.74, 0.65, 0.41 }, 1548 { 0.74F, 0.65F, 0.41F },
1531 1549
1532 { 0.00, 1.00, 1.00 }, 1550 { 0.00F, 1.00F, 1.00F },
1533 { 1.00, 0.00, 1.00 }, 1551 { 1.00F, 0.00F, 1.00F },
1534 { 1.00, 1.00, 0.00 }, 1552 { 1.00F, 1.00F, 0.00F },
1535 }; 1553 };
1536 1554
1537 int x, y; 1555 int x, y;
1538 1556
1539 glEnable (GL_TEXTURE_2D); 1557 glEnable (GL_TEXTURE_2D);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines