本文整理汇总了C++中CL_Rect函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_Rect函数的具体用法?C++ CL_Rect怎么用?C++ CL_Rect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CL_Rect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_client_area
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));
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:7,代码来源:main_window.cpp
示例2: CL_Rect
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;
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:33,代码来源:listview_layout_icons.cpp
示例3: CL_Component
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));
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:30,代码来源:window.cpp
示例4: update_scrollbar
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));
}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:35,代码来源:treeview_silver.cpp
示例5: main
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();
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:34,代码来源:simpleed.cpp
示例6: CL_Size
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();
}
开发者ID:Flexlay,项目名称:flexlay,代码行数:25,代码来源:titlebar.cpp
示例7: CL_Rect
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));
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:9,代码来源:pixel_canvas.cpp
示例8: switch
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;
}
}
开发者ID:Karkus476,项目名称:flexlay,代码行数:56,代码来源:tilemap_paint_tool.cpp
示例9: CL_Rect
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;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:56,代码来源:clan_image_stretch.cpp
示例10: CL_Gradient
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);
}
开发者ID:riseven,项目名称:Laberinto,代码行数:10,代码来源:PlayNode.cpp
示例11: CL_Component
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);
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:11,代码来源:tile_editor.cpp
示例12: get_width
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);
}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:11,代码来源:display_window_opengl.cpp
示例13: filedialog
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();
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:59,代码来源:filedialog_generic.cpp
示例14: CL_Size
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)));
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:12,代码来源:window.cpp
示例15: CL_Rect
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);
}
}
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:52,代码来源:treeview_silver.cpp
示例16: Node
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);
}
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:50,代码来源:texture_group_impl.cpp
示例17: CL_Font_TextureGlyph
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;
}
}
开发者ID:animehunter,项目名称:clanlib-2.3,代码行数:35,代码来源:glyph_cache.cpp
示例18: if
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;
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:35,代码来源:gui.cpp
示例19: 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();
}
开发者ID:BackupTheBerlios,项目名称:flexlay-svn,代码行数:30,代码来源:window.cpp
示例20: int
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)));
}
}
开发者ID:BackupTheBerlios,项目名称:feuerkraft-svn,代码行数:27,代码来源:radar.cpp
注:本文中的CL_Rect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论