void MainWindow::on_resized() { CL_Rect client_area = get_client_area(); menubar->set_geometry(CL_Rect(client_area.left, client_area.top, client_area.right, client_area.top + 22)); workspace->set_geometry(CL_Rect(client_area.left, client_area.top + 22, client_area.right, client_area.bottom)); }
CL_Rect CL_ListViewLayoutIcons::get_lineedit_rect(CL_ListViewItem &item, const CL_Size &text_size) const { if (shown_items.empty()) return CL_Rect(0,0,0,0); ListViewShownItem si; // 1. Find shown items, si. std::vector<ListViewShownItem>::const_iterator it; for (it=shown_items.begin(); it!=shown_items.end(); ++it) { if ((*it).item == item) { si = (*it); break; } } if (si.valid == false) return CL_Rect(0,0,0,0); // 2. Calculate text rect for 'str'. CL_Rect text_rect = si.rect_text[0]; text_rect.right = text_rect.left + text_size.width + 3; // add a few pixels extra to allow cursor to be at end of string without scrolling. // 3. Expand text rect with line-edit-offset values defined in css. text_rect.top -= lineedit_textrect_offset.top; text_rect.left -= lineedit_textrect_offset.left; text_rect.bottom += lineedit_textrect_offset.bottom; text_rect.right += lineedit_textrect_offset.right; return text_rect; }
Window::Window(const CL_Rect& rect, const std::string& title, CL_Component* parent) : CL_Component(rect, parent), impl(new WindowImpl()) { impl->titlebar = new Titlebar(CL_Rect(CL_Point(3+16,3), CL_Size(get_width()-6-18-18-18, 12+3)), title, this); //Fonts::verdana11.draw(8+15, 3, title); impl->close = new Icon(CL_Rect(CL_Point(3, 3), CL_Size(18,18)), make_sprite(datadir + "/images/window/close.png"), "", this); impl->minimize = new Icon(CL_Rect(CL_Point(get_width()-3-18-18, 3), CL_Size(18,18)), make_sprite(datadir + "/images/window/minimize.png"), "", this); impl->maximize = new Icon(CL_Rect(CL_Point(get_width()-3-18, 3), CL_Size(18,18)), make_sprite(datadir + "/images/window/maximize.png"), "", this); impl->client_area = new CL_Component(CL_Rect(CL_Point(4, 3+12+7), CL_Size(rect.get_width()-10, rect.get_height()-28)), this); impl->parent = this; impl->is_maximized = false; impl->slots.push_back(sig_resize().connect(impl.get(), &WindowImpl::on_resize)); impl->slots.push_back(sig_paint().connect(impl.get(), &WindowImpl::draw)); impl->slots.push_back(impl->maximize->sig_clicked().connect(impl.get(), &WindowImpl::do_maximize)); impl->slots.push_back(impl->close->sig_clicked().connect(impl.get(), &WindowImpl::do_close)); }
void CL_TreeView_Silver::on_resize(int old_width, int old_height) { int header_height = 20; int width = treeview->get_width(); int height = treeview->get_height(); // Position the header area header_area->set_position(CL_Rect(0, 0, width, header_height)); // Position the client area CL_Component *client_area = treeview->get_client_area(); if(treeview->is_header_visible()) { client_area->set_position(CL_Rect(1, header_height, width - 1, height - 1)); header_area->show(true); } else { client_area->set_position(CL_Rect(1, 1, width - 1, height - 1)); header_area->show(false); } update_scrollbar(false); // Scrollbar was added, shrink other areas if(visible_scrollbar) { client_area->set_width(client_area->get_width() - 19); header_area->set_width(header_area->get_width() - 19); // Position the scrollbar scrollbar->set_position(CL_Rect(width - 19, 0, width, height)); } }
int main() { Flexlay flexlay; flexlay.init(); Editor editor; GUIManager* gui = editor.get_gui_manager(); new CL_Button(CL_Rect(CL_Point(50, 50), CL_Size(100, 25)), "Hello World", gui->get_component()); EditorMap m; Tileset tileset(32); TilemapLayer tilemap(tileset, 20, 10); m.add_layer(tilemap.to_layer()); TilemapLayer::set_current(tilemap); EditorMapComponent editor_map(CL_Rect(0, 0, 799, 599), gui->get_component()); Workspace workspace(799, 599); editor_map.set_workspace(workspace); workspace.set_map(m); new CL_Button(CL_Rect(CL_Point(50, 150), CL_Size(100, 25)), "Quit", gui->get_component()); gui->run(); flexlay.deinit(); }
void TitlebarImpl::draw() { CL_Display::push_translate(parent->get_screen_x(), parent->get_screen_y()); // FIXME: Hack should be done via has_mouse_over(), but that doesn't include child components if (parent->get_parent()->get_position().is_inside(CL_Point(CL_Mouse::get_x(), CL_Mouse::get_y()))) //parent->get_parent()->has_mouse_over()) { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(250, 250, 250)); } else { CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), CL_Size(parent->get_width()-1, parent->get_height())), CL_Color(240, 240, 240)); } Fonts::verdana11.draw(4, 0, title); CL_Display::pop_modelview(); }
void CL_PixelCanvas::set_clip_rect(const CL_Rect &new_clip_rect) { clip_rect = CL_Rect(0, 0, colorbuffer0.size.width, colorbuffer0.size.height); clip_rect.overlap(new_clip_rect); if (clip_rect.get_width() < 0 || clip_rect.get_height() < 0) clip_rect = CL_Rect(0,0,0,0); cliprect_set = true; pipeline->queue(new(pipeline.get()) CL_PixelCommandSetClipRect(clip_rect)); }
void TileMapPaintToolImpl::draw() { TilemapLayer tilemap = TilemapLayer::current(); if (tilemap.is_null()) return; switch(mode) { case TileMapPaintToolImpl::SELECTING: if (CL_Keyboard::get_keycode(CL_KEY_LSHIFT)) selection.draw(CL_Color(255, 128, 128, 100)); else selection.draw(); break; default: int tile_size = tilemap.get_tileset().get_tile_size(); // Draw the brush: for(int y = 0; y < brush.get_height(); ++y) for(int x = 0; x < brush.get_width(); ++x) { Tile* tile = tilemap.get_tileset().create(brush.at(x, y)); if (tile) { CL_Sprite sprite = tile->get_sprite(); sprite.set_alpha(0.5f); sprite.draw((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size); CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 100)); } else if (brush.is_opaque()) { CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 100)); } else { CL_Display::fill_rect(CL_Rect(CL_Point((current_tile.x + x) * tile_size, (current_tile.y + y) * tile_size), CL_Size(tile_size, tile_size)), CL_Color(255, 255, 255, 50)); } } break; } }
std::vector<CL_ClanImageStretch::ImagePart> CL_ClanImageStretch::calc_stretch_image_parts(const CL_Rect &dest, CL_Image &sprite, int sizing_left, int sizing_top, int sizing_right, int sizing_bottom) { int src_width = sprite.get_width(); int src_height = sprite.get_height(); int dest_width = dest.get_width(); int dest_height = dest.get_height(); int src_grid_x[4]; int src_grid_y[4]; int dest_grid_x[4]; int dest_grid_y[4]; int rows = 0; int cols = 0; src_grid_x[cols++] = 0; src_grid_x[cols++] = sizing_left; src_grid_x[cols++] = src_width - sizing_right; src_grid_x[cols++] = src_width; src_grid_y[rows++] = 0; src_grid_y[rows++] = sizing_top; src_grid_y[rows++] = src_height - sizing_bottom; src_grid_y[rows++] = src_height; rows = 0; cols = 0; dest_grid_x[cols++] = dest.left; dest_grid_x[cols++] = dest.left + sizing_left; dest_grid_x[cols++] = dest.right - sizing_right; dest_grid_x[cols++] = dest.right; dest_grid_y[rows++] = dest.top; dest_grid_y[rows++] = dest.top + sizing_top; dest_grid_y[rows++] = dest.bottom - sizing_bottom; dest_grid_y[rows++] = dest.bottom; std::vector<ImagePart> image_parts; for (int y = 0; y < rows-1; y++) { for (int x = 0; x < cols-1; x++) { ImagePart part; part.source_rect = CL_Rect(src_grid_x[x], src_grid_y[y], src_grid_x[x+1], src_grid_y[y+1]); part.dest_rect = CL_Rect(dest_grid_x[x], dest_grid_y[y], dest_grid_x[x+1], dest_grid_y[y+1]); if (part.source_rect.get_width() > 0 && part.source_rect.get_height() > 0 && part.dest_rect.get_width() > 0 && part.dest_rect.get_height() > 0) { image_parts.push_back(part); } } } return image_parts; }
void PlayNode::Draw(CL_Rect area) { CL_Display::fill_rect(area, CL_Gradient(CL_Color(0,0,54), CL_Color(54,0,100), CL_Color(100, 50, 0), CL_Color(100, 0, 55))); mapRect = CL_Rect(area.left + 300, area.top + 100, area.right - 100, area.bottom - 100); mapNode->Draw(mapRect); inventoryRect = CL_Rect(area.left + 50, area.top + 100, area.left + 250, area.bottom - 100); inventoryNode->Draw(inventoryRect); }
TileEditor::TileEditor(int x, int y, int w, int h, CL_Component* parent) : CL_Component(CL_Rect(CL_Rect(CL_Point(x, y), CL_Size(w, h))), // FIXME: make this editable via script parent) { tile = 0; slots.connect(sig_paint(), this, &TileEditor::draw); slots.connect(sig_mouse_move(), this, &TileEditor::mouse_move); slots.connect(sig_mouse_down(), this, &TileEditor::mouse_down); slots.connect(sig_mouse_up (), this, &TileEditor::mouse_up); }
CL_PixelBuffer CL_DisplayWindow_OpenGL::get_buffer(int i) const { if (i == 0) { return gc.get_pixeldata(CL_Rect(0, 0, get_width(), get_height()), CL_FRONT); } else { return gc.get_pixeldata(CL_Rect(0, 0, get_width(), get_height()), CL_BACK); } }
CL_FileDialog_Generic::CL_FileDialog_Generic( CL_FileDialog *self, const std::string &title, const std::string &file, const std::string &filter) : filedialog(self) { behavior = CL_FileDialog::quit_always; button = CL_FileDialog::button_none; // TODO: Calculate proper size int width = 400; int height = 315; int x = (CL_Display::get_width() - width) / 2; int y = (CL_Display::get_height() - height) / 2; filedialog->set_position(CL_Rect(x, y, x + width, y + height)); filedialog->set_title(title); CL_Component *client_area = filedialog->get_client_area(); width = client_area->get_width(); label_dir = new CL_Label(CL_Point(10, 12), "Directory:", client_area); input_dir = new CL_InputBox(CL_Rect(65, 10, width - 120, 30), client_area); input_dir->enable(false); button_parent = new CL_Button(CL_Rect(width - 115, 9, width - 65, 28), "Parent", client_area); button_createdir = new CL_Button(CL_Rect(width - 60, 9, width - 10, 28), "New", client_area); treeview_files = new CL_TreeView(CL_Rect(10, 32, width - 10, 197), client_area); treeview_files->add_column("Filename", 200); treeview_files->add_column("Size", 80); treeview_files->add_column("Type", 100); treeview_files->show_root_decoration(false); label_file = new CL_Label(CL_Point(10, 207), "Filename:", client_area); input_file = new CL_InputBox(CL_Rect(65, 205, width - 10, 225), client_area); label_filter = new CL_Label(CL_Point(10, 232), "Filter:", client_area); input_filter = new CL_InputBox(CL_Rect(65, 230, width - 10, 250), client_area); button_ok = new CL_Button(CL_Rect(10, 260, 100, 280), "OK", client_area); button_cancel = new CL_Button(CL_Rect(width - 110, 260, width - 10, 280), "Cancel", client_area); slots.connect(self->sig_set_options(), this, &CL_FileDialog_Generic::on_set_options); slots.connect(treeview_files->sig_selection_changed(), this, &CL_FileDialog_Generic::on_file_activated); slots.connect(button_ok->sig_clicked(), this, &CL_FileDialog_Generic::on_button_quit, true); slots.connect(button_cancel->sig_clicked(), this, &CL_FileDialog_Generic::on_button_quit, false); slots.connect(button_parent->sig_clicked(), this, &CL_FileDialog_Generic::on_button_parent); slots.connect(button_createdir->sig_clicked(), this, &CL_FileDialog_Generic::on_button_createdir); slots.connect(input_file->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_file); slots.connect(input_filter->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_filter); slots.connect(input_dir->sig_return_pressed(), this, &CL_FileDialog_Generic::on_edit_dir); set_file(file, false); set_filter(filter, false); show_hidden = false; read_dir(); }
void WindowImpl::on_resize(int, int) { titlebar->set_position(CL_Rect(CL_Point(3+16,3), CL_Size(parent->get_width()-6-18-18-18, 12+3))); close->set_position(3, 3); minimize->set_position(parent->get_width()-3-18-18, 3); maximize->set_position(parent->get_width()-3-18, 3); CL_Rect rect = parent->get_position(); client_area->set_position(CL_Rect(CL_Point(4, 3+12+7), CL_Size(rect.get_width()-10, rect.get_height()-28))); }
void CL_TreeView_Silver::on_paint_header() { // Header if(treeview->is_header_visible()) { CL_Rect rect = header_area->get_screen_rect(); // Header background CL_Display::fill_rect( CL_Rect( rect.left + 1, rect.top + 1, rect.left + rect.get_width() - 1, rect.top + rect.get_height() - 4), CL_Gradient( CL_Color(245, 246, 247), CL_Color(245, 246, 247), CL_Color(235, 238, 241), CL_Color(235, 238, 241))); CL_Display::fill_rect( CL_Rect( rect.left + 1, rect.top + rect.get_height() - 4, rect.left + rect.get_width() - 1, rect.top + rect.get_height()), CL_Gradient( CL_Color(235, 238, 241), CL_Color(235, 238, 241), CL_Color(186, 187, 188), CL_Color(186, 187, 188))); // Draw columns int x = 0; int columns = treeview->get_column_count(); for(int i = 0; i < columns; ++i) { font->draw( rect.left + x + 6, rect.top + 4, treeview->get_column_name(i)); x += treeview->get_column_width(i); CL_Display::draw_line( rect.left + x, rect.top + 1, rect.left + x, rect.top + rect.get_height(), CL_Color(128, 142, 159)); CL_Display::draw_line( rect.left + x + 1, rect.top + 1, rect.left + x + 1, rect.top + rect.get_height(), CL_Color::white); } } }
CL_TextureGroup_Impl::Node *CL_TextureGroup_Impl::Node::insert(const CL_Size &texture_size, int texture_id) { // If we're not a leaf if(child[0] && child[1]) { // Try inserting into first child Node *new_node = child[0]->insert(texture_size, texture_id); if(new_node != NULL) return new_node; // No room, insert into second return child[1]->insert(texture_size, texture_id); } else { // If there's already a texture here, return if (id) return NULL; // If we're too small, return if (texture_size.width > node_rect.get_width() || texture_size.height > node_rect.get_height()) return NULL; // If we're just right, accept if (texture_size.width == node_rect.get_width() && texture_size.height == node_rect.get_height()) { id = texture_id; image_rect = node_rect; return this; } // Otherwise, decide which way to split int dw = node_rect.get_width() - texture_size.width; int dh = node_rect.get_height() - texture_size.height; if (dw > dh) { child[0] = new Node(CL_Rect(node_rect.left, node_rect.top, node_rect.left + texture_size.width, node_rect.bottom)); child[1] = new Node(CL_Rect(node_rect.left + texture_size.width, node_rect.top, node_rect.right, node_rect.bottom)); } else { child[0] = new Node(CL_Rect(node_rect.left, node_rect.top, node_rect.right, node_rect.top + texture_size.height)); child[1] = new Node(CL_Rect(node_rect.left, node_rect.top + texture_size.height, node_rect.right, node_rect.bottom)); } // Insert into first child we created return child[0]->insert(texture_size, texture_id); } }
void CL_GlyphCache::insert_glyph(CL_GraphicContext &gc, CL_Font_System_Position &position, CL_PixelBuffer &pixel_buffer) { unsigned int glyph = position.glyph; // Search for duplicated glyph's, if found silently ignore them std::vector< CL_Font_TextureGlyph * >::size_type size = glyph_list.size(); for (int cnt=0; cnt<size; cnt++) { if (glyph_list[cnt]->glyph == glyph) return; } CL_Font_TextureGlyph *font_glyph = new CL_Font_TextureGlyph(); glyph_list.push_back(font_glyph); font_glyph->glyph = glyph; font_glyph->offset = CL_Point(position.x_offset, position.y_offset); font_glyph->increment = CL_Point(position.x_increment, position.y_increment); if ( (position.width > 0 ) && (position.height > 0) ) { CL_Rect source_rect(position.x_pos, position.y_pos, position.width + position.x_pos, position.height + position.y_pos); CL_PixelBuffer buffer_with_border = CL_PixelBufferHelp::add_border(pixel_buffer, glyph_border_size, source_rect); font_glyph->empty_buffer = false; font_glyph->subtexture = texture_group.add(gc, CL_Size(buffer_with_border.get_width(), buffer_with_border.get_height() )); font_glyph->geometry = CL_Rect(font_glyph->subtexture.get_geometry().left + glyph_border_size, font_glyph->subtexture.get_geometry().top + glyph_border_size, source_rect.get_size() ); font_glyph->subtexture.get_texture().set_subimage(font_glyph->subtexture.get_geometry().left, font_glyph->subtexture.get_geometry().top, buffer_with_border, buffer_with_border.get_size()); } else { font_glyph->empty_buffer = true; } }
void CL_GlyphCache::insert_glyph(CL_GraphicContext &gc, CL_FontPixelBuffer &pb) { // Search for duplicated glyph's, if found silently ignore them std::vector< CL_Font_TextureGlyph * >::size_type size = glyph_list.size(); for (int cnt=0; cnt<size; cnt++) { if (glyph_list[cnt]->glyph == pb.glyph) return ; } CL_Font_TextureGlyph *font_glyph = new CL_Font_TextureGlyph(); glyph_list.push_back(font_glyph); font_glyph->glyph = pb.glyph; font_glyph->empty_buffer = pb.empty_buffer; font_glyph->offset = pb.offset; font_glyph->increment = pb.increment; if (!pb.empty_buffer) { CL_PixelBuffer buffer_with_border = CL_PixelBufferHelp::add_border(pb.buffer, glyph_border_size, pb.buffer_rect); font_glyph->empty_buffer = false; font_glyph->subtexture = texture_group.add(gc, CL_Size(buffer_with_border.get_width(), buffer_with_border.get_height() )); font_glyph->geometry = CL_Rect(font_glyph->subtexture.get_geometry().left + glyph_border_size, font_glyph->subtexture.get_geometry().top + glyph_border_size, pb.buffer_rect.get_size() ); font_glyph->subtexture.get_texture().set_subimage(font_glyph->subtexture.get_geometry().left, font_glyph->subtexture.get_geometry().top, buffer_with_border, buffer_with_border.get_size()); } }
int App::start(const std::vector<CL_String> &args) { CL_String theme; if (CL_FileHelp::file_exists("../../../Resources/GUIThemeAero/theme.css")) theme = "../../../Resources/GUIThemeAero"; else if (CL_FileHelp::file_exists("../../../Resources/GUIThemeBasic/theme.css")) theme = "../../../Resources/GUIThemeBasic"; else throw CL_Exception("Not themes found"); CL_GUIManager gui(theme); CL_DisplayWindowDescription win_desc; win_desc.set_allow_resize(true); win_desc.set_title("GUILayout Test Application"); win_desc.set_position(CL_Rect(200, 200, 540, 440), false); win_desc.set_visible(false); CL_Window window(&gui, win_desc); window.func_close().set(this, &App::on_close, &window); CL_GUILayoutCorners layout; window.set_layout(layout); window.create_components("Resources/layout.xml"); CL_PushButton *button = CL_PushButton::get_named_item(&window, "MyButton"); button->func_clicked().set(this, &App::on_button_clicked, button); label = CL_Label::get_named_item(&window, "MyLabel"); window.set_visible(true); gui.exec(); return 0; }
void WindowImpl::draw() { CL_Display::push_translate (parent->get_screen_x(), parent->get_screen_y()); CL_Color highlight(255, 255, 255); CL_Color midtone(150, 150, 150); CL_Rect rect = parent->get_position() ; Box::draw_window(CL_Rect(CL_Point(0, 0), CL_Size(rect.get_width()-1, rect.get_height()-1))); Box::draw_panel_down(client_area->get_position()); /* CL_Display::fill_rect(CL_Rect(CL_Point(0, 0), rect.get_size()), CL_Color(220, 220, 220)); CL_Display::draw_rect(CL_Rect(CL_Point(0, 0), rect.get_size()), CL_Color(0, 0, 0)); CL_Display::draw_line(1, rect.get_height()-2, rect.get_width()-2, rect.get_height()-2, midtone); CL_Display::draw_line(rect.get_width()-2, 1, rect.get_width()-2, rect.get_height()-2, midtone); CL_Display::draw_line(1, 1, rect.get_width()-2, 1, highlight); CL_Display::draw_line(1, 1, 1, rect.get_height()-2, highlight); */ CL_Display::pop_modelview(); }
void Radar::draw_blip(const FloatVector2d& arg_pos, int size, float red, float green, float blue) { // Callculate the distance between 'pos' and the vehicle that holds // the radar FloatVector2d diff = arg_pos; diff -= player->get_current_unit()->get_pos(); diff *= 1/30.0f; float alpha =(diff.get_length() / 64.0); alpha *= alpha * alpha; alpha = 1.0f - alpha; if (diff.get_length() < 64.0) { //diff = diff.rotate(-vehicle->get_angle () + (3.14159/2), FloatVector2d (0, 0, 1.0)); CL_Display::fill_rect(CL_Rect(int(pos.x + diff.x) - size, int(pos.y + diff.y) - size, int(pos.x + diff.x) + size, int(pos.y + diff.y) + size), CL_Color(int(255*red), int(255*green), int(255*blue), int(255*alpha))); } }
void CL_ListViewHeader_Impl::update_geometry(const CL_Rect &parent_content_rect) { int header_height = part_component.get_preferred_height(); CL_Rect rect_header = CL_Rect( parent_content_rect.left, parent_content_rect.top, parent_content_rect.right-1, parent_content_rect.top+header_height); CL_Rect rect(rect_header.get_size()); listview_header->set_geometry(rect_header); CL_Rect content_rect = part_component.get_content_box(listview_header->get_geometry().get_size()); int xpos = content_rect.left; CL_ListViewColumnHeader col = first_column; while (!col.is_null()) { CL_Rect &R = col.impl->rect; R.left = xpos; R.top = 0; R.right = xpos + col.get_width(); R.bottom = header_height; if (col.get_next_sibling().is_null()) R.right = content_rect.right; xpos += col.get_width(); col = col.get_next_sibling(); } }
void Slider::draw() { CL_Display::push_modelview(); CL_Display::add_translate(get_screen_x(), get_screen_y()); CL_Display::fill_rect(CL_Rect(CL_Point(0, get_height()/2 - 2), CL_Size(get_width(), 5)), CL_Color(255, 255, 255, 255)); CL_Display::fill_rect(CL_Rect(CL_Point(int(-2 + (value/(end-start)) * get_width()), 0), CL_Size(5, get_height())), CL_Color(0, 0, 0, 255)); CL_Display::pop_modelview(); }
CL_Rect CL_Quadx<Type>::get_bounds() const { return CL_Rect( cl_min(cl_min(cl_min(p.x, q.x), r.x), s.x), cl_min(cl_min(cl_min(p.y, q.y), r.y), s.y), cl_max(cl_max(cl_max(p.x, q.x), r.x), s.x), cl_max(cl_max(cl_max(p.y, q.y), r.y), s.y)); }
void DialogScene::updateRects(CL_Size window) { const int margins = 20; m_rcBub = CL_Rect(window); m_rcBub.shrink(window.width/8, margins, window.width/8, 2 * window.height / 3); m_rcText = m_rcBub; m_rcText.shrink(margins); }
VideoWindow::VideoWindow(OpenNi *kinect) { cout << "videoWindow" << endl; this->kinect = kinect; CL_DisplayWindowDescription window_desc; window_desc.set_size(CL_Size(640, 480), true); window_desc.set_title("MagnetoPong!!!11einself - Video - mouseklick = start/stop"); window_desc.set_visible(true); window_desc.set_position(CL_Rect(1,1,CL_Size(640, 480)),true); window = CL_DisplayWindow(window_desc); CL_Slot slot_quit = window.sig_window_close().connect(this, &VideoWindow::on_window_close); graphicContext = window.get_gc(); graphicContext.clear(CL_Colorf::white); //Fenster mit Weiß löschen window.show(); window.flip(); window.set_visible(true, false); window_open = true; show_video = true; mouse_down = false; mouse = new CL_InputDevice(); *mouse = window.get_ic().get_mouse(0); timepast = 42; //24fps; }
void CL_TabHeader_Impl::update_handle_rects() { CL_GraphicContext &gc = component->get_gc(); int last_tab_end_x = first_tab_x_offset; std::vector<Handle>::size_type i; for (i = 0; i < tabs.size(); ++i) { int tab_width = tabs[i].part.get_preferred_width(); // Apply padding-left, padding-right css values: CL_Rect render_rect = tabs[i].part.get_render_box(tabs[i].part.get_text_size(gc, tabs[i].label)); if (render_rect.get_width() > tab_width) { tab_width = render_rect.get_width(); } tabs[i].rect = CL_Rect( last_tab_end_x, 0, last_tab_end_x + tab_width, tabs[i].part.get_preferred_height()); last_tab_end_x += tab_width; } }
bool CL_OpenGLWindowProvider_GLX::on_clicked(XButtonEvent &event) { if (event.button != 1) // Left mouse button return true; int height = get_viewport().get_height(); glDrawBuffer(GL_BACK); glReadBuffer(GL_FRONT); CL_Rect rect = CL_Rect(event.x,event.y, CL_Size(1,1)); CL_PixelBuffer pixelbuffer(rect.get_width(), rect.get_height(), cl_rgba8); glReadPixels( rect.left, height - rect.bottom, rect.right - rect.left, rect.bottom - rect.top, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, pixelbuffer.get_data()); const cl_ubyte32 *xptr = (const cl_ubyte32 *) (pixelbuffer.get_data()); if (((*xptr) & 0xFF) < 10) { XLowerWindow(x11_window.get_display(), x11_window.get_window()); return false; } return true; }
CL_Rect DrawingContext::get_clip_rect() { return CL_Rect(CL_Point(static_cast<int>(translate_stack.back().x), static_cast<int>(translate_stack.back().y)), CL_Size(800, 600)); }
CL_Rect CL_Quad::get_bounds() const { return CL_Rect( cl_min(cl_min(cl_min(x1, x2), x3), x4), cl_min(cl_min(cl_min(y1, y2), y3), y4), cl_max(cl_max(cl_max(x1, x2), x3), x4), cl_max(cl_max(cl_max(y1, y2), y3), y4)); }