Mario: slight editor UI update

This commit is contained in:
zv0n 2021-05-28 20:00:15 +02:00
parent be638591c8
commit a55a9142af

View File

@ -696,9 +696,9 @@ int main() {
} }
//mods //mods
for ( int i = 0; i < MOD_WIDTH; i++ ) { for ( int i = 0; i < MOD_WIDTH; i++ ) {
auto mod_box1 = std::make_shared< ToolBox >( i, 0, BLOCK_SIZE, auto mod_box1 = std::make_shared< ToolBox >( i, 0, 2*BLOCK_SIZE,
BLOCK_SIZE, renderer ); BLOCK_SIZE, renderer );
auto mod_box2 = std::make_shared< ToolBox >( i, 1, BLOCK_SIZE, auto mod_box2 = std::make_shared< ToolBox >( i, 1, 2*BLOCK_SIZE,
BLOCK_SIZE, renderer ); BLOCK_SIZE, renderer );
mod_box1->setType(ToolType::MOD); mod_box1->setType(ToolType::MOD);
mod_box2->setType(ToolType::MOD); mod_box2->setType(ToolType::MOD);
@ -714,7 +714,7 @@ int main() {
global_vars.mods.back()->setPermanent(); global_vars.mods.back()->setPermanent();
auto x = tool_index % MOD_WIDTH; auto x = tool_index % MOD_WIDTH;
auto y = tool_index / MOD_WIDTH; auto y = tool_index / MOD_WIDTH;
global_vars.mods.back()->setPos( BLOCK_SIZE + global_vars.mods.back()->setPos( 2*BLOCK_SIZE +
x * BLOCK_SIZE, x * BLOCK_SIZE,
BLOCK_SIZE + y * BLOCK_SIZE ); BLOCK_SIZE + y * BLOCK_SIZE );
scene->addObject( global_vars.mods.back() ); scene->addObject( global_vars.mods.back() );
@ -722,8 +722,8 @@ int main() {
} }
for ( int i = 0; i <= MOD_WIDTH; i++ ) { for ( int i = 0; i <= MOD_WIDTH; i++ ) {
auto line = std::make_shared< SDLPP::LineRenderer >( auto line = std::make_shared< SDLPP::LineRenderer >(
BLOCK_SIZE + i * BLOCK_SIZE, BLOCK_SIZE, 2*BLOCK_SIZE + i * BLOCK_SIZE, BLOCK_SIZE,
BLOCK_SIZE + i * BLOCK_SIZE, 3 * BLOCK_SIZE, 2*BLOCK_SIZE + i * BLOCK_SIZE, 3 * BLOCK_SIZE,
renderer, "#282828" ); renderer, "#282828" );
line->setPermanent(); line->setPermanent();
line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
@ -731,8 +731,8 @@ int main() {
} }
for ( int i = 0; i < 3; i++ ) { for ( int i = 0; i < 3; i++ ) {
auto line = std::make_shared< SDLPP::LineRenderer >( auto line = std::make_shared< SDLPP::LineRenderer >(
BLOCK_SIZE, BLOCK_SIZE + i * BLOCK_SIZE, 2*BLOCK_SIZE, BLOCK_SIZE + i * BLOCK_SIZE,
BLOCK_SIZE + MOD_WIDTH * BLOCK_SIZE, 2*BLOCK_SIZE + MOD_WIDTH * BLOCK_SIZE,
BLOCK_SIZE + i * BLOCK_SIZE, renderer, "#282828" ); BLOCK_SIZE + i * BLOCK_SIZE, renderer, "#282828" );
line->setPermanent(); line->setPermanent();
line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
@ -740,9 +740,9 @@ int main() {
} }
//characters //characters
for ( int i = 0; i < CHARACTER_WIDTH; i++ ) { for ( int i = 0; i < CHARACTER_WIDTH; i++ ) {
auto char_box1 = std::make_shared< ToolBox >( i, 0, (MOD_WIDTH+4)*BLOCK_SIZE, auto char_box1 = std::make_shared< ToolBox >( i, 0, (MOD_WIDTH+5)*BLOCK_SIZE,
BLOCK_SIZE, renderer ); BLOCK_SIZE, renderer );
auto char_box2 = std::make_shared< ToolBox >( i, 1, (MOD_WIDTH+4)*BLOCK_SIZE, auto char_box2 = std::make_shared< ToolBox >( i, 1, (MOD_WIDTH+5)*BLOCK_SIZE,
BLOCK_SIZE, renderer ); BLOCK_SIZE, renderer );
char_box1->setType(ToolType::CHARACTER); char_box1->setType(ToolType::CHARACTER);
char_box2->setType(ToolType::CHARACTER); char_box2->setType(ToolType::CHARACTER);
@ -763,7 +763,7 @@ int main() {
global_vars.characters.back()->setPermanent(); global_vars.characters.back()->setPermanent();
auto x = tool_index % CHARACTER_WIDTH; auto x = tool_index % CHARACTER_WIDTH;
auto y = tool_index / CHARACTER_WIDTH; auto y = tool_index / CHARACTER_WIDTH;
global_vars.characters.back()->setPos( (MOD_WIDTH + 4) * BLOCK_SIZE + global_vars.characters.back()->setPos( (MOD_WIDTH + 5) * BLOCK_SIZE +
x * BLOCK_SIZE, x * BLOCK_SIZE,
BLOCK_SIZE + y * BLOCK_SIZE ); BLOCK_SIZE + y * BLOCK_SIZE );
scene->addObject( global_vars.characters.back() ); scene->addObject( global_vars.characters.back() );
@ -771,8 +771,8 @@ int main() {
} }
for ( int i = 0; i <= CHARACTER_WIDTH; i++ ) { for ( int i = 0; i <= CHARACTER_WIDTH; i++ ) {
auto line = std::make_shared< SDLPP::LineRenderer >( auto line = std::make_shared< SDLPP::LineRenderer >(
(MOD_WIDTH + 4) * BLOCK_SIZE + i * BLOCK_SIZE, BLOCK_SIZE, (MOD_WIDTH + 5) * BLOCK_SIZE + i * BLOCK_SIZE, BLOCK_SIZE,
(MOD_WIDTH + 4) * BLOCK_SIZE + i * BLOCK_SIZE, 3 * BLOCK_SIZE, (MOD_WIDTH + 5) * BLOCK_SIZE + i * BLOCK_SIZE, 3 * BLOCK_SIZE,
renderer, "#282828" ); renderer, "#282828" );
line->setPermanent(); line->setPermanent();
line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
@ -780,8 +780,8 @@ int main() {
} }
for ( int i = 0; i < 3; i++ ) { for ( int i = 0; i < 3; i++ ) {
auto line = std::make_shared< SDLPP::LineRenderer >( auto line = std::make_shared< SDLPP::LineRenderer >(
(MOD_WIDTH + 4) * BLOCK_SIZE, BLOCK_SIZE + i * BLOCK_SIZE, (MOD_WIDTH + 5) * BLOCK_SIZE, BLOCK_SIZE + i * BLOCK_SIZE,
(MOD_WIDTH + 4) * BLOCK_SIZE + CHARACTER_WIDTH * BLOCK_SIZE, (MOD_WIDTH + 5) * BLOCK_SIZE + CHARACTER_WIDTH * BLOCK_SIZE,
BLOCK_SIZE + i * BLOCK_SIZE, renderer, "#282828" ); BLOCK_SIZE + i * BLOCK_SIZE, renderer, "#282828" );
line->setPermanent(); line->setPermanent();
line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); line->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
@ -822,7 +822,7 @@ int main() {
scene->addObject( right_tool ); scene->addObject( right_tool );
// white rectangles // white rectangles
auto mod_rect1 = std::make_shared< SDLPP::RectangleRender >( auto mod_rect1 = std::make_shared< SDLPP::RectangleRender >(
0, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
renderer, "#FFFFFF88", true ); renderer, "#FFFFFF88", true );
mod_rect1->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); mod_rect1->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
mod_rect1->setId( EDITOR_LEFT_MOD_ID ); mod_rect1->setId( EDITOR_LEFT_MOD_ID );
@ -830,7 +830,7 @@ int main() {
mod_rect1->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) ); mod_rect1->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) );
scene->addObject( mod_rect1 ); scene->addObject( mod_rect1 );
auto mod_rect2 = std::make_shared< SDLPP::RectangleRender >( auto mod_rect2 = std::make_shared< SDLPP::RectangleRender >(
(MOD_WIDTH + 1) * BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, (MOD_WIDTH + 2) * BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
renderer, "#FFFFFF88", true ); renderer, "#FFFFFF88", true );
mod_rect2->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); mod_rect2->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
mod_rect2->setId( EDITOR_RIGHT_MOD_ID ); mod_rect2->setId( EDITOR_RIGHT_MOD_ID );
@ -839,14 +839,14 @@ int main() {
scene->addObject( mod_rect2 ); scene->addObject( mod_rect2 );
// arrows // arrows
auto left_mod = std::make_shared< SDLPP::TextRenderer >( auto left_mod = std::make_shared< SDLPP::TextRenderer >(
0, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE,
BLOCK_SIZE, renderer, "<", font_config ); BLOCK_SIZE, renderer, "<", font_config );
left_mod->setId( 0 ); left_mod->setId( 0 );
left_mod->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); left_mod->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
left_mod->setPermanent(); left_mod->setPermanent();
scene->addObject( left_mod ); scene->addObject( left_mod );
auto right_mod = std::make_shared< SDLPP::TextRenderer >( auto right_mod = std::make_shared< SDLPP::TextRenderer >(
(MOD_WIDTH + 1) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, (MOD_WIDTH + 2) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE,
renderer, ">", font_config ); renderer, ">", font_config );
right_mod->setId( 0 ); right_mod->setId( 0 );
right_mod->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); right_mod->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
@ -854,7 +854,7 @@ int main() {
scene->addObject( right_mod ); scene->addObject( right_mod );
// white rectangles // white rectangles
auto char_rect1 = std::make_shared< SDLPP::RectangleRender >( auto char_rect1 = std::make_shared< SDLPP::RectangleRender >(
( MOD_WIDTH + 3 ) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, ( MOD_WIDTH + 4 ) * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
renderer, "#FFFFFF88", true ); renderer, "#FFFFFF88", true );
char_rect1->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); char_rect1->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
char_rect1->setId( EDITOR_LEFT_CHARACTER_ID ); char_rect1->setId( EDITOR_LEFT_CHARACTER_ID );
@ -862,7 +862,7 @@ int main() {
char_rect1->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) ); char_rect1->addCollision( SDLPP::RectColider( 0, 0, 1, 1 ) );
scene->addObject( char_rect1 ); scene->addObject( char_rect1 );
auto char_rect2 = std::make_shared< SDLPP::RectangleRender >( auto char_rect2 = std::make_shared< SDLPP::RectangleRender >(
(MOD_WIDTH + 4 + CHARACTER_WIDTH) * BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, (MOD_WIDTH + 5 + CHARACTER_WIDTH) * BLOCK_SIZE, 1 * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
renderer, "#FFFFFF88", true ); renderer, "#FFFFFF88", true );
char_rect2->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); char_rect2->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
char_rect2->setId( EDITOR_RIGHT_CHARACTER_ID ); char_rect2->setId( EDITOR_RIGHT_CHARACTER_ID );
@ -871,14 +871,14 @@ int main() {
scene->addObject( char_rect2 ); scene->addObject( char_rect2 );
// arrows // arrows
auto left_char = std::make_shared< SDLPP::TextRenderer >( auto left_char = std::make_shared< SDLPP::TextRenderer >(
( MOD_WIDTH + 3 ) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, ( MOD_WIDTH + 4 ) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE,
BLOCK_SIZE, renderer, "<", font_config ); BLOCK_SIZE, renderer, "<", font_config );
left_char->setId( 0 ); left_char->setId( 0 );
left_char->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); left_char->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
left_char->setPermanent(); left_char->setPermanent();
scene->addObject( left_char ); scene->addObject( left_char );
auto right_char = std::make_shared< SDLPP::TextRenderer >( auto right_char = std::make_shared< SDLPP::TextRenderer >(
(MOD_WIDTH + 4 + CHARACTER_WIDTH) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, (MOD_WIDTH + 5 + CHARACTER_WIDTH) * BLOCK_SIZE, 1.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE,
renderer, ">", font_config ); renderer, ">", font_config );
right_char->setId( 0 ); right_char->setId( 0 );
right_char->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); right_char->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );