本文整理汇总了C++中DX函数的典型用法代码示例。如果您正苦于以下问题:C++ DX函数的具体用法?C++ DX怎么用?C++ DX使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePMLEFieldUtilEx
void updatePMLEFieldUtilEx(int xStart, int xEnd, int yStart, int yEnd, int zStart, int zEnd, int xBound, int yBound, int zBound, pmlConstStruct cx[], pmlConstStruct cy[], pmlConstStruct cz[], int n){
int i, j, k; // These are the indexes
int x,y,z;// There are indexes for the pmlConstStruct indexs
long p;
int m;
double dxStore;
double eps;
for (i=xStart;i<xEnd+1;i++){
x = abs(xBound - i)%PML_LAYERS;
for (j=yStart;j<yEnd+1;j++){
y = abs(yBound - j)%PML_LAYERS;
for (k=zStart;k<zEnd+1;k++){
z = abs(zBound - k)%PML_LAYERS;
p = PMLINDEX(i,j,k);
dxStore = DX(p);
m = MATERIALINDEX(i,j,k);
eps = EPSR(m)*EPSNOT;
DX(p) = cy[y].c1*DX(p) + cy[y].c2*(HZ(i,j,k) - HZ(i,j-1,k) - HY(i,j,k) + HY(i,j,k-1) - JSX(m));
EX(i,j,k) = cz[z].c3*EX(i,j,k) + cz[z].c4*(cx[x].c5*DX(p)-cx[x].c6*dxStore)/eps;
}}} // end for
}// end updatePMLEFieldUtilEx
示例2: drawHCentered
void LevelWinDialog::paintContent(QPainter &p)
{
GamePanel::paintContent(p);
p.setOpacity(1);
p.setFont(gameStock->Font40);
p.setPen(QPen(QColor(0x030055)));
drawHCentered(p, 50, tr("Level %1 completed!").arg(level));
p.setFont(gameStock->Font20);
const int y30 = DY(40);
const int x1 = DX(300), x2 = DX(380), x3 = DX(600);
const int y1 = DY(250), y2 = DY(350);
p.drawPixmap(x1,y1, gameStock->Clock);
p.drawText(x3,y1+y30, QString("%1:%2").arg(time/60, 2, 10, QChar('0')).arg(time%60, 2, 10, QChar('0')));
p.drawPixmap(x1,y2, gameStock->Score);
p.drawText(x3,y2+y30, QString::number(score));
p.setPen(QPen(Qt::black));
p.drawText(x2,y1+y30, tr("Time left:"));
p.drawText(x2,y2+y30, tr("Score:"));
}
示例3: add_button
button *
add_button(Rectangle r, char *name, char *default_label, Pixel color,
void *param) {
button *b = (button *)malloc(sizeof(button));
utf8 *label[bstates];
assert(b); // allocating button memory
b->type = Button;
b->r = r;
b->name = name;
b->state = default_button_state;
b->next = 0;
b->param = param;
b->category = default_category;
last_button = b;
if ( !(ptinrect(r.min, screen_rect) &&
r.max.x <= screen_rect.max.x &&
r.max.y <= screen_rect.max.y)) {
fprintf(stderr, "*** button %s is off screen, ignored: %d,%d - %d,%d\n",
name, r.min.x, r.min.y, r.max.x, r.max.y);
return 0;
}
/* lookup configuration file alternates for our default label names. */
label[Off] = lookup(name, ".off", default_label);
label[On] = lookup(name, ".on", default_label);
label[Unavailable] = lookup(name, ".unavail", default_label);
fprintf(stderr, "0 ");
make_PixMap(&b->pm[Off], (Rectangle){{0,0},{DX(r),DY(r)}}, color);
fprintf(stderr, "1 ");
make_PixMap(&b->pm[On], (Rectangle){{0,0},{DX(r),DY(r)}}, color);
fprintf(stderr, "1 ");
make_PixMap(&b->pm[Unavailable],(Rectangle){{0,0},{DX(r),DY(r)}}, dim_color(color));
fprintf(stderr, "2\n");
b_fill_rect(b->pm[Off], inset(b->pm[Off].r, BUTTON_RIM), dim_color(color));
b_fill_rect(b->pm[On], inset(b->pm[On].r, BUTTON_RIM), Black);
string_on_pixmap(&(b->pm[Off]), label[Off], White, 1, 1);
string_on_pixmap(&(b->pm[On]), label[On], White, 1, 1);
string_on_pixmap(&(b->pm[Unavailable]), label[Unavailable], dim_color(White), 1, 1);
/* Add button to the end of the linked list */
fprintf(stderr, "2 ");
if (buttons == 0)
buttons = b;
else {
button *bp = buttons;
while (bp->next)
bp = bp->next;
bp->next = b;
}
return b;
}
示例4: main
int
main(int ac, char *av[])
{
struct cfg_s c;
struct timeval end;
double ll;
int i;
char msg[40];
uint64_t cyc;
struct sched_param schedparam;
schedparam.sched_priority = 11;
if (sched_setscheduler(0, SCHED_FIFO, &schedparam) == 0)
printf("Set process to real-time priority %i\n", 11);
else printf("Couldn't invoke real time scheduling priority %i"
" (access denied?)\n", 11);
bzero(&c, sizeof(c));
c.ac = ac;
c.av = av;
init(&c);
gettimeofday(&c.time, NULL);
cyc = mainloop(&c);
gettimeofday(&end, NULL);
end.tv_sec -= c.time.tv_sec;
end.tv_usec -= c.time.tv_usec;
if (end.tv_usec < 0) {
end.tv_usec += 1000000;
end.tv_sec--;
}
c.time = end;
ll = end.tv_sec*1000000 + end.tv_usec;
ll *= 1000; /* convert to nanoseconds */
ll /= c._enqueue;
sprintf(msg, "1::%d", c.flows);
D("%-8s n %d %d time %d.%06d %8.3f qlen %d %d flows %s drops %d",
c.name, c._enqueue, c.loops,
(int)c.time.tv_sec, (int)c.time.tv_usec, ll,
c.th_min, c.th_max,
c.fs_config ? c.fs_config : msg, c.drop);
D("---Accurate Timing Information---");
D("Time for Cycle:\n\t Originally:%8.3f ns\n\tWith gticks:%8.3f ns\n",
ll, (double) cyc2ns(cyc) / c._enqueue);
D("Summary time:\n\t Originally: %d.%06d s\n\tWith gticks: %8.6f s\n",
(int)c.time.tv_sec, (int)c.time.tv_usec,
(double) cyc2ns(cyc)/1000000000.0);
dump(&c);
DX(1, "done ac %d av %p", ac, av);
for (i=0; i < ac; i++)
DX(1, "arg %d %s", i, av[i]);
return 0;
}
示例5: request_move_right
static void request_move_right(void) {
if (y < NAMES_PER_COL(page) - 1 && PXY2N(page,0,y+1) < rl.cur_entries &&
(x == NAMES_PER_LINE(page) - 1 || PXY2N(page,x+1,y) > rl.cur_entries -1) ) {
request_move_to_sol();
request_move_down();
}
else if (y == NAMES_PER_COL(page) - 1 && x == NAMES_PER_LINE(page) - 1 && PXY2N(page+1,0,0) < rl.cur_entries) {
normalize(PXY2N(page+1,0,0));
}
else if (PXY2N(page,x,y) + DX(page) < rl.cur_entries ) {
normalize(PXY2N(page,x,y) + DX(page));
}
}
示例6: createStaticPopup
void IScene::addTime(int timeAdd)
{
time += timeAdd;
createStaticPopup(QRect(DX(975), DY(75), DX(100), DY(30)),
QString("+%1").arg(timeAdd),
Qt::AlignLeft | Qt::AlignTop,
gameStock->Font20,
Qt::yellow,
1,
0, 20,
0, -1
);
}
示例7: dump_assertion_type_value
static void
dump_assertion_type_value (gulong type)
{
switch (type) {
#define DX(x) case x: g_printerr ("%s", #x); break;
DX(CKT_X_DISTRUSTED_CERTIFICATE);
DX(CKT_X_PINNED_CERTIFICATE);
DX(CKT_X_ANCHORED_CERTIFICATE);
#undef DX
default:
g_printerr ("%u", (unsigned int)type);
break;
}
}
示例8: DY
void Scene::drawTextHint(QPainter& painter) {
painter.setOpacity(1);
painter.setPen(QPen(Qt::white));
painter.setFont(gameStock->font12);
QString hintText = "Hint";
painter.drawText(0, DY(690), DX(860), DY(30), Qt::AlignRight, hintText);
}
示例9: freeDOS
void freeDOS (short sel)
{
AX(regs) = 0x0101; // DPMI free DOS memory
DX(regs) = sel;
int386( DPMI_INT, ®s, ®s);
}
示例10: segread
void far *allocDOS (unsigned nbytes, short *pseg, short *psel)
{
unsigned npara = (nbytes + 15) / 16;
void far *pprot;
pprot = NULL;
*pseg = 0; // assume will fail
*psel = 0;
// DPMI call 100h allocates DOS memory
segread (&sregs);
AX (regs) = 0x0100; // DPMI: Allocate DOS Memory
BX (regs) = npara; // number of paragraphs to alloc
int386( DPMI_INT, ®s, ®s);
if (regs.w.cflag == 0)
{
*pseg = AX (regs); // the real-mode segment
*psel = DX (regs); // equivalent protected-mode selector
// pprot is the protected mode address of the same allocated block.
// The Rational extender maps the 1 MB physical DOS memory into
// the bottom of our virtual address space.
pprot = (void far *) ((unsigned)*pseg << 4);
}
return pprot;
}
示例11: show_hist
void
show_hist(void) {
int i, y;
int font_height = FONTHEIGHT(text_font);
Point p = (Point){hist_r.min.x, hist_r.max.y};
struct button_info *bi = 0;
clear_to_background(hist_r);
for (i=0; i<nhist; i++) {
button *bp = history[i];
bi = (struct button_info *)bp->param;
p.y -= 2;
p.y -= DY(bi->name.r);
write_pixmap(p, bi->name.r, bi->name);
}
#ifdef explain
clear_to_background(explain_r);
if (nhist) {
if (DX(bi->description.r))
write_pixmap(explain_r.min, bi->description.r, bi->description);
else
write_pixmap(explain_r.min, bi->name.r, bi->name);
}
#endif
}
示例12: DX
// update value in dialog
void DTransformPosition::SetValue(const char *value)
{
CDataExchange DX(this,FALSE);
m_value = value;
DDX_Text(&DX, IDC_VALUE, m_value);
}
示例13: length
template<> Vec<3,Float> VecBase<Vec<3,Float>>::normalize(option<Real&> len) const
{
if (len)
{
Real l = length();
if (l > RealT::zeroTol)
{
len = l;
return *this / l;
}
len = 0;
return VecS().fromZero();
}
VecS ret;
D3DXVec3Normalize(DX(ret), DX(*this));
return ret;
};
示例14: request_move_left
static void request_move_left(void) {
if ( x == 0 && y + page > 0 ) {
request_move_up();
request_move_to_eol();
}
else {
normalize(PXY2N(page,x,y) - DX(page));
}
}
示例15: right
/*
* Return a button's rectangle the same size and shape as the given rectangle,
* just to the right of it.
*/
Rectangle
right(Rectangle br) {
Rectangle r;
r.min.x = br.max.x + button_sep;
r.max.x = r.min.x + DX(br);
r.max.y = br.max.y;
r.min.y = br.min.y;
return r;
}