本文整理汇总了C++中draw_text函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_text函数的具体用法?C++ draw_text怎么用?C++ draw_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: display_video_text
void RecordMonitorGUI::
display_video_text(int x, int y, const char *text, int font,
int bg_color, int color, int alpha, double secs, double scale)
{
lock_window("RecordMonitorGUI::display_text");
set_font(font);
int ch = get_text_height(font);
int h = get_text_height(font,text) + ch/2;
int w = get_text_width(font, text) + ch;
BC_Pixmap pixmap(this, w, h);
set_opaque();
set_color(bg_color);
draw_box(0, 0, w, h, &pixmap);
set_color(color);
draw_text(ch/2, ch, text, strlen(text), &pixmap);
BC_Bitmap bitmap(this, w, h, BC_RGB888, 0);
VFrame in(&bitmap, w, h, BC_RGB888, -1);
Drawable drawable = pixmap.get_pixmap();
bitmap.read_drawable(drawable, 0, 0, &in);
unlock_window();
record->display_vframe(&in, x, y, alpha, secs, scale);
}
示例2: FT_Get_Char_Index
void FontRenderer::print(const wchar_t* _str, euint32 _num_chars, vptr _target, euint32 _x, euint32 _y, euint32 _w)
{
FT_GlyphSlot slot = m_ft_face->glyph;
FT_UInt glyph_index;
FT_UInt error;
euint32 n;
m_char_ptr = 0;
for ( n = 0; n < _num_chars; n++ )
{
glyph_index = FT_Get_Char_Index( m_ft_face, _str[n] );
error = FT_Load_Glyph( m_ft_face, glyph_index, FT_LOAD_DEFAULT );
if ( error )
{
continue;
}
/// 加粗函数 FT_Outline_Embolden( &m_ft_face->glyph->outline, 100 );
error = FT_Render_Glyph( m_ft_face->glyph, FT_RENDER_MODE_NORMAL );
if ( error )
{
continue;
}
draw_text( &slot->bitmap, _target, _x, _y, _w);
if (0xff00 & _str[n])
{
m_char_ptr += m_pixel_size;
}
else
{
m_char_ptr += m_pixel_size/2;
}
}
}
示例3: change_text
//change the text appearing in the header
void change_text(int j, color_t c)
{
//clear text
fill_rect(61, 41, 518, 18, colors[5]);
//if color is black, make it white
if(c == colors[5])
c = getColor(31, 63, 31);
//draw new text
switch(j)
{
case 0:
draw_text(64, 44, "It'sa meeee!", c);
break;
case 1:
draw_text(64, 44, "Princess in another castle.", c);
break;
case 2:
draw_text(64, 44, "Stomp more goombas.", c);
break;
case 3:
draw_text(64, 44, "Where's Luigi?", c);
break;
case 4:
draw_text(64, 44, "I sure wish I had a gokart.", c);
break;
case 5:
draw_text(64, 44, "It's dangerous to go alone.", c);
break;
case 6:
draw_text(64, 44, "Bowser is a jerk.", c);
break;
case 7:
draw_text(64, 44, "Have I ever done any actual plumbing?", c);
break;
}
}
示例4: xmlGetProp
void
on_Suspend_clicked (GtkButton *button,
gpointer user_data)
{
char *cmd, buf[3], *name;
int i, size;
name = xmlGetProp(table[cur_pid].page.curr, "name");
size = strlen(exec_path) + strlen(" -n ") + sizeof(cur_pid) + strlen(buf) + strlen(" ")
+ strlen(name) + strlen(" suspend ") + 1;
cmd = (char *) malloc (size);
strcpy (cmd, exec_path);
strcat (cmd, " -n ");
sprintf(buf, "%d", cur_pid);
strcat (cmd, buf);
strcat (cmd, " ");
strcat (cmd, name);
strcat (cmd, " suspend ");
runPeos(cmd);
free(cmd);
cmd = NULL;
freeAll_extra();
draw_tree (cur_pid);
for ( i = 0; i < counting_action; i++) {
if (strcmp (xmlGetProp (linklist[cur_pid][i].cur, "state"), "SUSPEND") == 0) {
table[cur_pid].page.curr = linklist[cur_pid][i].cur;
if((GTK_IS_WIDGET (table[cur_pid].page.tree1) &&
GTK_IS_TREE (GTK_TREE (table[cur_pid].page.tree1))))
gtk_tree_select_child ( GTK_TREE (table[cur_pid].page.tree1), linklist[cur_pid][i].item);
break;
}
}
draw_text (table[cur_pid].page.curr);
check_state();
}
示例5: D3DCOLOR_XRGB
void d3d_control::render_frame(void)
{
// clear the window to a deep blue
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
//change wireframe mode
if( fillmode_changed ){
if( !is_solid ){
d3ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID);
}
else{
d3ddev->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME);
}
is_solid = !is_solid;
fillmode_changed=false;
}
d3ddev->BeginScene(); // begins the 3D scene
// select which vertex format we are using
d3ddev->SetFVF(CUSTOMFVF);
//set transform
view_transform();
projection_transform();
// set the world transform
D3DXMATRIX matLocal;
D3DXMatrixIdentity(&matLocal);
draw_axis( matLocal );
draw_text();
rs.draw();
d3ddev->EndScene(); // ends the 3D scene
d3ddev->Present(NULL, NULL, NULL, NULL); // displays the created frame on the screen
}
示例6: glPushMatrix
void WormHoleRadioDevice::visualize() {
#ifdef WANT_GLUT
if (parent->is_show_backoff) {
glPushMatrix();
container->text_scale(); // prepare to draw text
char buf[20];
palette->use_color(RadioSim::RADIO_BACKOFF);
sprintf(buf, "N/A");
draw_text(1, 1, buf);
glPopMatrix();
}
if(parent->is_show_connectivity) { // draw network connections
// setup line properties
bool local_sharp=(parent->connect_display_mode==1 &&
container->is_selected);
if(parent->connect_display_mode==2 || local_sharp) {
palette->use_color(RadioSim::NET_CONNECTION_SHARP);
glLineWidth(1);
} else {
palette->use_color(RadioSim::NET_CONNECTION_FUZZY);
glLineWidth(4);
}
// do the actual draw
glBegin(GL_LINES);
const flo *me = container->body->position();
for(typeof(nbrs.begin()) it = nbrs.begin(); it != nbrs.end(); it++) {
if((local_sharp || (*it)->container->uid > container->uid)) {
const flo *them = (*it)->container->body->position();
glVertex3f(0,0,0);
glVertex3f(them[0]-me[0], them[1]-me[1], them[2]-me[2]);
}
}
glEnd();
glLineWidth(1);
}
#endif // WANT_GLUT
}
示例7: draw_text
void map_parcels_overlay::draw_cell(render_target* pCanvas, int iCanvasX,
int iCanvasY, const level_map* pMap, int iNodeX,
int iNodeY)
{
const map_tile *pNode = pMap->get_tile(iNodeX, iNodeY);
if(!pNode)
return;
if(font)
draw_text(pCanvas, iCanvasX, iCanvasY, std::to_string((int)pNode->iParcelId));
if(sprites)
{
uint16_t iParcel = pNode->iParcelId;
#define DIR(dx, dy, sprite) \
pNode = pMap->get_tile(iNodeX + dx, iNodeY + dy); \
if(!pNode || pNode->iParcelId != iParcel) \
sprites->draw_sprite(pCanvas, sprite, iCanvasX, iCanvasY, 0)
DIR( 0, -1, 18);
DIR( 1, 0, 19);
DIR( 0, 1, 20);
DIR(-1, 0, 21);
#undef DIR
}
}
示例8: palette_draw_const
static void palette_draw_const(void)
{
int n;
draw_text("Predefined Palettes", 57, 25, 0, 2);
for (n = 0; n < 7; n++) {
draw_box(2, 13 + (5 * n), 8, 17 + (5 * n), BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(9, 13 + (5 * n), 19, 17 + (5 * n), BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(29, 13 + (5 * n), 35, 17 + (5 * n), BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(36, 13 + (5 * n), 46, 17 + (5 * n), BOX_THICK | BOX_INNER | BOX_INSET);
draw_fill_chars(3, 14 + (5 * n), 7, 16 + (5 * n), n);
draw_fill_chars(30, 14 + (5 * n), 34, 16 + (5 * n), n + 7);
}
draw_box(56, 13, 62, 17, BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(63, 13, 73, 17, BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(56, 18, 62, 22, BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(63, 18, 73, 22, BOX_THICK | BOX_INNER | BOX_INSET);
draw_box(55, 26, 77, 47, BOX_THICK | BOX_INNER | BOX_INSET);
draw_fill_chars(57, 14, 61, 16, 14);
draw_fill_chars(57, 19, 61, 21, 15);
}
示例9: draw_refs
static bool
draw_refs(struct view *view, struct view_column *column, const struct ref *refs)
{
if (!column->opt.commit_title.refs || !refs)
return false;
for (; refs; refs = refs->next) {
const struct ref *ref = refs;
enum line_type type = get_line_type_from_ref(ref);
const struct ref_format *format = get_ref_format(opt_reference_format, ref);
if (!strcmp(format->start, "hide:") && !*format->end)
continue;
if (draw_formatted(view, type, "%s%s%s", format->start, ref->name, format->end))
return true;
if (draw_text(view, LINE_DEFAULT, " "))
return true;
}
return false;
}
示例10: draw_number
void draw_number(uint8_t x, uint8_t y, int32_t number, uint8_t length, uint8_t pad, uint8_t r, uint8_t g , uint8_t b)
{
char s[10];
sprintf(s, "%d", number);
int len = strlen(s);
if (length < len) {
int i;
for (i = 0; i < length; i++) {
draw_char(x, y, '*', r,g,b);
x+=6;
}
return;
}
int i;
for (i = 0; i < length - len; i++) {
draw_char(x, y, pad, r,g,b);
x+=6;
}
draw_text(x, y, (char*)s, r,g,b);
}
示例11: perform_rendering
void perform_rendering(VertexSource& vs) {
pixfmt_type pixf(rbuf_window());
typedef agg::pixfmt_amask_adaptor<pixfmt_type, alpha_mask_type>
pixfmt_amask_type;
typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
pixfmt_amask_type pixfa(pixf, m_alpha_mask);
amask_ren_type rbase(pixfa);
agg::renderer_scanline_aa_solid<amask_ren_type> ren(rbase);
ren.color(agg::rgba(0.5, 0.0, 0, 0.5));
start_timer();
m_ras.reset();
m_ras.add_path(vs);
agg::render_scanlines(m_ras, m_sl, ren);
double t1 = elapsed_time();
char buf[100];
sprintf(buf, "Render with AlphaMask: %.3fms", t1);
draw_text(250, 5, buf);
}
示例12: Vector
void
Font::draw(Renderer *renderer, const std::string& text, const Vector& pos_,
FontAlignment alignment, DrawingEffect drawing_effect, Color color,
float alpha) const
{
float x = pos_.x;
float y = pos_.y;
std::string::size_type last = 0;
for(std::string::size_type i = 0;; ++i)
{
if (text[i] == '\n' || i == text.size())
{
std::string temp = text.substr(last, i - last);
// calculate X positions based on the alignment type
Vector pos = Vector(x, y);
if(alignment == ALIGN_CENTER)
pos.x -= get_text_width(temp) / 2;
else if(alignment == ALIGN_RIGHT)
pos.x -= get_text_width(temp);
// Cast font position to integer to get a clean drawing result and
// no blurring as we would get with subpixel positions
pos.x = static_cast<int>(pos.x);
draw_text(renderer, temp, pos, drawing_effect, color, alpha);
if (i == text.size())
break;
y += char_height + 2;
last = i + 1;
}
}
}
示例13: draw_osd
void draw_osd(SDL_Surface *surface)
{
char buffer[1024];
snprintf(buffer, sizeof buffer,
"[a] - wave animation: %s\n" //toggle wave animation
"[f] - shading: %s\n" //smooth/flat
"[g] - model: %s\n" //torus, wave
"[H/h] - shininess: %d\n" //increase/decrease
"[l] - lighting: %s\n" //toggle
"[m] - specular mode: %s\n" //Blinn-Phong or Phong
"[n] - normals: %s\n" //enabled/disabled
"[o] - OSD option: %s\n" //cycle through
"[p] - per pixel lighting: %s\n" //per vertex/per pixel
"[s] - shaders: %s\n"
"[T/t] - tessellation: %d\n" //increase/decrease
"[v] - local viewer: %s\n"
"[w] - wireframe: %s\n" //enabled/disabled
"[k] - light type: %s\n", //directional/point
renderstate.animate ? "enabled" : "disabled", // shaders, // wave animation
renderstate.shading ? "Smooth" : "Flat", // shading
object_names[renderstate.object], // model
(int) material_shininess, // shininess
renderstate.lighting ? "enabled" : "disabled",
renderstate.specularMode ? "Phong" : "Blinn-Phong",
"todo", // normals
"enabled", // OSD option
renderstate.perPixel ? "enabled" : "disabled", // lighting mode
/* shaders */
renderstate.shaders ? "enabled" : "disabled", // shaders
tessellation,
renderstate.lightModel ? "enabled" : "disabled", // local viewer
/* wireframe */
renderstate.wireframe ? "enabled" : "disabled",
renderstate.lightType ? "directional" : "point"); // lighting mode
draw_text(surface, buffer, 0, 30);
}
示例14: replayview_draw_stagemenu
static void replayview_draw_stagemenu(MenuData *m) {
float alpha = 1 - m->fade;
int i;
float height = (1+m->ecount) * 20;
float width = 100;
glPushMatrix();
glTranslatef(SCREEN_W*0.5, SCREEN_H*0.5, 0);
glScalef(width, height, 1);
glColor4f(0.1, 0.1, 0.1, 0.7 * alpha);
draw_quad();
glPopMatrix();
glPushMatrix();
glTranslatef(SCREEN_W*0.5, (SCREEN_H-(m->ecount-1)*20)*0.5, 0);
for(i = 0; i < m->ecount; ++i) {
MenuEntry *e = &(m->entries[i]);
float a = e->drawdata += 0.2 * ((i == m->cursor) - e->drawdata);
if(e->action == NULL)
glColor4f(0.5, 0.5, 0.5, 0.5 * alpha);
else {
float ia = 1-a;
glColor4f(0.9 + ia * 0.1, 0.6 + ia * 0.4, 0.2 + ia * 0.8, (0.7 + 0.3 * a) * alpha);
}
if(i == m->cursor)
pickedstage = i;
draw_text(AL_Center, 0, 20*i, e->name, _fonts.standard);
}
glPopMatrix();
}
示例15: backlight_main
void backlight_main()
{
InputEvent ev;
counter3_overflow_hook = when_counter3_overflows;
draw_text( FONT_WIDTH*(50-20)/2, FONT_HEIGHT*(17-1)/2, WHITE, 1, "Backlight-experiment");
value = 0;
target_value = 100;
while ( value != target_value)
{
__WFE(); // Go to low-power mode until counter3 overflows
__Set( BEEP_VOLUME, value);
}
target_value = 0;
while ( value != target_value)
{
__WFE();
__Set( BEEP_VOLUME, value);
}
while( should_run)
{
check_event( &ev);
if ( BUTTON4 == ev.input)
should_run = false;
while ( value != target_value)
{
__WFE();
__Set( BACKLIGHT, value);
}
target_value = (100 == value) ? 0 : 100;
}
}