BEE::Background::Background (std::string new_name, std::string new_path) { reset(); add_to_resources(); if (id < 0) { game->messenger_send({"engine", "resource"}, BEE_MESSAGE_WARNING, "Failed to add background resource: \"" + new_name + "\" from " + new_path); throw(-1); } set_name(new_name); set_path(new_path); }
/* * BEE::Sprite::Sprite() - Construct the sprite, reset all variables, add it to the sprite resource list, and set the new name and path * @new_name: the name of the sprite to use * @new_path: the path of the sprite's image */ BEE::Sprite::Sprite (std::string new_name, std::string new_path) { reset(); // Reset all resource variables add_to_resources(); // Add the sprite to the appropriate resource list if (id < 0) { // If the sprite could not be added to the resource list game->messenger_send({"engine", "resource"}, BEE_MESSAGE_WARNING, "Failed to add sprite resource: \"" + new_name + "\" from " + new_path); throw(-1); // Throw an exception } set_name(new_name); // Set the sprite name set_path(new_path); // Set the sprite image path }
BEE::Room::Room (std::string new_name, std::string path) { reset(); add_to_resources("resources/rooms/"+path); if (id < 0) { std::cerr << "Failed to add room resource: " << path << "\n"; throw(-1); } set_name(new_name); set_path(path); }
BEE::Font::Font (std::string new_name, std::string new_path, int new_font_size, bool new_is_sprite) { reset(); add_to_resources(); if (id < 0) { game->messenger_send({"engine", "resource"}, BEE_MESSAGE_WARNING, "Failed to add font resource: \"" + new_name + "\" from " + new_path); throw(-1); } set_name(new_name); set_path(new_path); set_font_size(new_font_size); is_sprite = new_is_sprite; }
int BEE::Room::set_path(std::string path) { add_to_resources("resources/rooms"+path); room_path = "resources/rooms/"+path; return 0; }