本文整理汇总了C++中draw_text函数的典型用法代码示例。如果您正苦于以下问题:C++ draw_text函数的具体用法?C++ draw_text怎么用?C++ draw_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了draw_text函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:TravisKraatz,项目名称:cinelerra,代码行数:22,代码来源:recordmonitor.C
示例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;
}
}
}
开发者ID:rodrigobmg,项目名称:v-engine,代码行数:39,代码来源:font_renderer.cpp
示例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;
}
}
开发者ID:mjb236,项目名称:Programming_Work,代码行数:37,代码来源:driver.c
示例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();
}
开发者ID:jimiszm,项目名称:peos,代码行数:38,代码来源:callbacks.c
示例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
}
开发者ID:windkey,项目名称:KATAMARI,代码行数:38,代码来源:d3d_control.cpp
示例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
}
开发者ID:chazmatazz,项目名称:proto-mirror,代码行数:38,代码来源:wormhole-radio.cpp
示例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
}
}
开发者ID:Alberth289346,项目名称:CorsixTH,代码行数:23,代码来源:th_map_overlays.cpp
示例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);
}
开发者ID:CharlesLio,项目名称:schismtracker,代码行数:23,代码来源:page_palette.c
示例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;
}
开发者ID:FAKERINHEART,项目名称:tig,代码行数:23,代码来源:draw.c
示例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);
}
开发者ID:sebseb7,项目名称:oled,代码行数:23,代码来源:text.c
示例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);
}
开发者ID:UIKit0,项目名称:agg,代码行数:23,代码来源:alpha_mask3.cpp
示例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;
}
}
}
开发者ID:AndroidAppList,项目名称:Android-Supertux,代码行数:37,代码来源:font.cpp
示例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);
}
开发者ID:rhys-vdw,项目名称:rtr-ass2,代码行数:36,代码来源:ass2-base.c
示例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();
}
开发者ID:miton,项目名称:taisei,代码行数:36,代码来源:replayview.c
示例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;
}
}
开发者ID:neilstockbridge,项目名称:dsoquad-demo,代码行数:36,代码来源:backlight.c
示例16: main
int main(int argc, char **argv)
{
cairo_t *cr;
char *filename;
cairo_status_t status;
cairo_surface_t *surface;
if (argc != 2)
{
g_printerr("Usage: cairosimple OUTPUT_FILENAME\n");
return 1;
}
filename = argv[1];
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
2 * RADIUS, 2 * RADIUS);
cr = cairo_create(surface);
cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
cairo_paint(cr);
draw_text(cr);
cairo_destroy(cr);
status = cairo_surface_write_to_png(surface, filename);
cairo_surface_destroy(surface);
if (status != CAIRO_STATUS_SUCCESS)
{
g_printerr("Could not save png to '%s'\n", filename);
return 1;
}
return 0;
}
开发者ID:mtola,项目名称:Visual-Studio-gtkmm,代码行数:36,代码来源:cairo-pango.c
示例17: switch
void Display::update_gps()
{
switch (AP_Notify::flags.gps_status) {
case AP_GPS::NO_GPS:
draw_text(COLUMN(0), ROW(3), "GPS: no GPS");
break;
case AP_GPS::NO_FIX:
draw_text(COLUMN(0), ROW(3), "GPS: no fix");
break;
case AP_GPS::GPS_OK_FIX_2D:
draw_text(COLUMN(0), ROW(3), "GPS: 2D ");
break;
case AP_GPS::GPS_OK_FIX_3D:
draw_text(COLUMN(0), ROW(3), "GPS: 3D ");
break;
case AP_GPS::GPS_OK_FIX_3D_DGPS:
draw_text(COLUMN(0), ROW(3), "GPS: DGPS ");
break;
case AP_GPS::GPS_OK_FIX_3D_RTK:
draw_text(COLUMN(0), ROW(3), "GPS: RTK ");
break;
}
}
开发者ID:ArmaJo,项目名称:ardupilot,代码行数:23,代码来源:Display.cpp
示例18: main
//.........这里部分代码省略.........
do_background = 0;
} else
do_background = 0;
set_color(opt.fgcolor->answer);
orig_x = orig_y = 0;
if (opt.at->answer) {
if (get_coordinates(&x, &y, &east, &north,
win, opt.at->answers,
flag.p->answer, flag.g->answer))
G_fatal_error(_("Invalid coordinates"));
orig_x = x;
orig_y = y;
}
else {
x = win.l + (size * linespacing + 0.5) - size; /* d.text: +5 */
y = win.t + line * (size * linespacing + 0.5);
}
prev_x = x;
prev_y = y;
D_text_size(size, size);
D_text_rotation(rotation * 180.0 / M_PI);
if (text) {
double x2, y2;
x2 = x;
y2 = y;
if (text[0])
draw_text(text, &x2, &y2, size, align, rotation, bold, do_background, fg_color, bg_color);
/* reset */
D_text_size(5, 5);
D_text_rotation(0.0);
D_save_command(G_recreate_command());
D_close_driver();
exit(EXIT_SUCCESS);
}
if (!opt.input->answer || strcmp(opt.input->answer, "-") == 0)
cmd_fp = stdin;
else {
cmd_fp = fopen(opt.input->answer, "r");
if (!cmd_fp)
G_fatal_error(_("Unable to open input file <%s>"), opt.input->answer);
}
if (isatty(fileno(cmd_fp)))
fprintf(stderr,
_("\nPlease enter text instructions. Enter EOF (ctrl-d) on last line to quit\n"));
set_x = set_y = set_l = 0;
first_text = 1;
linefeed = 1;
/* do the plotting */
while (fgets(buf, sizeof(buf), cmd_fp)) {
int buf_len;
char *buf_ptr, *ptr;
buf_len = strlen(buf) - 1;
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:67,代码来源:main.c
示例19: main
//.........这里部分代码省略.........
if (filter.filter_name == disparity_filter_name)
{
revert_disparity = true;
}
}
}
if (revert_disparity)
{
filtered = disparity_to_depth.process(filtered);
}
// Push filtered & original data to their respective queues
// Note, pushing to two different queues might cause the application to display
// original and filtered pointclouds from different depth frames
// To make sure they are synchronized you need to push them together or add some
// synchronization mechanisms
filtered_data.enqueue(filtered);
original_data.enqueue(depth_frame);
}
});
// Declare objects that will hold the calculated pointclouds and colored frames
// We save the last set of data to minimize flickering of the view
rs2::frame colored_depth;
rs2::frame colored_filtered;
rs2::points original_points;
rs2::points filtered_points;
// Save the time of last frame's arrival
auto last_time = std::chrono::high_resolution_clock::now();
// Maximum angle for the rotation of the pointcloud
const double max_angle = 15.0;
// We'll use rotation_velocity to rotate the pointcloud for a better view of the filters effects
float rotation_velocity = 0.3f;
while (app)
{
float w = static_cast<float>(app.width());
float h = static_cast<float>(app.height());
// Render the GUI
render_ui(w, h, filters);
// Try to get new data from the queues and update the view with new texture
update_data(original_data, colored_depth, original_points, original_pc, original_view_orientation, color_map);
update_data(filtered_data, colored_filtered, filtered_points, filtered_pc, filtered_view_orientation, color_map);
draw_text(10, 50, "Original");
draw_text(static_cast<int>(w / 2), 50, "Filtered");
// Draw the pointclouds of the original and the filtered frames (if the are available already)
if (colored_depth && original_points)
{
glViewport(0, h / 2, w / 2, h / 2);
draw_pointcloud(w / 2, h / 2, original_view_orientation, original_points);
}
if (colored_filtered && filtered_points)
{
glViewport(w / 2, h / 2, w / 2, h / 2);
draw_pointcloud(w / 2, h / 2, filtered_view_orientation, filtered_points);
}
// Update time of current frame's arrival
auto curr = std::chrono::high_resolution_clock::now();
// Time interval which must pass between movement of the pointcloud
const std::chrono::milliseconds rotation_delta(40);
// In order to calibrate the velocity of the rotation to the actual displaying speed, rotate
// pointcloud only when enough time has passed between frames
if (curr - last_time > rotation_delta)
{
if (fabs(filtered_view_orientation.yaw) > max_angle)
{
rotation_velocity = -rotation_velocity;
}
original_view_orientation.yaw += rotation_velocity;
filtered_view_orientation.yaw += rotation_velocity;
last_time = curr;
}
}
// Signal the processing thread to stop, and join
// (Not the safest way to join a thread, please wrap your threads in some RAII manner)
stopped = true;
processing_thread.join();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
{
std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
开发者ID:Andy95800,项目名称:librealsense,代码行数:101,代码来源:rs-post-processing.cpp
示例20: draw_text
UINT32 scv_state::screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int x, y;
UINT8 fg = m_videoram[0x1403] >> 4;
UINT8 bg = m_videoram[0x1403] & 0x0f;
UINT8 gr_fg = m_videoram[0x1401] >> 4;
UINT8 gr_bg = m_videoram[0x1401] & 0x0f;
int clip_x = ( m_videoram[0x1402] & 0x0f ) * 2;
int clip_y = m_videoram[0x1402] >> 4;
/* Clear the screen */
bitmap.fill(gr_bg , cliprect);
/* Draw background */
for ( y = 0; y < 16; y++ )
{
int text_y = 0;
if ( y < clip_y )
{
text_y = ( m_videoram[0x1400] & 0x80 ) ? 0 : 1;
}
else
{
text_y = ( m_videoram[0x1400] & 0x80 ) ? 1 : 0;
}
for ( x = 0; x < 32; x++ )
{
int text_x = 0;
UINT8 d = m_videoram[ 0x1000 + y * 32 + x ];
if ( x < clip_x )
{
text_x = ( m_videoram[0x1400] & 0x40 ) ? 0 : 1;
}
else
{
text_x = ( m_videoram[0x1400] & 0x40 ) ? 1 : 0;
}
if ( text_x && text_y )
{
/* Text mode */
UINT8 *char_data = m_charrom->base() + ( d & 0x7f ) * 8;
draw_text( bitmap, x * 8, y * 16, char_data, fg, bg );
}
else
{
switch ( m_videoram[0x1400] & 0x03 )
{
case 0x01: /* Semi graphics mode */
draw_semi_graph( bitmap, x * 8 , y * 16 , d & 0x80, gr_fg );
draw_semi_graph( bitmap, x * 8 + 4, y * 16 , d & 0x40, gr_fg );
draw_semi_graph( bitmap, x * 8 , y * 16 + 4, d & 0x20, gr_fg );
draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 4, d & 0x10, gr_fg );
draw_semi_graph( bitmap, x * 8 , y * 16 + 8, d & 0x08, gr_fg );
draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 8, d & 0x04, gr_fg );
draw_semi_graph( bitmap, x * 8 , y * 16 + 12, d & 0x02, gr_fg );
draw_semi_graph( bitmap, x * 8 + 4, y * 16 + 12, d & 0x01, gr_fg );
break;
case 0x03: /* Block graphics mode */
draw_block_graph( bitmap, x * 8, y * 16 , d >> 4 );
draw_block_graph( bitmap, x * 8, y * 16 + 8, d & 0x0f );
break;
default: /* Otherwise draw nothing? */
break;
}
}
}
}
/* Draw sprites if enabled */
if ( m_videoram[0x1400] & 0x10 )
{
UINT8 screen_start_sprite_line = ( ( ( m_videoram[0x1400] & 0xf7 ) == 0x17 ) && ( ( m_videoram[0x1402] & 0xef ) == 0x4f ) ) ? 21 + 32 : 0 ;
int i;
for ( i = 0; i < 128; i++ )
{
UINT8 spr_y = m_videoram[ 0x1200 + i * 4 ] & 0xfe;
UINT8 y_32 = m_videoram[ 0x1200 + i * 4 ] & 0x01; /* Xx32 sprite */
UINT8 clip = m_videoram[ 0x1201 + i * 4 ] >> 4;
UINT8 col = m_videoram[ 0x1201 + i * 4 ] & 0x0f;
UINT8 spr_x = m_videoram[ 0x1202 + i * 4 ] & 0xfe;
UINT8 x_32 = m_videoram[ 0x1202 + i * 4 ] & 0x01; /* 32xX sprite */
UINT8 tile_idx = m_videoram[ 0x1203 + i * 4 ] & 0x7f;
UINT8 half = m_videoram[ 0x1203 + i * 4] & 0x80;
UINT8 left = 1;
UINT8 right = 1;
UINT8 top = 1;
UINT8 bottom = 1;
if ( !col )
{
continue;
}
//.........这里部分代码省略.........
开发者ID:Ilgrim,项目名称:MAMEHub,代码行数:101,代码来源:scv.c
注:本文中的draw_text函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论