1
Fork 0

Changed font, added label to join

This commit is contained in:
Joshua Moerman 2013-04-24 09:42:32 +02:00
parent d399c201eb
commit bab086a021

View file

@ -191,8 +191,8 @@ namespace games {
context = libwebsocket_create_context(&info); context = libwebsocket_create_context(&info);
if(!context) throw std::runtime_error("context could not be created."); if(!context) throw std::runtime_error("context could not be created.");
std::string address = "127.0.0.1"; // std::string address = "127.0.0.1";
// std::string address = "vadovas-studios.com"; std::string address = "vadovas-studios.com";
wsi = libwebsocket_client_connect(context, address.c_str(), 7681, false, "/", address.c_str(), "origin", "uberclient", -1); wsi = libwebsocket_client_connect(context, address.c_str(), 7681, false, "/", address.c_str(), "origin", "uberclient", -1);
if(!wsi) throw std::runtime_error("socket could not be created."); if(!wsi) throw std::runtime_error("socket could not be created.");
@ -200,6 +200,12 @@ namespace games {
world.physics.set_gravity({0.0, 0.0, 0.0}); world.physics.set_gravity({0.0, 0.0, 0.0});
hud->camera.set_orthographic(-100, 100, -100, 100, 1, -1); hud->camera.set_orthographic(-100, 100, -100, 100, 1, -1);
update_peeps(""); update_peeps("");
auto join_lbl = std::make_shared<motor::TextureLabel>("Join at: http://vadovas-studios.com/beats", motor::bundle.get_font_path() + "Arial Rounded Bold.ttf", 72);
join_lbl->get_mesh()->material->diffuse_color = {1.0f, 1.0f, 1.0f, 1.0f};
join_lbl->set_position({-95.0, -95.0, 0.0});
join_lbl->set_scale(motor::scale(0.05));
join_lbl->set_rotation(motor::lookat_rotation({0, 0, -1}, {0, 1, 0}));
hud->add(join_lbl);
} }
void Client::handle_input(float dt, Input input){ void Client::handle_input(float dt, Input input){
@ -292,7 +298,7 @@ namespace games {
void Client::update_peeps(std::string peeps){ void Client::update_peeps(std::string peeps){
if(!peeps_lbl){ if(!peeps_lbl){
try { try {
peeps_lbl = std::make_shared<motor::TextureLabel>("Peeps:", motor::bundle.get_font_path() + "VeraMoBd.ttf", 72); peeps_lbl = std::make_shared<motor::TextureLabel>("Peeps:", motor::bundle.get_font_path() + "Arial Rounded Bold.ttf", 72);
peeps_lbl->get_mesh()->material->diffuse_color = {1.0f, 1.0f, 1.0f, 1.0f}; peeps_lbl->get_mesh()->material->diffuse_color = {1.0f, 1.0f, 1.0f, 1.0f};
peeps_lbl->set_position({-95.0, -90.0, 0.0}); peeps_lbl->set_position({-95.0, -90.0, 0.0});
peeps_lbl->set_scale(motor::scale(0.05)); peeps_lbl->set_scale(motor::scale(0.05));
@ -302,8 +308,12 @@ namespace games {
CERR << e.what() << std::endl; CERR << e.what() << std::endl;
} }
} }
if(peeps == ""){
peeps_lbl->set_text("No peeps online :(.");
} else {
peeps_lbl->set_text("Peeps: " + peeps); peeps_lbl->set_text("Peeps: " + peeps);
} }
}
void Client::update(float const dt, Input input){ void Client::update(float const dt, Input input){
// motor // motor