1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "interf_script.h"
31 //-----------------------------------------------
33 // Get a "float" in the script.
34 //-----------------------------------------------
37 char delimiter
[] = "[] \t";
38 char *ptr
= strtok(NULL
, delimiter
);
42 NLMISC::fromString(ptr
, val
);
48 //-----------------------------------------------
50 // Get an "int" in the script.
51 //-----------------------------------------------
54 char delimiter
[] = "[] \t";
55 char *ptr
= strtok(NULL
, delimiter
);
61 //-----------------------------------------------
63 // Get all value for a RGBA in the script.
64 //-----------------------------------------------
67 char delimiter
[] = "[] \t";
68 uint8 rgba
[4] = {255,255,255,255};
71 for(uint rgbaIndex
= 0; rgbaIndex
<4; ++rgbaIndex
)
73 ptr
= strtok(NULL
, delimiter
);
75 rgba
[rgbaIndex
] = atoi(ptr
);
79 return CRGBA(rgba
[0], rgba
[1], rgba
[2], rgba
[3]);
84 //-----------------------------------------------
86 // Get all values for a vector in the script.
87 //-----------------------------------------------
88 std::vector
<float> getVectorOfFloat(uint8 nbCol
)
90 std::vector
<float> vect
;
92 char delimiter
[] = "[] \t";
96 for (uint8 i
= 0 ; i
< nbCol
; ++i
)
98 ptr
= strtok(NULL
, delimiter
);
101 NLMISC::fromString(ptr
, val
);
114 //-----------------------------------------------
116 // Get the Hot Spot of a control.
117 //-----------------------------------------------
118 CControl::THotSpot
getHotSpot()
120 char delimiter
[] = "[] \t";
121 char *ptr
= strtok(NULL
, delimiter
);
124 if (strcmp(ptr
, "TL") == 0)
125 return CControl::HS_TL
;
126 else if(strcmp(ptr
, "TM") == 0)
127 return CControl::HS_TM
;
128 else if(strcmp(ptr
, "TR") == 0)
129 return CControl::HS_TR
;
130 else if(strcmp(ptr
, "ML") == 0)
131 return CControl::HS_ML
;
132 else if(strcmp(ptr
, "MR") == 0)
133 return CControl::HS_MR
;
134 else if(strcmp(ptr
, "BL") == 0)
135 return CControl::HS_BL
;
136 else if(strcmp(ptr
, "BM") == 0)
137 return CControl::HS_BM
;
138 else if(strcmp(ptr
, "BR") == 0)
139 return CControl::HS_BR
;
142 // Return Middle Middle if it's middle middle or unknown.
143 return CControl::HS_MM
;
146 //-----------------------------------------------
148 // Get the display mode for the background.
149 //-----------------------------------------------
150 COSD::TBG
getBGMode()
152 char delimiter
[] = "[] \t";
153 char *ptr
= strtok(NULL
, delimiter
);
156 if (strcmp(ptr
, "none") == 0)
157 return COSD::BG_none
;
158 else if(strcmp(ptr
, "plain") == 0)
159 return COSD::BG_plain
;
160 else if(strcmp(ptr
, "stretch") == 0)
161 return COSD::BG_stretch
;
164 // Default is no background.
165 return COSD::BG_none
;
168 //-----------------------------------------------
170 // Get the display mode for the background.
171 //-----------------------------------------------
172 CButtonBase::TBG
getBGMode2()
174 char delimiter
[] = "[] \t";
175 char *ptr
= strtok(NULL
, delimiter
);
178 if (strcmp(ptr
, "none") == 0)
179 return CButtonBase::BG_none
;
180 else if(strcmp(ptr
, "plain") == 0)
181 return CButtonBase::BG_plain
;
182 else if(strcmp(ptr
, "stretch") == 0)
183 return CButtonBase::BG_stretch
;
186 // Default is no background.
187 return CButtonBase::BG_none
;
190 //-----------------------------------------------
192 // Get the display mode for the Title Bar.
193 //-----------------------------------------------
194 COSD::TTB
getTBMode()
196 char delimiter
[] = "[] \t";
197 char *ptr
= strtok(NULL
, delimiter
);
200 if (strcmp(ptr
, "none") == 0)
201 return COSD::TB_none
;
202 else if(strcmp(ptr
, "plain") == 0)
203 return COSD::TB_plain
;
204 else if(strcmp(ptr
, "stretch") == 0)
205 return COSD::TB_stretch
;
208 // Default is no background.
209 return COSD::TB_none
;