Mario Editor: add tool populating function

This commit is contained in:
zv0n 2021-05-29 13:21:01 +02:00
parent 5b8c0f88bb
commit 3cb36fe180

View File

@ -562,7 +562,7 @@ void createGrid(double start_x, double start_y, int count_x, int count_y, std::s
} }
} }
std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRenderer>> createArrowControls(double left_x, double right_x, double start_y, double height, uint64_t left_id, uint64_t right_id, std::shared_ptr<SDLPP::Scene> &scene) { std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRenderer>> createArrowControls(double left_x, double right_x, double start_y, double height, uint64_t left_id, uint64_t right_id, std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::FontConfiguration> &font_config) {
auto renderer = scene->getRendererShared(); auto renderer = scene->getRendererShared();
// white rectangles // white rectangles
auto rectangle1 = std::make_shared< SDLPP::RectangleRender >( auto rectangle1 = std::make_shared< SDLPP::RectangleRender >(
@ -581,9 +581,6 @@ std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRende
rectangle2->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) ); rectangle2->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) );
scene->addObject( rectangle2 ); scene->addObject( rectangle2 );
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
font, "#000000", "#282828", 0.05 );
auto left = std::make_shared< SDLPP::TextRenderer >( auto left = std::make_shared< SDLPP::TextRenderer >(
left_x, start_y + height / 2.0 - 0.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, "<", font_config ); left_x, start_y + height / 2.0 - 0.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, "<", font_config );
left->setId( 0 ); left->setId( 0 );
@ -600,6 +597,73 @@ std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRende
return {left, right}; return {left, right};
} }
void populateToolGrid(int count_x, int count_y, float start_x, float start_y, ToolType::Value type, const std::vector<uint64_t> &blocks, std::vector<std::shared_ptr<SDLPP::RenderObject>> &tool_store, std::shared_ptr<SDLPP::Scene> &scene) {
auto renderer = scene->getRendererShared();
for ( int i = 0; i < count_x; i++ ) {
for(int j = 0; j < count_y; j++) {
auto tool_box = std::make_shared< ToolBox >( i, j,
start_x, start_y, renderer );
tool_box->setType(type);
scene->addObject( tool_box );
}
}
int tool_index = 0;
for ( auto &block : blocks ) {
switch(type) {
case ToolType::CHARACTER:
if(block == MARIO_ID)
tool_store.push_back(createMario(LandType::OVERWORLD, renderer, 0, 0));
else
case ToolType::BLOCK:
case ToolType::MOD:
tool_store.push_back( createTerrainBlock(
block, LandType::OVERWORLD, renderer, false ) );
}
tool_store.back()->setHidden( true );
tool_store.back()->setPermanent();
auto x = tool_index % count_x;
auto y = tool_index / count_x;
tool_store.back()->setPos( start_x +
x * BLOCK_SIZE,
start_y + y * BLOCK_SIZE );
scene->addObject( tool_store.back() );
tool_index = ( tool_index + 1 ) % (2*count_x);
}
}
void checkArrowsEnabled( uint64_t cur_page, uint64_t max_page, uint64_t left_flag, uint64_t right_flag, std::shared_ptr<SDLPP::TextRenderer> &left_arrow, std::shared_ptr<SDLPP::TextRenderer> &right_arrow, std::shared_ptr<SDLPP::Font> &font, bool map = false ) {
if ( cur_page == 0 &&
getFlag( left_flag ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( left_flag );
left_arrow->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( cur_page != 0 &&
!getFlag( left_flag ) ) {
setFlag( UPDATE_FLAG );
setFlag( left_flag );
left_arrow->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( cur_page == max_page &&
getFlag( right_flag ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( right_flag );
if(map) {
right_arrow->setTextColor( font, "#00FF00", "#000000", 0.1 );
right_arrow->changeText( "+" );
} else {
right_arrow->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
}
} else if ( cur_page != max_page &&
!getFlag( right_flag ) ) {
setFlag( UPDATE_FLAG );
setFlag( right_flag );
right_arrow->setTextColor( font, "#000000", "#282828", 0.05 );
if(map) {
right_arrow->changeText( ">" );
}
}
}
#ifdef _WIN32 #ifdef _WIN32
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
PWSTR szCmdLine, int nCmdShow ) { PWSTR szCmdLine, int nCmdShow ) {
@ -635,12 +699,17 @@ int main() {
// TODO file name // TODO file name
loadMap( scene, global_vars.mario, "test_binary.bin", renderer, global_vars.objects ); loadMap( scene, global_vars.mario, "test_binary.bin", renderer, global_vars.objects );
auto arrows = createArrowControls(0, (MAP_WIDTH + 1) * BLOCK_SIZE, (MAP_WIDTH + 2 - MAP_HEIGHT) * BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE, EDITOR_LEFT_MAP_ID, EDITOR_RIGHT_MAP_ID, scene); auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
auto left = arrows.first; auto font_config = std::make_shared< SDLPP::FontConfiguration >(
auto right = arrows.second; font, "#000000", "#282828", 0.05 );
// create grids and arrow controls
// map
auto arrows = createArrowControls(0, (MAP_WIDTH + 1) * BLOCK_SIZE, (MAP_WIDTH + 2 - MAP_HEIGHT) * BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE, EDITOR_LEFT_MAP_ID, EDITOR_RIGHT_MAP_ID, scene, font_config);
auto left_map_arrow = arrows.first;
auto right_map_arrow = arrows.second;
createGrid(BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, MAP_WIDTH, MAP_HEIGHT, scene); createGrid(BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, MAP_WIDTH, MAP_HEIGHT, scene);
// edit blocks on map
for ( int i = 0; i < MAP_WIDTH; i++ ) { for ( int i = 0; i < MAP_WIDTH; i++ ) {
for ( int j = 0; j < MAP_HEIGHT; j++ ) { for ( int j = 0; j < MAP_HEIGHT; j++ ) {
scene->addObject( std::make_shared< EditBox >( scene->addObject( std::make_shared< EditBox >(
@ -648,6 +717,32 @@ int main() {
} }
} }
// tools
populateToolGrid(TOOLS_WIDTH, 2, (MAP_WIDTH - TOOLS_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, ToolType::BLOCK, possibleBlocks, global_vars.tools, scene);
arrows = createArrowControls((MAP_WIDTH - TOOLS_WIDTH - 1) * BLOCK_SIZE, MAP_WIDTH * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_TOOL_ID, EDITOR_RIGHT_TOOL_ID, scene, font_config);
auto left_tool_arrow = arrows.first;
auto right_tool_arrow = arrows.second;
createGrid(( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE, BLOCK_SIZE, TOOLS_WIDTH, 2, scene);
// mods
populateToolGrid(MOD_WIDTH, 2, 2 * BLOCK_SIZE, BLOCK_SIZE, ToolType::MOD, possibleMods, global_vars.mods, scene);
arrows = createArrowControls(BLOCK_SIZE, (MOD_WIDTH + 2) * BLOCK_SIZE, BLOCK_SIZE, 2*BLOCK_SIZE, EDITOR_LEFT_MOD_ID, EDITOR_RIGHT_MOD_ID, scene, font_config);
auto left_mod_arrow = arrows.first;
auto right_mod_arrow = arrows.second;
createGrid(2*BLOCK_SIZE, BLOCK_SIZE, MOD_WIDTH, 2, scene);
// characters
populateToolGrid(CHARACTER_WIDTH, 2, (MOD_WIDTH+5) * BLOCK_SIZE, BLOCK_SIZE, ToolType::CHARACTER, possibleCharacters, global_vars.characters, scene);
arrows = createArrowControls((MOD_WIDTH + 4) * BLOCK_SIZE, (MOD_WIDTH + 5 + CHARACTER_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_CHARACTER_ID, EDITOR_RIGHT_CHARACTER_ID, scene, font_config);
auto left_char_arrow = arrows.first;
auto right_char_arrow = arrows.second;
createGrid((MOD_WIDTH + 5) * BLOCK_SIZE, BLOCK_SIZE, CHARACTER_WIDTH, 2, scene);
global_vars.map.max_page = global_vars.objects.size() - MAP_WIDTH;
global_vars.tool.max_page_tools = ( possibleBlocks.size() - 1 ) / (2*TOOLS_WIDTH);
global_vars.tool.max_page_mods = ( possibleMods.size() - 1 ) / (2*MOD_WIDTH);
global_vars.tool.max_page_characters = ( possibleCharacters.size() - 1 ) / (2*CHARACTER_WIDTH);
auto mouse = std::make_shared< SDLPP::RectangleRender >( 0.01, 0.01, 0, 0, auto mouse = std::make_shared< SDLPP::RectangleRender >( 0.01, 0.01, 0, 0,
renderer ); renderer );
mouse->setMinWidth( 1 ); mouse->setMinWidth( 1 );
@ -657,112 +752,6 @@ int main() {
mouse->setColiderColor( "#00FF00" ); mouse->setColiderColor( "#00FF00" );
mouse->addCollision( SDLPP::RectColider( { 0, 0 }, { 1, 1 } ) ); mouse->addCollision( SDLPP::RectColider( { 0, 0 }, { 1, 1 } ) );
scene->addObject( mouse ); scene->addObject( mouse );
global_vars.map.max_page = global_vars.objects.size() - MAP_WIDTH;
global_vars.tool.max_page_tools = ( possibleBlocks.size() - 1 ) / (2*TOOLS_WIDTH);
global_vars.tool.max_page_mods = ( possibleMods.size() - 1 ) / (2*MOD_WIDTH);
global_vars.tool.max_page_characters = ( possibleCharacters.size() - 1 ) / (2*CHARACTER_WIDTH);
// tools
for ( int i = 0; i < TOOLS_WIDTH; i++ ) {
auto tool_box1 = std::make_shared< ToolBox >( i, 0,
(MAP_WIDTH - TOOLS_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, renderer );
auto tool_box2 = std::make_shared< ToolBox >( i, 1, (MAP_WIDTH - TOOLS_WIDTH) * BLOCK_SIZE,
BLOCK_SIZE, renderer );
tool_box1->setType(ToolType::BLOCK);
tool_box2->setType(ToolType::BLOCK);
scene->addObject( tool_box1 );
scene->addObject( tool_box2 );
}
int tool_index = 0;
for ( auto &block : possibleBlocks ) {
global_vars.tools.push_back( createTerrainBlock(
block, LandType::OVERWORLD, renderer, false ) );
global_vars.tools.back()->setHidden( true );
global_vars.tools.back()->setPermanent();
auto x = tool_index % TOOLS_WIDTH;
auto y = tool_index / TOOLS_WIDTH;
global_vars.tools.back()->setPos( ( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE +
x * BLOCK_SIZE,
BLOCK_SIZE + y * BLOCK_SIZE );
scene->addObject( global_vars.tools.back() );
tool_index = ( tool_index + 1 ) % (2*TOOLS_WIDTH);
}
arrows = createArrowControls((MAP_WIDTH - TOOLS_WIDTH - 1) * BLOCK_SIZE, MAP_WIDTH * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_TOOL_ID, EDITOR_RIGHT_TOOL_ID, scene);
auto left_tool = arrows.first;
auto right_tool = arrows.second;
createGrid(( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE, BLOCK_SIZE, TOOLS_WIDTH, 2, scene);
//mods
for ( int i = 0; i < MOD_WIDTH; i++ ) {
auto mod_box1 = std::make_shared< ToolBox >( i, 0, 2*BLOCK_SIZE,
BLOCK_SIZE, renderer );
auto mod_box2 = std::make_shared< ToolBox >( i, 1, 2*BLOCK_SIZE,
BLOCK_SIZE, renderer );
mod_box1->setType(ToolType::MOD);
mod_box2->setType(ToolType::MOD);
scene->addObject( mod_box1 );
scene->addObject( mod_box2 );
}
tool_index = 0;
for ( auto &block : possibleMods ) {
//TODO createModBlock
global_vars.mods.push_back( createTerrainBlock(
block, LandType::OVERWORLD, renderer, false ) );
global_vars.mods.back()->setHidden( true );
global_vars.mods.back()->setPermanent();
auto x = tool_index % MOD_WIDTH;
auto y = tool_index / MOD_WIDTH;
global_vars.mods.back()->setPos( 2*BLOCK_SIZE +
x * BLOCK_SIZE,
BLOCK_SIZE + y * BLOCK_SIZE );
scene->addObject( global_vars.mods.back() );
tool_index = ( tool_index + 1 ) % (2*MOD_WIDTH);
}
arrows = createArrowControls(BLOCK_SIZE, (MOD_WIDTH + 2) * BLOCK_SIZE, BLOCK_SIZE, 2*BLOCK_SIZE, EDITOR_LEFT_MOD_ID, EDITOR_RIGHT_MOD_ID, scene);
auto left_mod = arrows.first;
auto right_mod = arrows.second;
createGrid(2*BLOCK_SIZE, BLOCK_SIZE, MOD_WIDTH, 2, scene);
//characters
for ( int i = 0; i < CHARACTER_WIDTH; i++ ) {
auto char_box1 = std::make_shared< ToolBox >( i, 0, (MOD_WIDTH+5)*BLOCK_SIZE,
BLOCK_SIZE, renderer );
auto char_box2 = std::make_shared< ToolBox >( i, 1, (MOD_WIDTH+5)*BLOCK_SIZE,
BLOCK_SIZE, renderer );
char_box1->setType(ToolType::CHARACTER);
char_box2->setType(ToolType::CHARACTER);
scene->addObject( char_box1 );
scene->addObject( char_box2 );
}
tool_index = 0;
for ( auto &block : possibleCharacters ) {
//TODO createCharacterBlock
if ( block == MARIO_ID ) {
global_vars.characters.push_back(
createMario( LandType::OVERWORLD, renderer, 0, 0 ) );
} else {
global_vars.characters.push_back( createTerrainBlock(
block, LandType::OVERWORLD, renderer, false ) );
}
global_vars.characters.back()->setHidden( true );
global_vars.characters.back()->setPermanent();
auto x = tool_index % CHARACTER_WIDTH;
auto y = tool_index / CHARACTER_WIDTH;
global_vars.characters.back()->setPos( (MOD_WIDTH + 5) * BLOCK_SIZE +
x * BLOCK_SIZE,
BLOCK_SIZE + y * BLOCK_SIZE );
scene->addObject( global_vars.characters.back() );
tool_index = ( tool_index + 1 ) % (2*CHARACTER_WIDTH);
}
arrows = createArrowControls((MOD_WIDTH + 4) * BLOCK_SIZE, (MOD_WIDTH + 5 + CHARACTER_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_CHARACTER_ID, EDITOR_RIGHT_CHARACTER_ID, scene);
auto left_char = arrows.first;
auto right_char = arrows.second;
createGrid((MOD_WIDTH + 5) * BLOCK_SIZE, BLOCK_SIZE, CHARACTER_WIDTH, 2, scene);
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
font, "#000000", "#282828", 0.05 );
global_vars.translucent_terrain_texture = global_vars.translucent_terrain_texture =
std::make_shared< SDLPP::Texture >( renderer, "sprites/terrain.png", std::make_shared< SDLPP::Texture >( renderer, "sprites/terrain.png",
@ -798,14 +787,11 @@ int main() {
global_vars.tool.cur_page_mods = 0; global_vars.tool.cur_page_mods = 0;
global_vars.tool.cur_page_characters = 0; global_vars.tool.cur_page_characters = 0;
// required for initial correct rendering // required for initial correct rendering
setFlag( MAP_LEFT_ENABLED_FLAG ); setFlag( MAP_LEFT_ENABLED_FLAG | MAP_RIGHT_ENABLED_FLAG |
setFlag( MAP_RIGHT_ENABLED_FLAG ); TOOL_LEFT_ENABLED_FLAG | TOOL_RIGHT_ENABLED_FLAG |
setFlag( TOOL_LEFT_ENABLED_FLAG ); MOD_LEFT_ENABLED_FLAG | MOD_RIGHT_ENABLED_FLAG |
setFlag( TOOL_RIGHT_ENABLED_FLAG ); CHARACTER_LEFT_ENABLED_FLAG | CHARACTER_RIGHT_ENABLED_FLAG );
setFlag( MOD_LEFT_ENABLED_FLAG );
setFlag( MOD_RIGHT_ENABLED_FLAG );
setFlag( CHARACTER_LEFT_ENABLED_FLAG );
setFlag( CHARACTER_RIGHT_ENABLED_FLAG );
while ( !getFlag( QUIT_FLAG ) ) { while ( !getFlag( QUIT_FLAG ) ) {
SDL_PumpEvents(); SDL_PumpEvents();
SDL_framerateDelay( &gFPS ); SDL_framerateDelay( &gFPS );
@ -818,97 +804,10 @@ int main() {
frames = 0; frames = 0;
base = SDL_GetTicks(); base = SDL_GetTicks();
} }
if ( global_vars.map.cur_page == 0 && checkArrowsEnabled(global_vars.map.cur_page, global_vars.map.max_page, MAP_LEFT_ENABLED_FLAG, MAP_RIGHT_ENABLED_FLAG, left_map_arrow, right_map_arrow, font, true);
getFlag( MAP_LEFT_ENABLED_FLAG ) ) { checkArrowsEnabled(global_vars.tool.cur_page_tools, global_vars.tool.max_page_tools, TOOL_LEFT_ENABLED_FLAG, TOOL_RIGHT_ENABLED_FLAG, left_tool_arrow, right_tool_arrow, font);
setFlag( UPDATE_FLAG ); checkArrowsEnabled(global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, MOD_LEFT_ENABLED_FLAG, MOD_RIGHT_ENABLED_FLAG, left_mod_arrow, right_mod_arrow, font);
unsetFlag( MAP_LEFT_ENABLED_FLAG ); checkArrowsEnabled(global_vars.tool.cur_page_characters, global_vars.tool.max_page_characters, CHARACTER_LEFT_ENABLED_FLAG, CHARACTER_RIGHT_ENABLED_FLAG, left_char_arrow, right_char_arrow, font);
left->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.map.cur_page != 0 &&
!getFlag( MAP_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( MAP_LEFT_ENABLED_FLAG );
left->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.map.cur_page == global_vars.map.max_page &&
getFlag( MAP_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( MAP_RIGHT_ENABLED_FLAG );
right->setTextColor( font, "#00FF00", "#000000", 0.1 );
right->changeText( "+" );
} else if ( global_vars.map.cur_page != global_vars.map.max_page &&
!getFlag( MAP_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( MAP_RIGHT_ENABLED_FLAG );
right->setTextColor( font, "#000000", "#282828", 0.05 );
right->changeText( ">" );
}
//TODO
if ( global_vars.tool.cur_page_tools == 0 &&
getFlag( TOOL_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( TOOL_LEFT_ENABLED_FLAG );
left_tool->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_tools != 0 &&
!getFlag( TOOL_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( TOOL_LEFT_ENABLED_FLAG );
left_tool->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.tool.cur_page_tools == global_vars.tool.max_page_tools &&
getFlag( TOOL_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( TOOL_RIGHT_ENABLED_FLAG );
right_tool->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_tools != global_vars.tool.max_page_tools &&
!getFlag( TOOL_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( TOOL_RIGHT_ENABLED_FLAG );
right_tool->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.tool.cur_page_mods == 0 &&
getFlag( MOD_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( MOD_LEFT_ENABLED_FLAG );
left_mod->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_mods != 0 &&
!getFlag( MOD_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( MOD_LEFT_ENABLED_FLAG );
left_mod->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.tool.cur_page_mods == global_vars.tool.max_page_mods &&
getFlag( MOD_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( MOD_RIGHT_ENABLED_FLAG );
right_mod->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_mods != global_vars.tool.max_page_mods &&
!getFlag( MOD_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( MOD_RIGHT_ENABLED_FLAG );
right_mod->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.tool.cur_page_characters == 0 &&
getFlag( CHARACTER_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( CHARACTER_LEFT_ENABLED_FLAG );
left_char->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_characters != 0 &&
!getFlag( CHARACTER_LEFT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( CHARACTER_LEFT_ENABLED_FLAG );
left_char->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( global_vars.tool.cur_page_characters == global_vars.tool.max_page_characters &&
getFlag( CHARACTER_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
unsetFlag( CHARACTER_RIGHT_ENABLED_FLAG );
right_char->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
} else if ( global_vars.tool.cur_page_characters != global_vars.tool.max_page_characters &&
!getFlag( CHARACTER_RIGHT_ENABLED_FLAG ) ) {
setFlag( UPDATE_FLAG );
setFlag( CHARACTER_RIGHT_ENABLED_FLAG );
right_char->setTextColor( font, "#000000", "#282828", 0.05 );
}
if ( getFlag( UPDATE_FLAG ) ) { if ( getFlag( UPDATE_FLAG ) ) {
scene->updateSizeAndPosition(); scene->updateSizeAndPosition();
unsetFlag( UPDATE_FLAG ); unsetFlag( UPDATE_FLAG );