本文整理汇总了C++中CL_Rect::get_width方法的典型用法代码示例。如果您正苦于以下问题:C++ CL_Rect::get_width方法的具体用法?C++ CL_Rect::get_width怎么用?C++ CL_Rect::get_width使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CL_Rect
的用法示例。
在下文中一共展示了CL_Rect::get_width方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_paint_header
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);
}
}
}
示例2: on_clicked
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;
}
示例3: draw
void Map::draw(float elapsed)
{
CL_Vec2<float> fieldSize;
CL_Pointf p;
CL_Rect viewport = window.get_viewport();
fieldSize.x = (float)viewport.get_width() / size.width;
fieldSize.y = (float)viewport.get_height() / size.height;
for (int row = 0; row < size.height; row++)
for (int col = 0; col < size.width; col++)
{
p = CL_Pointf(col * fieldSize.x, row * fieldSize.y) + fieldSize / 2;
if (row < size.height - 1)
{
CL_Colorf color(getEdge(CL_Point(col, row), CL_Point(col, row + 1)).pheromone / 10, 0, 0);
CL_Draw::line(window.get_gc(), p, p + CL_Vec2<float>(0, fieldSize.y), color);
}
if (col < size.width - 1)
{
CL_Colorf color(getEdge(CL_Point(col, row), CL_Point(col + 1, row)).pheromone / 10, 0, 0);
CL_Draw::line(window.get_gc(), p, p + CL_Vec2<float>(fieldSize.x, 0), color);
}
}
p = CL_Pointf(start.x * fieldSize.x, start.y * fieldSize.y);
CL_Draw::fill(window.get_gc(), p, p + fieldSize, CL_Colorf::red);
p = CL_Pointf(target.x * fieldSize.x, target.y * fieldSize.y);
CL_Draw::fill(window.get_gc(), p, p + fieldSize, CL_Colorf::green);
}
示例4: highlight
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();
}
示例5: begin
void ShaderImpl::begin(CL_GraphicContext &p_gc)
{
G_ASSERT(m_initialized);
G_ASSERT(!m_began);
// new texture
m_drawRect = m_parent->getDrawRect(m_boundRect);
m_texture = CL_Texture(p_gc, m_drawRect.get_width(), m_drawRect.get_height());
// attach frame buffer
m_frameBuffer.attach_color_buffer(0, m_texture);
p_gc.set_frame_buffer(m_frameBuffer);
// clear to transparent
p_gc.clear(CL_Colorf::transparent);
// set proper matrix
p_gc.push_modelview();
// get scaling in count
const CL_Mat4f &matrix = p_gc.get_modelview();
const float scaleX = matrix[0];
const float scaleY = matrix[5];
p_gc.mult_translate(-m_drawRect.left / scaleX, -m_drawRect.top / scaleY);
m_began = true;
}
示例6: impl
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));
}
示例7: set_geometry
void CL_GUIComponent_Impl::set_geometry(CL_Rect new_geometry, bool client_area)
{
if (parent == 0)
{
CL_GUITopLevelWindow *handle = gui_manager.lock()->get_toplevel_window(component);
gui_manager.lock()->window_manager.set_geometry(handle, new_geometry, client_area);
new_geometry = gui_manager.lock()->window_manager.get_geometry(handle, true);
}
// repaint parent at old geometry
if (component->get_parent_component())
component->get_parent_component()->request_repaint(geometry);
// Check for resize
if ((geometry.get_width() != new_geometry.get_width()) || (geometry.get_height() != new_geometry.get_height()) )
{
geometry = new_geometry;
geometry_updated();
}
else
{
geometry = new_geometry;
component->request_repaint();
}
}
示例8: impl
Viewport::Viewport(CL_Component* child, const CL_Rect& rect, CL_Component* parent)
: CL_Component(rect, parent),
impl(new ViewportImpl())
{
impl->child = child;
impl->gc_state.set_size(rect.get_width(), rect.get_height());
}
示例9: build
void Sandpit::build()
{
CL_Rect bounds = calculateCircleBounds();
setPosition(CL_Pointf(bounds.left, bounds.top));
const float MAX_WIDTH = 512;
const float MAX_HEIGHT = 512;
// prepare image data
const int width = bounds.get_width() + 1;
const int height = bounds.get_height() + 1;
assert(width <= MAX_WIDTH && width > 0);
assert(height <= MAX_HEIGHT && height > 0);
// prepare pixel data
m_pixelData = CL_SharedPtr<CL_PixelBuffer>(new CL_PixelBuffer(width, height, width * 4, CL_PixelFormat::rgba8888));
fillCircles(width, height, bounds);
// unset the texture to create is at the next draw
m_texture.disconnect();
m_built = true;
}
示例10: set_clip_children
void CL_GUIComponent::set_clip_children(bool clip, const CL_Rect &rect)
{
impl->clip_children = clip;
if (rect.get_width() == 0 || rect.get_height() == 0)
impl->clip_children_rect = get_size();
else
impl->clip_children_rect = rect;
}
示例11:
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;
}
示例12: on_get_preferred_size
void CL_InputBox_Silver::on_get_preferred_size(CL_Size &size)
{
border_size = 3;
// Override height for font-height
CL_Rect position = inputbox->get_position();
position.bottom = position.top + font->get_height() + border_size * 2;
size.width = position.get_width();
size.height = position.get_height();
}
示例13: scale
CL_Vec2f Firework::scale(const CL_Vec2f& v) const
{
CL_Vec2f scaled;
CL_Rect viewport = window.get_viewport();
scaled.x = v.x + viewport.get_width() / 2.0f;
scaled.y = viewport.get_height() - v.y;
return scaled;
}
示例14: end
void ShaderImpl::end(CL_GraphicContext &p_gc)
{
G_ASSERT(m_initialized);
G_ASSERT(m_began);
// detach frame buffer
p_gc.reset_frame_buffer();
m_frameBuffer.detach_color_buffer(0, m_texture);
// prepare shader
m_program.set_uniform1i("tex", 0);
m_program.set_uniform1i("textureWidth", m_drawRect.get_width());
m_program.set_uniform1i("textureHeight", m_drawRect.get_height());
m_parent->setUniforms(m_program);
// draw texture using shader
p_gc.set_modelview(CL_Mat4f::identity());
p_gc.mult_translate(m_drawRect.left, m_drawRect.top);
p_gc.mult_scale(m_drawRect.get_width(), m_drawRect.get_height());
p_gc.set_texture(0, m_texture);
p_gc.set_program_object(m_program);
p_gc.draw_primitives(cl_quads, 4, m_quad);
p_gc.reset_program_object();
p_gc.reset_texture(0);
#if defined(DRAW_WIREFRAME)
CL_Draw::line(p_gc, 0, 0, 1, 0, CL_Colorf::red);
CL_Draw::line(p_gc, 1, 0, 1, 1, CL_Colorf::red);
CL_Draw::line(p_gc, 1, 1, 0, 1, CL_Colorf::red);
CL_Draw::line(p_gc, 0, 1, 0, 0, CL_Colorf::red);
#endif // DRAW_WIREFRAME
// reset modelview matrix
p_gc.pop_modelview();
m_began = false;
}
示例15:
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)));
}