// Notification of the changing of one or more rows from an observed data source's table. void DataSourceListener::OnRowChange(DataSource* ROCKET_UNUSED_PARAMETER(data_source), const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(table), int ROCKET_UNUSED_PARAMETER(first_row_changed), int ROCKET_UNUSED_PARAMETER(num_rows_changed)) { ROCKET_UNUSED(data_source); ROCKET_UNUSED(table); ROCKET_UNUSED(first_row_changed); ROCKET_UNUSED(num_rows_changed); }
bool XMLNodeHandlerBody::ElementEnd(XMLParser* ROCKET_UNUSED_PARAMETER(parser), const String& ROCKET_UNUSED_PARAMETER(name)) { ROCKET_UNUSED(parser); ROCKET_UNUSED(name); return true; }
// Returns true if the element is the first DOM child in its parent. bool StyleSheetNodeSelectorFirstChild::IsApplicable(const Element* element, int ROCKET_UNUSED_PARAMETER(a), int ROCKET_UNUSED_PARAMETER(b)) { ROCKET_UNUSED(a); ROCKET_UNUSED(b); Element* parent = element->GetParentNode(); if (parent == NULL) return false; int child_index = 0; while (child_index < parent->GetNumChildren()) { // If this child (the first non-text child) is our element, then the selector succeeds. Element* child = parent->GetChild(child_index); if (child == element) return true; // If this child is not a text element, then the selector fails; this element is non-trivial. if (rocket_dynamic_cast< ElementText* >(child) == NULL && child->GetDisplay() != DISPLAY_NONE) return false; // Otherwise, skip over the text element to find the last non-trivial element. child_index++; } return false; }
// Expands the original glyph texture for the outline. void FontEffectNone::GenerateGlyphTexture(byte* ROCKET_UNUSED_PARAMETER(destination_data), const Vector2i& ROCKET_UNUSED_PARAMETER(destination_dimensions), int ROCKET_UNUSED_PARAMETER(destination_stride), const FontGlyph& ROCKET_UNUSED_PARAMETER(glyph)) const { ROCKET_UNUSED(destination_data); ROCKET_UNUSED(destination_dimensions); ROCKET_UNUSED(destination_stride); ROCKET_UNUSED(glyph); }
// Returns true if the element is the last DOM child in its parent. bool StyleSheetNodeSelectorLastOfType::IsApplicable(const Element* element, int ROCKET_UNUSED_PARAMETER(a), int ROCKET_UNUSED_PARAMETER(b)) { ROCKET_UNUSED(a); ROCKET_UNUSED(b); Element* parent = element->GetParentNode(); if (parent == NULL) return false; int child_index = parent->GetNumChildren() - 1; while (child_index >= 0) { // If this child is our element, then it's the first one we've found with our tag; the selector succeeds. Element* child = parent->GetChild(child_index); if (child == element) return true; // Otherwise, if this child shares our element's tag, then our element is not the first tagged child; the // selector fails. if (child->GetTagName() == element->GetTagName() && child->GetDisplay() != DISPLAY_NONE) return false; child_index--; } return false; }
bool operator()(const Rocket::Core::StringList& ROCKET_UNUSED_PARAMETER(left), const Rocket::Core::StringList& ROCKET_UNUSED_PARAMETER(right)) { ROCKET_UNUSED(left); ROCKET_UNUSED(right); return false; }
bool XMLNodeHandlerTabSet::ElementEnd(Core::XMLParser* ROCKET_UNUSED_PARAMETER(parser), const Rocket::Core::String& ROCKET_UNUSED_PARAMETER(name)) { ROCKET_UNUSED(parser); ROCKET_UNUSED(name); return true; }
// Instances a decorator given the property tag and attributes from the RCSS file. Decorator* DecoratorNoneInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& ROCKET_UNUSED_PARAMETER(properties)) { ROCKET_UNUSED(name); ROCKET_UNUSED(properties); return new DecoratorNone(); }
// Instances an outline font effect. FontEffect* FontEffectNoneInstancer::InstanceFontEffect(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& ROCKET_UNUSED_PARAMETER(properties)) { ROCKET_UNUSED(name); ROCKET_UNUSED(properties); FontEffectNone* none_effect = new FontEffectNone(); return none_effect; }
// Called by Rocket when a texture is required by the library. bool RenderInterface::LoadTexture(TextureHandle& ROCKET_UNUSED_PARAMETER(texture_handle), Vector2i& ROCKET_UNUSED_PARAMETER(texture_dimensions), const String& ROCKET_UNUSED_PARAMETER(source)) { ROCKET_UNUSED(texture_handle); ROCKET_UNUSED(texture_dimensions); ROCKET_UNUSED(source); return false; }
// Resizes and repositions the glyph to fit the outline. bool FontEffectNone::GetGlyphSize(Vector2i& ROCKET_UNUSED_PARAMETER(origin), Vector2i& ROCKET_UNUSED_PARAMETER(dimensions), const FontGlyph& ROCKET_UNUSED_PARAMETER(glyph)) const { ROCKET_UNUSED(origin); ROCKET_UNUSED(dimensions); ROCKET_UNUSED(glyph); return false; }
// Called by Rocket when a texture is required to be built from an internally-generated sequence of pixels. bool RenderInterface::GenerateTexture(TextureHandle& ROCKET_UNUSED_PARAMETER(texture_handle), const byte* ROCKET_UNUSED_PARAMETER(source), const Vector2i& ROCKET_UNUSED_PARAMETER(source_dimensions), int ROCKET_UNUSED_PARAMETER(source_samples)) { ROCKET_UNUSED(texture_handle); ROCKET_UNUSED(source); ROCKET_UNUSED(source_dimensions); ROCKET_UNUSED(source_samples); return false; }
// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future. CompiledGeometryHandle RenderInterface::CompileGeometry(Vertex* ROCKET_UNUSED_PARAMETER(vertices), int ROCKET_UNUSED_PARAMETER(num_vertices), int* ROCKET_UNUSED_PARAMETER(indices), int ROCKET_UNUSED_PARAMETER(num_indices), TextureHandle ROCKET_UNUSED_PARAMETER(texture)) { ROCKET_UNUSED(vertices); ROCKET_UNUSED(num_vertices); ROCKET_UNUSED(indices); ROCKET_UNUSED(num_indices); ROCKET_UNUSED(texture); return 0; }
// Called by Rocket when it wants to compile geometry it believes will be static for the forseeable future. Rocket::Core::CompiledGeometryHandle ShellRenderInterfaceOpenGL::CompileGeometry(Rocket::Core::Vertex* ROCKET_UNUSED_PARAMETER(vertices), int ROCKET_UNUSED_PARAMETER(num_vertices), int* ROCKET_UNUSED_PARAMETER(indices), int ROCKET_UNUSED_PARAMETER(num_indices), const Rocket::Core::TextureHandle ROCKET_UNUSED_PARAMETER(texture)) { ROCKET_UNUSED(vertices); ROCKET_UNUSED(num_vertices); ROCKET_UNUSED(indices); ROCKET_UNUSED(num_indices); ROCKET_UNUSED(texture); return (Rocket::Core::CompiledGeometryHandle) NULL; }
// Called to render the decorator on an element. void DecoratorDefender::RenderElement(Rocket::Core::Element* element, Rocket::Core::DecoratorDataHandle ROCKET_UNUSED_PARAMETER(element_data)) { ROCKET_UNUSED(element_data); Rocket::Core::Vector2f position = element->GetAbsoluteOffset(Rocket::Core::Box::PADDING); Rocket::Core::Vector2f size = element->GetBox().GetSize(Rocket::Core::Box::PADDING); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, (GLuint) GetTexture(image_index)->GetHandle(element->GetRenderInterface())); Rocket::Core::Colourb colour = element->GetProperty< Rocket::Core::Colourb >("color"); glColor4ubv(colour); glBegin(GL_QUADS); glVertex2f(position.x, position.y); glTexCoord2f(0, 1); glVertex2f(position.x, position.y + size.y); glTexCoord2f(1, 1); glVertex2f(position.x + size.x, position.y + size.y); glTexCoord2f(1, 0); glVertex2f(position.x + size.x, position.y); glTexCoord2f(0, 0); glEnd(); glColor4ub(255, 255, 255, 255); }
// Called to render the decorator on an element. void DecoratorStarfield::RenderElement(Rocket::Core::Element* ROCKET_UNUSED_PARAMETER(element), Rocket::Core::DecoratorDataHandle element_data) { ROCKET_UNUSED(element); StarField* star_field = (StarField*)element_data; star_field->Update(); glDisable(GL_TEXTURE_2D); glPointSize(2); glBegin(GL_POINTS); for (size_t i = 0; i < star_field->star_layers.size(); i++) { glColor4ubv(star_field->star_layers[i].colour); for (size_t j = 0; j < star_field->star_layers[i].stars.size(); j++) { glVertex2f(star_field->star_layers[i].stars[j].x, star_field->star_layers[i].stars[j].y); } } glEnd(); glColor4ub(255, 255, 255, 255); }
// Called to parse a RCSS number declaration. bool PropertyParserNumber::ParseValue(Property& property, const String& value, const ParameterMap& ROCKET_UNUSED_PARAMETER(parameters)) const { ROCKET_UNUSED(parameters); // Default to a simple number. property.unit = Property::NUMBER; // Check for a unit declaration at the end of the number. size_t unit_pos = value.Length(); for (size_t i = 0; i < unit_suffixes.size(); i++) { const UnitSuffix& unit_suffix = unit_suffixes[i]; if (value.Length() < unit_suffix.second.Length()) continue; size_t test_unit_pos = value.Length() - unit_suffix.second.Length(); if (strcasecmp(value.CString() + test_unit_pos, unit_suffix.second.CString()) == 0) { unit_pos = test_unit_pos; property.unit = unit_suffix.first; break; } } float float_value; String str_value( value.CString(), value.CString() + unit_pos ); if (sscanf(str_value.CString(), "%f", &float_value) == 1) { property.value = Variant(float_value); return true; } return false; }
// Called by Rocket when it wants to render geometry that it does not wish to optimise. void ShellRenderInterfaceOpenGL::RenderGeometry(Rocket::Core::Vertex* vertices, int ROCKET_UNUSED_PARAMETER(num_vertices), int* indices, int num_indices, const Rocket::Core::TextureHandle texture, const Rocket::Core::Vector2f& translation) { ROCKET_UNUSED(num_vertices); glPushMatrix(); glTranslatef(translation.x, translation.y, 0); glVertexPointer(2, GL_FLOAT, sizeof(Rocket::Core::Vertex), &vertices[0].position); glEnableClientState(GL_COLOR_ARRAY); glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(Rocket::Core::Vertex), &vertices[0].colour); if (!texture) { glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); } else { glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, (GLuint) texture); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_FLOAT, sizeof(Rocket::Core::Vertex), &vertices[0].tex_coord); } glDrawElements(GL_TRIANGLES, num_indices, GL_UNSIGNED_INT, indices); glPopMatrix(); }
// Sets the length the bar represents in some arbitrary unit, relative to the track length. void WidgetSliderScroll::SetBarLength(float _bar_length, bool ROCKET_UNUSED_PARAMETER(force_resize)) { ROCKET_UNUSED(force_resize); if (bar_length != _bar_length) { bar_length = _bar_length; // GenerateBar(); } }
// Sets the length of the entire track in some arbitrary unit. void WidgetSliderScroll::SetTrackLength(float _track_length, bool ROCKET_UNUSED_PARAMETER(force_resize)) { ROCKET_UNUSED(force_resize); if (track_length != _track_length) { track_length = _track_length; // GenerateBar(); } }
// Called from Ogre before a queue group is rendered. void RocketApplication::renderQueueStarted(uint8 queueGroupId, const Ogre::String& invocation, bool& ROCKET_UNUSED_PARAMETER(skipThisInvocation)) { ROCKET_UNUSED(skipThisInvocation); if (queueGroupId == Ogre::RENDER_QUEUE_OVERLAY && Ogre::Root::getSingleton().getRenderSystem()->_getViewport()->getOverlaysEnabled()) { context->Update(); ConfigureRenderSystem(); context->Render(); } }
Element* LuaElementInstancer::InstanceElement(Element* ROCKET_UNUSED_PARAMETER(parent), const String& tag, const XMLAttributes& ROCKET_UNUSED_PARAMETER(attributes)) { ROCKET_UNUSED(parent); ROCKET_UNUSED(attributes); lua_State* L = Interpreter::GetLuaState(); int top = lua_gettop(L); Element* ret = NULL; if(ref_InstanceElement != LUA_REFNIL && ref_InstanceElement != LUA_NOREF) { PushFunctionsTable(L); lua_rawgeti(L,-1,ref_InstanceElement); //push the function lua_pushstring(L,tag.CString()); //push the tag Interpreter::ExecuteCall(1,1); //we pass in a string, and we want to get an Element back ret = LuaType<Element>::check(L,-1); } else { Log::Message(Log::LT_WARNING, "Attempt to call the function for ElementInstancer.InstanceElement, the function does not exist."); } lua_settop(L,top); return ret; }
// Resizes and repositions the glyph to fit the outline. bool FontEffectOutline::GetGlyphMetrics(Vector2i& origin, Vector2i& dimensions, const FontGlyph& ROCKET_UNUSED_PARAMETER(glyph)) const { ROCKET_UNUSED(glyph); if (dimensions.x * dimensions.y > 0) { origin.x -= width; origin.y -= width; dimensions.x += width; dimensions.y += width; return true; } return false; }
// Instances a box decorator. Decorator* DecoratorTiledImageInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties) { ROCKET_UNUSED(name); DecoratorTiled::Tile tile; String texture_name; String rcss_path; GetTileProperties(tile, texture_name, rcss_path, properties, "image"); DecoratorTiledImage* decorator = new DecoratorTiledImage(); if (decorator->Initialise(tile, texture_name, rcss_path)) return decorator; decorator->RemoveReference(); ReleaseDecorator(decorator); return NULL; }
// Called to parse a RCSS number declaration. bool PropertyParserNumber::ParseValue(Property& property, const String& value, const ParameterMap& ROCKET_UNUSED_PARAMETER(parameters)) const { ROCKET_UNUSED(parameters); // Default to a simple number. property.unit = Property::NUMBER; // var to save string representation of suffix String stSuffix; // Check for a unit declaration at the end of the number. for (size_t i = 0; i < unit_suffixes.size(); i++) { const UnitSuffix& unit_suffix = unit_suffixes[i]; if (value.Length() < unit_suffix.second.Length()) continue; if (strcasecmp(value.CString() + (value.Length() - unit_suffix.second.Length()), unit_suffix.second.CString()) == 0) { property.unit = unit_suffix.first; stSuffix = unit_suffix.second; break; } } float float_value; if ( (sscanf(value.CString(), "%f", &float_value) == 1) #ifdef __EMSCRIPTEN__ // this is a hack due the fact that emscripten is not converting float of the // form 10.5em because it interprets the e following the 5 as exponential part // of the float. gcc is doing it but also in an undefined way as it consumes the e // which should be part of the following string. || (!stSuffix.Empty() && sscanf(value.Replace(stSuffix,"").CString(),"%f",&float_value)==1) #endif ) { property.value = Variant(float_value); return true; } return false; }
// Instances a box decorator. Decorator* DecoratorTiledVerticalInstancer::InstanceDecorator(const String& ROCKET_UNUSED_PARAMETER(name), const PropertyDictionary& properties) { ROCKET_UNUSED(name); DecoratorTiled::Tile tiles[3]; String texture_names[3]; String rcss_paths[3]; GetTileProperties(tiles[0], texture_names[0], rcss_paths[0], properties, "top-image"); GetTileProperties(tiles[1], texture_names[1], rcss_paths[1], properties, "bottom-image"); GetTileProperties(tiles[2], texture_names[2], rcss_paths[2], properties, "center-image"); DecoratorTiledVertical* decorator = new DecoratorTiledVertical(); if (decorator->Initialise(tiles, texture_names, rcss_paths)) return decorator; decorator->RemoveReference(); ReleaseDecorator(decorator); return NULL; }
// Updates a property dictionary of all properties for a single group. int ElementDefinition::BuildPropertyGroupDictionary(PropertyDictionary& group_properties, const String& ROCKET_UNUSED_PARAMETER(group_type), const String& group_name, const PropertyDictionary& element_properties) { ROCKET_UNUSED(group_type); int num_properties = 0; for (PropertyMap::const_iterator property_iterator = element_properties.GetProperties().begin(); property_iterator != element_properties.GetProperties().end(); ++property_iterator) { const String& full_property_name = (*property_iterator).first; if (full_property_name.Length() > group_name.Length() + 1 && strncasecmp(full_property_name.CString(), group_name.CString(), group_name.Length()) == 0 && full_property_name[group_name.Length()] == '-') { String property_name = full_property_name.Substring(group_name.Length() + 1); // if (property_name == group_type) // continue; group_properties.SetProperty(property_name, (*property_iterator).second); num_properties++; } } return num_properties; }
// Called to parse a RCSS number declaration. bool PropertyParserNumber::ParseValue(Property& property, const String& value, const ParameterMap& ROCKET_UNUSED_PARAMETER(parameters)) const { ROCKET_UNUSED(parameters); // Default to a simple number. property.unit = Property::NUMBER; // var to save string representation of suffix String stSuffix; // Check for a unit declaration at the end of the number. for (size_t i = 0; i < unit_suffixes.size(); i++) { const UnitSuffix& unit_suffix = unit_suffixes[i]; if (value.Length() < unit_suffix.second.Length()) continue; if (strcasecmp(value.CString() + (value.Length() - unit_suffix.second.Length()), unit_suffix.second.CString()) == 0) { property.unit = unit_suffix.first; stSuffix = unit_suffix.second; break; } } float float_value; if ((sscanf(value.CString(), "%f", &float_value) == 1) || (!stSuffix.Empty() && sscanf(value.Replace(stSuffix, "").CString(), "%f", &float_value) == 1)) { property.value = Variant(float_value); return true; } return false; }
int main(int ROCKET_UNUSED_PARAMETER(argc), char** ROCKET_UNUSED_PARAMETER(argv)) #endif { #ifdef ROCKET_PLATFORM_WIN32 ROCKET_UNUSED(instance_handle); ROCKET_UNUSED(previous_instance_handle); ROCKET_UNUSED(command_line); ROCKET_UNUSED(command_show); #else ROCKET_UNUSED(argc); ROCKET_UNUSED(argv); #endif #ifdef ROCKET_PLATFORM_LINUX #define APP_PATH "../Samples/tutorial/tutorial_drag/" #else #define APP_PATH "../../Samples/tutorial/tutorial_drag/" #endif #ifdef ROCKET_PLATFORM_WIN32 AllocConsole(); #endif int window_width = 1024; int window_height = 768; ShellRenderInterfaceOpenGL opengl_renderer; shell_renderer = &opengl_renderer; // Generic OS initialisation, creates a window and attaches OpenGL. if (!Shell::Initialise(APP_PATH) || !Shell::OpenWindow("Drag Tutorial", shell_renderer, window_width, window_height, true)) { Shell::Shutdown(); return -1; } // Rocket initialisation. Rocket::Core::SetRenderInterface(&opengl_renderer); opengl_renderer.SetViewport(window_width, window_height); ShellSystemInterface system_interface; Rocket::Core::SetSystemInterface(&system_interface); Rocket::Core::Initialise(); // Create the main Rocket context and set it on the shell's input layer. context = Rocket::Core::CreateContext("main", Rocket::Core::Vector2i(window_width, window_height)); if (context == NULL) { Rocket::Core::Shutdown(); Shell::Shutdown(); return -1; } Rocket::Debugger::Initialise(context); Input::SetContext(context); shell_renderer->SetContext(context); Shell::LoadFonts("../../assets/"); // Load and show the inventory document. Inventory* inventory_1 = new Inventory("Inventory 1", Rocket::Core::Vector2f(50, 200), context); Inventory* inventory_2 = new Inventory("Inventory 2", Rocket::Core::Vector2f(540, 240), context); // Add items into the inventory. inventory_1->AddItem("Mk III L.A.S.E.R."); inventory_1->AddItem("Gravity Descender"); inventory_1->AddItem("Closed-Loop Ion Beam"); inventory_1->AddItem("5kT Mega-Bomb"); Shell::EventLoop(GameLoop); delete inventory_1; delete inventory_2; // Shutdown Rocket. context->RemoveReference(); Rocket::Core::Shutdown(); Shell::CloseWindow(); Shell::Shutdown(); return 0; }
// Sizes the inline box's element. void LayoutInlineBoxText::SizeElement(bool ROCKET_UNUSED_PARAMETER(split)) { ROCKET_UNUSED(split); }