Code formating conventions.
Fix in test drawing code. svn-id: r32704
This commit is contained in:
parent
8e2601d195
commit
cb6cb1361b
3 changed files with 31 additions and 24 deletions
|
@ -197,8 +197,10 @@ int InterfaceManager::runGUI() {
|
||||||
steps[2].flags = DrawStep::kStepCallbackOnly;
|
steps[2].flags = DrawStep::kStepCallbackOnly;
|
||||||
steps[2].scale = (1 << 16);
|
steps[2].scale = (1 << 16);
|
||||||
|
|
||||||
steps[3].drawing_call = &VectorRenderer::drawCallback_ROUNDSQ;
|
steps[3].color1.r = 255;
|
||||||
steps[3].flags = DrawStep::kStepCallbackOnly;
|
steps[3].color1.g = 255;
|
||||||
|
steps[3].color1.b = 255;
|
||||||
|
steps[3].flags = DrawStep::kStepSettingsOnly | DrawStep::kStepSetFG;
|
||||||
|
|
||||||
Common::Rect area = Common::Rect(32, 32, 256, 256);
|
Common::Rect area = Common::Rect(32, 32, 256, 256);
|
||||||
|
|
||||||
|
@ -206,6 +208,7 @@ int InterfaceManager::runGUI() {
|
||||||
while (running) { // draw!!
|
while (running) { // draw!!
|
||||||
|
|
||||||
_vectorRenderer->drawStep(Common::Rect(), steps[0]);
|
_vectorRenderer->drawStep(Common::Rect(), steps[0]);
|
||||||
|
_vectorRenderer->drawStep(Common::Rect(), steps[3]);
|
||||||
_vectorRenderer->drawStep(area, steps[1]);
|
_vectorRenderer->drawStep(area, steps[1]);
|
||||||
_vectorRenderer->drawStep(area, steps[2]);
|
_vectorRenderer->drawStep(area, steps[2]);
|
||||||
// _vectorRenderer->drawStep(Common::Rect(32, 32, 256, 256), &steps[3]);
|
// _vectorRenderer->drawStep(Common::Rect(32, 32, 256, 256), &steps[3]);
|
||||||
|
|
|
@ -43,13 +43,13 @@
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
void ThemeParser::debug_testEval() {
|
void ThemeParser::debug_testEval() {
|
||||||
static const char *debug_config_text =
|
static const char *debugConfigText =
|
||||||
"</* lol this is just a moronic test */drawdata id = \"background_default\" cache = true>"
|
"</* lol this is just a moronic test */drawdata id = \"background_default\" cache = true>"
|
||||||
"<draw func = \"roundedsq\" /*/fill = \"gradient\" gradient_start = \"255, 255, 128\" gradient_end = \"128, 128, 128\" size = \"auto\"/>"
|
"<draw func = \"roundedsq\" /*/fill = \"gradient\" gradient_start = \"255, 255, 128\" gradient_end = \"128, 128, 128\" size = \"auto\"/>"
|
||||||
"<draw func = \"roundedsq\" fill = \"none\" color = /*\"0, 0, 0\"*/\"0, 1, 2\" size = \"auto\"/>"
|
"<draw func = \"roundedsq\" fill = \"none\" color = /*\"0, 0, 0\"*/\"0, 1, 2\" size = \"auto\"/>"
|
||||||
"</ drawdata>/* lol this is just a simple test*/";
|
"</ drawdata>/* lol this is just a simple test*/";
|
||||||
|
|
||||||
_text = strdup(debug_config_text);
|
_text = strdup(debugConfigText);
|
||||||
parse();
|
parse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,20 +87,19 @@ void ThemeParser::parseActiveKey(bool closed) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeParser::parseKeyValue(Common::String &key_name) {
|
bool ThemeParser::parseKeyValue(Common::String keyName) {
|
||||||
assert(_keyValues.empty() == false);
|
assert(_keyValues.empty() == false);
|
||||||
|
|
||||||
if (_keyValues.top().contains(key_name))
|
if (_keyValues.top().contains(keyName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Common::String name = key_name;
|
|
||||||
_token.clear();
|
_token.clear();
|
||||||
char string_start;
|
char stringStart;
|
||||||
|
|
||||||
if (_text[_pos] == '"' || _text[_pos] == '\'') {
|
if (_text[_pos] == '"' || _text[_pos] == '\'') {
|
||||||
string_start = _text[_pos++];
|
stringStart = _text[_pos++];
|
||||||
|
|
||||||
while (_text[_pos] && _text[_pos] != string_start)
|
while (_text[_pos] && _text[_pos] != stringStart)
|
||||||
_token += _text[_pos++];
|
_token += _text[_pos++];
|
||||||
|
|
||||||
if (_text[_pos++] == 0)
|
if (_text[_pos++] == 0)
|
||||||
|
@ -110,14 +109,14 @@ bool ThemeParser::parseKeyValue(Common::String &key_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_keyValues.top()[name] = _token;
|
_keyValues.top()[keyName] = _token;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ThemeParser::parse() {
|
bool ThemeParser::parse() {
|
||||||
|
|
||||||
bool active_closure = false;
|
bool activeClosure = false;
|
||||||
bool self_closure = false;
|
bool selfClosure = false;
|
||||||
|
|
||||||
_state = kParserNeedKey;
|
_state = kParserNeedKey;
|
||||||
_pos = 0;
|
_pos = 0;
|
||||||
|
@ -136,14 +135,19 @@ bool ThemeParser::parse() {
|
||||||
|
|
||||||
switch (_state) {
|
switch (_state) {
|
||||||
case kParserNeedKey:
|
case kParserNeedKey:
|
||||||
if (_text[_pos++] != '<' || _text[_pos] == 0) {
|
if (_text[_pos++] != '<') {
|
||||||
parserError("Expecting key start.");
|
parserError("Expecting key start.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_text[_pos] == 0) {
|
||||||
|
parserError("Unexpected end of file.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (_text[_pos] == '/' && _text[_pos + 1] != '*') {
|
if (_text[_pos] == '/' && _text[_pos + 1] != '*') {
|
||||||
_pos++;
|
_pos++;
|
||||||
active_closure = true;
|
activeClosure = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_state = kParserNeedKeyName;
|
_state = kParserNeedKeyName;
|
||||||
|
@ -155,7 +159,7 @@ bool ThemeParser::parse() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_closure) {
|
if (activeClosure) {
|
||||||
if (_activeKey.empty() || _token != _activeKey.top())
|
if (_activeKey.empty() || _token != _activeKey.top())
|
||||||
parserError("Unexpected closure.");
|
parserError("Unexpected closure.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -167,8 +171,8 @@ bool ThemeParser::parse() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kParserNeedPropertyName:
|
case kParserNeedPropertyName:
|
||||||
if (active_closure) {
|
if (activeClosure) {
|
||||||
active_closure = false;
|
activeClosure = false;
|
||||||
_activeKey.pop();
|
_activeKey.pop();
|
||||||
_keyValues.pop();
|
_keyValues.pop();
|
||||||
|
|
||||||
|
@ -180,11 +184,11 @@ bool ThemeParser::parse() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
self_closure = (_text[_pos] == '/');
|
selfClosure = (_text[_pos] == '/');
|
||||||
|
|
||||||
if ((self_closure && _text[_pos + 1] == '>') || _text[_pos] == '>') {
|
if ((selfClosure && _text[_pos + 1] == '>') || _text[_pos] == '>') {
|
||||||
parseActiveKey(self_closure);
|
parseActiveKey(selfClosure);
|
||||||
_pos += self_closure ? 2 : 1;
|
_pos += selfClosure ? 2 : 1;
|
||||||
_state = kParserNeedKey;
|
_state = kParserNeedKey;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ protected:
|
||||||
void parserCallback_DRAW();
|
void parserCallback_DRAW();
|
||||||
void parserCallback_DRAWDATA();
|
void parserCallback_DRAWDATA();
|
||||||
|
|
||||||
bool parseKeyValue(Common::String &key_name);
|
bool parseKeyValue(Common::String keyName);
|
||||||
void parseActiveKey(bool closed);
|
void parseActiveKey(bool closed);
|
||||||
void parserError(const char *error_string);
|
void parserError(const char *errorString);
|
||||||
|
|
||||||
inline bool skipSpaces() {
|
inline bool skipSpaces() {
|
||||||
if (!isspace(_text[_pos]))
|
if (!isspace(_text[_pos]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue