本文整理汇总了C++中change函数的典型用法代码示例。如果您正苦于以下问题:C++ change函数的具体用法?C++ change怎么用?C++ change使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了change函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(){
insert(5);
insert(7);
insert(3);
insert(8);
insert(12);
insert(14);
insert(118);
print_queue();
printf("\nextractMax:\n");
int max = extractMax();
printf("\nThe Max is %d.\n",max);
print_queue();
printf("\nincrease, index is [5] and value is [10]:\n");
increase(5,10);
print_queue();
printf("\nChange value, index is [5] and value is [10]:\n");
change(5,10);
print_queue();
return 0;
}
开发者ID:AdamYang121,项目名称:on-campus-study,代码行数:24,代码来源:priority_queue.c
示例2: main
main ()
{
long f1n1, f1n2, f2n1, f2n2; /* File 1, line number 1; etc. */
int result; /* Result of readline. */
for (;;)
{
result = readline (line, BUFSIZ, stdin);
f1n2 = f2n2 = UNUSED;
if
(sscanf (line, "%ld,%ldc%ld,%ld\n", &f1n1, &f1n2, &f2n1, &f2n2) == 4 ||
sscanf (line, "%ld,%ldc%ld\n", &f1n1, &f1n2, &f2n1) == 3 ||
sscanf (line, "%ldc%ld,%ld\n", &f1n1, &f2n1, &f2n2) == 3 ||
sscanf (line, "%ldc%ld\n", &f1n1, &f2n1) == 2)
change (f1n1, f1n2, f2n1, f2n2);
else if
(sscanf (line, "%ld,%ldd%ld\n", &f1n1, &f1n2, &f2n1) == 3 ||
sscanf (line, "%ldd%ld\n", &f1n1, &f2n1) == 2)
delete (f1n1, f1n2, f2n1);
else if
(sscanf (line, "%lda%ld,%ld\n", &f1n1, &f2n1, &f2n2) == 3 ||
sscanf (line, "%lda%ld\n", &f1n1, &f2n1) == 2)
append (f1n1, f2n1, f2n2);
else
{
/* The line wasn't the start of a diff. Copy it verbatim. */
fputs (line, stdout);
/* If it was a long line, copy the remainder. */
while (result == -1)
{
result = readline (line, BUFSIZ, stdin);
fputs (line, stdout);
}
}
}
}
开发者ID:embayer,项目名称:scripts,代码行数:36,代码来源:ediff.c
示例3: switch
void ImageViewer::wheelEvent(QWheelEvent *e)
{
if(noPicture() || !rect().contains(e->pos())) //cursor is not in widget
return;
qreal scale_old = scale;
switch(e->modifiers()){
case Qt::ShiftModifier:
zoomIn(e->delta() / qreal(2400)); //e->delta() is +120 or -120
break;
case Qt::ControlModifier:
zoomIn(e->delta() / qreal(600));
break;
default:
zoomIn(e->delta() / qreal(1200));
break;
}
QPointF distance(rect().center() - e->pos());
QPointF change(distance / scale_old * scale - distance);
shift += change; //to keep the cursor position, must after scale.
updateShift();
}
开发者ID:Answeror,项目名称:ezviewer,代码行数:24,代码来源:imageviewer.cpp
示例4: change
std::vector<sf::Vector2f> Polygon::GetPoints() const
{
//Used to find the change in x and y from original location to return the actual position of the points
sf::Vector2f change(GetPosition().x - m_originalCentroidPosition.x, GetPosition().y - m_originalCentroidPosition.y);
//Container vector for the points
std::vector<sf::Vector2f> result;
sf::Vector2f currPoint;
//Get number of points of the polygon
unsigned int numberOfPoints = m_shape.getPointCount();
//Add each point to the container vector
for (unsigned int i = 0; i < numberOfPoints; ++i)
{
currPoint = m_shape.getPoint(i);
currPoint.x += change.x;
currPoint.y += change.y;
result.push_back(currPoint);
}
return result;
}
开发者ID:inzombiak,项目名称:SATTest,代码行数:24,代码来源:Polygon.cpp
示例5: change
void change(bool mod)
{
change(mod, true);
}
开发者ID:wooky,项目名称:EVA2,代码行数:4,代码来源:application.cpp
示例6: nslcd_usermod
//.........这里部分代码省略.........
default: /* other parameters are silently ignored */ break;
}
}
/* log call */
log_setrequest("usermod=\"%s\"", username);
log_log(LOG_DEBUG, "nslcd_usermod(\"%s\",%s,\"%s\")",
username, asroot ? "asroot" : "asuser", *password ? "***" : "");
if (fullname != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(fullname=\"%s\")", fullname);
if (roomnumber != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(roomnumber=\"%s\")", roomnumber);
if (workphone != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(workphone=\"%s\")", workphone);
if (homephone != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(homephone=\"%s\")", homephone);
if (other != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(other=\"%s\")", other);
if (homedir != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(homedir=\"%s\")", homedir);
if (shell != NULL)
log_log(LOG_DEBUG, "nslcd_usermod(shell=\"%s\")", shell);
/* write the response header */
WRITE_INT32(fp, NSLCD_VERSION);
WRITE_INT32(fp, NSLCD_ACTION_USERMOD);
/* validate request */
entry = validate_user(session, username, &rc);
if (entry == NULL)
{
/* for user not found we just say no result, otherwise break the protocol */
if (rc == LDAP_NO_SUCH_OBJECT)
{
WRITE_INT32(fp, NSLCD_RESULT_END);
}
return -1;
}
/* check if it is a modification as root */
isroot = (calleruid == 0) && asroot;
if (asroot)
{
if (nslcd_cfg->rootpwmoddn == NULL)
{
log_log(LOG_NOTICE, "rootpwmoddn not configured");
/* we break the protocol */
return -1;
}
binddn = nslcd_cfg->rootpwmoddn;
/* check if rootpwmodpw should be used */
if ((*password == '\0') && isroot && (nslcd_cfg->rootpwmodpw != NULL))
{
if (strlen(nslcd_cfg->rootpwmodpw) >= sizeof(password))
{
log_log(LOG_ERR, "nslcd_pam_pwmod(): rootpwmodpw will not fit in password");
return -1;
}
strcpy(password, nslcd_cfg->rootpwmodpw);
}
}
else
binddn = myldap_get_dn(entry);
WRITE_INT32(fp, NSLCD_RESULT_BEGIN);
/* home directory change requires either root or valid directory */
if ((homedir != NULL) && (!isroot) && !is_valid_homedir(homedir))
{
log_log(LOG_NOTICE, "invalid directory: %s", homedir);
WRITE_INT32(fp, NSLCD_USERMOD_HOMEDIR);
WRITE_STRING(fp, "invalid directory");
homedir = NULL;
}
/* shell change requires either root or a valid shell */
if ((shell != NULL) && (!isroot) && !is_valid_shell(shell))
{
log_log(LOG_NOTICE, "invalid shell: %s", shell);
WRITE_INT32(fp, NSLCD_USERMOD_SHELL);
WRITE_STRING(fp, "invalid shell");
shell = NULL;
}
/* perform requested changes */
newsession = get_session(binddn, myldap_get_dn(entry), password, &rc);
if (newsession != NULL)
{
rc = change(newsession, myldap_get_dn(entry), homedir, shell);
myldap_session_close(newsession);
}
/* return response to caller */
if (rc != LDAP_SUCCESS)
{
log_log(LOG_WARNING, "%s: modification failed: %s",
myldap_get_dn(entry), ldap_err2string(rc));
mysnprintf(errmsg, sizeof(errmsg) - 1, "change failed: %s", ldap_err2string(rc));
WRITE_INT32(fp, NSLCD_USERMOD_RESULT);
WRITE_STRING(fp, errmsg);
WRITE_INT32(fp, NSLCD_USERMOD_END);
WRITE_INT32(fp, NSLCD_RESULT_END);
return 0;
}
log_log(LOG_NOTICE, "changed information for %s", myldap_get_dn(entry));
WRITE_INT32(fp, NSLCD_USERMOD_END);
WRITE_INT32(fp, NSLCD_RESULT_END);
return 0;
}
开发者ID:aweits,项目名称:nss-pam-ldapd,代码行数:101,代码来源:usermod.c
示例7: main
int main(int argc, char *argv[]){
char buffer[64];
char *c;
#if DEBUG
printf("[DEBUG MODE]\n");
printf("Compile: %s %s\n", __DATE__, __TIME__);
#endif
printf("Version: %d.%d.%d\n", VER_REL, VER_MAJOR, VER_MINOR);
printf("Database> ");
dbfile_t *mdb = open_dbfile(get_input(buffer, 32, TRUE));
commit_db(mdb);
for(;;){
printf("valca> ");
c = get_input(buffer, 64, TRUE);
if(!strcmp("quit", c)||!strcmp("exit", c)||!strcmp("\\q", c)){
break;
}
if(!strcmp("help", c)){
printf("COMMANDS:\n");
printf("COMMIT Commit file to disk\n");
printf("COUNT Show row count\n");
printf("TRUNCATE Delete all keys\n");
printf("UPDATE Update key value\n");
printf("INSERT Insert key\n");
printf("DELETE \\\n");
printf(" COLUMN Delete column\n");
printf(" ROW Delete row\n");
printf("ALTER \\\n");
printf(" NAME Change column name\n");
printf(" LEFT Shift column left\n");
printf(" RIGHT Shift column right\n");
printf("SELECT Select value from\n");
printf("ADD \\\n");
printf(" COLUMN Add column\n");
printf("SHOW \\\n");
printf(" COLUMNS Show all columns\n");
printf(" TREE Show storage tree\n");
printf(" STATUS Show database info\n");
printf(" TABLE Show dataset as table\n");
printf("FREE \\\n");
printf(" COLUMNS Columns freelist\n");
printf(" NODE Node freelist\n");
printf(" DATAFIELDS Payload freelist\n");
printf("EXIT Quit the shell\n");
}
if(!strcmp("commit", c)){
commit_db(mdb);
}
if(!strcmp("count", c)){
printf("Total rows: %d\n", mdb->k_cnt);
}
if(!strcmp("truncate", c)){
truncate_root(mdb);
}
if(!strcmp("update", c)){
char tmp[32];
printf(">psid: ");
c = get_input(tmp, 32, FALSE);
int key = atoi(tmp);
char tmpcolname[32];
printf(">column: ");
c = get_input(tmpcolname, 32, FALSE);
int idx = get_column_idx(mdb, tmpcolname);
printf(">value: ");
c = get_input(tmp, 32, FALSE);
change(mdb, key, (void*)tmp, idx);
}
if(!strcmp("insert", c)){
if(!mdb->c_cnt){
printf("Cannot insert without column\n");
}else{
char tmp[32];
printf(">psid[%d]: ", mdb->seq_cnt);
c = get_input(tmp, 32, FALSE);
int key;
if(!strlen(tmp)){
key = mdb->seq_cnt++;
}else{
key = atoi(tmp);
}
column_t col;
read_column(mdb, mdb->data.c_root, &col);
printf(">%s<%s(%d)>: ", col.name, get_datatype_name(col.d_type), col.maxsize);
c = get_input(tmp, 32, FALSE);
if(get_datatype(col.d_type).size == -1) tmp[col.maxsize] = '\0';
if(col.usign) printf("<> %d\n", atoi(tmp));
//if(atoi())
if(insert_key(mdb, key, (void*)tmp) == SUCCESS){
result_t rs = search_key(mdb, key);
if(rs.rstat == SUCCESS){
char tmp[32];
int i = 1;
while(col.c_next != EMPTY){
read_column(mdb, col.c_next, &col);
printf(">%s<%s(%d)>: ", col.name, get_datatype_name(col.d_type), col.maxsize);
c = get_input(tmp, 32, FALSE);
//.........这里部分代码省略.........
开发者ID:yorickdewid,项目名称:dbtree,代码行数:101,代码来源:main.c
示例8: alloc_empty_btree
//.........这里部分代码省略.........
struct sb *sb = rp->sb;
struct buffer_head *srcbuf, *dstbuf;
int err = 0;
srcbuf = vol_getblk(sb, src);
if (!srcbuf) {
err = -ENOMEM; /* FIXME: error code */
goto error;
}
dstbuf = vol_getblk(sb, dst);
if (!dstbuf) {
err = -ENOMEM; /* FIXME: error code */
goto error_put_srcbuf;
}
bnode_buffer_init(dstbuf);
bnode_split(bufdata(srcbuf), pos, bufdata(dstbuf));
mark_buffer_unify_non(srcbuf);
mark_buffer_unify_atomic(dstbuf);
blockput(dstbuf);
error_put_srcbuf:
blockput(srcbuf);
error:
return err;
}
/*
* Before this replay, replay should already dirty the buffer of bnodeblock.
* (e.g. by redirect)
*/
static int replay_bnode_change(struct sb *sb, block_t bnodeblock,
u64 val1, u64 val2,
void (*change)(struct bnode *, u64, u64))
{
if(DEBUG_MODE_K==1)
{
printf("\t\t\t\t%25s[K] %25s %4d #in\n",__FILE__,__func__,__LINE__);
}
struct buffer_head *bnodebuf;
bnodebuf = vol_getblk(sb, bnodeblock);
if (!bnodebuf)
return -ENOMEM; /* FIXME: error code */
struct bnode *bnode = bufdata(bnodebuf);
change(bnode, val1, val2);
mark_buffer_unify_non(bnodebuf);
blockput(bnodebuf);
return 0;
}
static void add_func(struct bnode *bnode, u64 child, u64 key)
{
if(DEBUG_MODE_K==1)
{
printf("\t\t\t\t%25s[K] %25s %4d #in\n",__FILE__,__func__,__LINE__);
}
struct index_entry *entry = bnode_lookup(bnode, key) + 1;
bnode_add_index(bnode, entry, child, key);
}
开发者ID:Dreamz2014,项目名称:tux3-fuse,代码行数:66,代码来源:btree.c
示例9: change
void GraphicsMan::updateScreen(Graphics::Surface *source) {
_vm->_system->copyRectToScreen((byte *)source->getBasePtr(0, 0), 640, 0, 80, 640, 320);
change();
}
开发者ID:havlenapetr,项目名称:Scummvm,代码行数:4,代码来源:graphics.cpp
示例10: main
int main(int argc, char* argv[])
{
int i, j, b;
if (argc < 2) {
help();
exit(EXIT_SUCCESS);
}
if (strcmp(argv[1], "generate") == 0) {
int disk, file, size;
if (argc != 6) {
/* LCOV_EXCL_START */
help();
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
seed = atoi(argv[2]);
disk = atoi(argv[3]);
file = atoi(argv[4]);
size = atoi(argv[5]);
for(i=0;i<disk;++i) {
for(j=0;j<file;++j) {
if (j == 0)
generate(i+1, size);
else if (j == 1)
generate(i+1, 0);
else
generate(i+1, rnd(size));
}
}
} else if (strcmp(argv[1], "damage") == 0 || strcmp(argv[1], "write") == 0) {
int fail, size;
int silent_error = strcmp(argv[1], "damage") == 0;
if (argc < 6) {
/* LCOV_EXCL_START */
help();
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
seed = atoi(argv[2]);
fail = atoi(argv[3]);
size = atoi(argv[4]);
b = 5;
/* sort the file names */
qsort(&argv[b], argc - b, sizeof(argv[b]), qsort_strcmp);
for(i=b;i<argc;++i) {
for(j=0;j<fail;++j) {
writ(argv[i], rndnotzero(size), silent_error);
}
}
} else if (strcmp(argv[1], "append") == 0) {
int size;
if (argc < 5) {
/* LCOV_EXCL_START */
help();
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
seed = atoi(argv[2]);
size = atoi(argv[3]);
b = 4;
/* sort the file names */
qsort(&argv[b], argc - b, sizeof(argv[b]), qsort_strcmp);
for(i=b;i<argc;++i) {
append(argv[i], rndnotzero(size));
}
} else if (strcmp(argv[1], "truncate") == 0) {
int size;
if (argc < 5) {
/* LCOV_EXCL_START */
help();
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}
seed = atoi(argv[2]);
size = atoi(argv[3]);
b = 4;
/* sort the file names */
qsort(&argv[b], argc - b, sizeof(argv[b]), qsort_strcmp);
for(i=b;i<argc;++i) {
truncat(argv[i], rnd(size));
}
} else if (strcmp(argv[1], "change") == 0) {
int size;
//.........这里部分代码省略.........
开发者ID:GDXN,项目名称:snapraid,代码行数:101,代码来源:mktest.c
示例11: RK_TRACE
void RKSettingsModuleOutput::boxChanged () {
RK_TRACE (SETTINGS);
change ();
auto_raise_box->setEnabled (auto_show_box->isChecked ());
graphics_jpg_quality_box->setEnabled (graphics_type_box->itemData (graphics_type_box->currentIndex ()).toString () == "\"JPG\"");
}
开发者ID:KDE,项目名称:rkward,代码行数:6,代码来源:rksettingsmoduleoutput.cpp
示例12: perform_trial
double perform_trial(int numpoints, int dimension, position *node_location) {
init_heap_vars(numpoints, (numpoints * (numpoints - 1)) / 2); // initialize the heap variables
node *heap = (node *) malloc(sizeof(node) * numpoints); // create heap
int location[numpoints]; // create array, indexed by name, that remembers the index of each element in the heap
node *graph = (node *) malloc(sizeof(node) * numpoints); // initialize graph
/*
* (i) create struct node for each graph node
* (ii) intialize distance values
* (iii) create V-S list
* (iv) initialize heap to empty
* (v) initialize array to hold distnace values
*/
for(int i = 0; i < numpoints; i++) {
graph[i].name = i; // name each node
graph[i].dist = -1; // here all edges are positive so we'll let -1 = infinity
insert_list(i); // initially every node is in V-S, list.c maintains a LL with V-S
location[i] = -1; // initially no node is in the heap
heap[i].dist = 100000; // set heap to empty
heap[i].name = 100000;
}
graph[0].dist = 0; // set distance to first node to 0
insert(graph[0], heap, location); // insert first node into the heap
while(size_heap() != 0) {
node v = delete_min(heap, location); // take smallest node from the heap
// ensure heap wasn't somehow empty
if(v.dist == -100.) {
break;
}
delete_list(v.name); // delete the node from V-S
list_node *ptr = get_head(); // get head node from V-S
while(ptr != NULL) {
int current_name = ptr->name; // get name of current element
// found a node, check for update
double check_val = 0;
// just generate a random edge since each edge is only examined once
if(dimension == 1) {
//check_val = (double)rand()/(double)RAND_MAX;
check_val = fabs(node_location[v.name].x-node_location[current_name].x);
} else if(dimension == 2) {
double parameter = pow((node_location[v.name].x-node_location[current_name].x), 2.)
+ pow((node_location[v.name].y-node_location[current_name].y), 2.);
check_val = sqrt(parameter);
} else if(dimension == 3) {
double parameter = pow((node_location[v.name].x-node_location[current_name].x), 2.)
+ pow((node_location[v.name].y-node_location[current_name].y), 2.)
+ pow((node_location[v.name].z-node_location[current_name].z), 2.);
check_val = sqrt(parameter);
} else if(dimension == 4) {
double parameter = pow((node_location[v.name].x-node_location[current_name].x), 2.)
+ pow((node_location[v.name].y-node_location[current_name].y), 2.)
+ pow((node_location[v.name].z-node_location[current_name].z), 2.)
+ pow((node_location[v.name].w-node_location[current_name].w), 2.);
check_val = sqrt(parameter);
}
// check if we need to update
if(((graph[current_name].dist > check_val) || graph[current_name].dist == -1)) {
// perform update
graph[current_name].dist = check_val;
// insert/update element in the heap
node change_node = graph[current_name];
change(change_node, heap, location);
}
ptr = ptr->next;
}
}
// sum and print the edges in the MST
double sum = sum_MST(numpoints, graph);
free(heap); // free heap
free(graph); // free graph
free_list(); // free list
return sum;
}
开发者ID:tlemberg10,项目名称:cs124code,代码行数:84,代码来源:prim.c
示例13: change
void Blink1Input::setArg2(const QString &arg2)
{
marg2 = arg2;
emit change();
}
开发者ID:cyberzed,项目名称:blink1,代码行数:5,代码来源:blink1input.cpp
示例14: main
int main(int argc, char * argv[]) {
nameOfFile = argv[1];
data = fopen(nameOfFile, "a+");
if (data == NULL)
perror("Error");
phBook.size = 0;
phBook.contact = malloc(phBook.size * sizeof(Note));
freeInd.top = 0;
freeInd.size = 1;
freeInd.num = (int *)malloc(freeInd.size * sizeof(int));
rewind(data);
int id;
while (fscanf(data, "%d ", &id) == 1) {
phBook.size++;
phBook.contact = realloc(phBook.contact, phBook.size * sizeof(Note));
phBook.contact[phBook.size - 1].id = id;
phBook.contact[phBook.size - 1].name = getword(data);
phBook.contact[phBook.size - 1].nmbr = getword(data);
}
if (phBook.size == 0)
currentID = 1;
else
currentID = phBook.contact[phBook.size - 1].id + 1;
char *cmd, *name, *number, *input;
while (42) {
cmd = getword(stdin);
if (!strcmp(cmd, "find")) {
input = getword(stdin);
if (inputIsCorrect(input))
find(input);
free(input);
}
else if (!strcmp(cmd, "create")) {
name = getword(stdin);
number = getword(stdin);
if (inputIsCorrect(name) && inputIsCorrect(number))
create(name, number);
}
else if (!strcmp(cmd, "delete")) {
scanf("%d\n", &id);
del(id);
}
else if (!strcmp(cmd, "change")) {
scanf("%d ", &id);
cmd = getword(stdin);
input = getword(stdin);
if (inputIsCorrect(input))
change(id, cmd, input);
free(input);
}
else if (!strcmp(cmd, "exit")) {
fclose(data);
free(phBook.contact);
free(freeInd.num);
return 0;
}
else {
printf("Unknown command.\n");
}
free(cmd);
fflush(stdout);
}
}
开发者ID:ToxinG,项目名称:C-C-tasks,代码行数:63,代码来源:main.c
示例15: change
void LayerPropertyEdit::undo(const LayerRef &layer)
{
change(layer);
}
开发者ID:h2so5,项目名称:PaintField,代码行数:4,代码来源:layeredit.cpp
示例16: change
void PageCache::pruneToSizeNow(unsigned size, PruningReason pruningReason)
{
TemporaryChange<unsigned> change(m_maxSize, size);
prune(pruningReason);
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:5,代码来源:PageCache.cpp
示例17: main
task main(){
checkBTLinkConnected();
StartTask(sendMessages);
change(6,8,6,8,100,150,100,200);
wait1Msec(3000);
change(10,13,6,8,200,0,100,200);
wait1Msec(1000);
change(6,8,6,8,100,150,100,200);
wait1Msec(1000);
change(6,13,6,8,200,0,100,200);
wait1Msec(1000);
change(6,8,6,8,100,150,100,200);
wait1Msec(1000);
change(3,13,6,8,200,0,100,200);
wait1Msec(1000);
change(6,8,6,8,100,150,100,200);
wait1Msec(1500);
change(6,8,10,13,100,150,200,255);
wait1Msec(1000);
change(6,8,6,8,100,150,100,200);
wait1Msec(1000);
change(6,8,6,13,100,150,200,255);
wait1Msec(1000);
change(6,8,6,8,100,150,100,200);
wait1Msec(1000);
change(6,8,3,13,100,150,200,255);
wait1Msec(1000);
change(6,8,6,8,100,0,100,200);
wait1Msec(2000);
PlaySound(soundDownwardTones);
change(6,10,6,10,100,0,100,255);
wait1Msec(1500);
for(int i = 0; i<=10; ++i){
change(12,10,12,10,200,0,200,255);
wait1Msec(1000);
change(6,10,6,10,100,0,100,255);
wait1Msec(1000);
}
change(0,8,0,8,200,0,200,0);
wait1Msec(5000);
}
开发者ID:sohamsankaran,项目名称:DaRWIn,代码行数:45,代码来源:AutoGyroSend6.c
示例18: change
void
TileMap::change_at(const Vector& pos, uint32_t newtile)
{
Vector xy = (pos - offset) / 32;
change(int(xy.x), int(xy.y), newtile);
}
开发者ID:gabixdev,项目名称:supertux,代码行数:6,代码来源:tilemap.cpp
示例19: LH_Qt_QString
LH_CursorController::LH_CursorController()
{
updating_link_data_ = false;
setup_link_json_data_ = new LH_Qt_QString(this, "Cursor Data", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDEVALUE /*| LH_FLAG_HIDDEN*/);
setup_link_json_data_->setHelp("<p>This field holds the data for this cursor; all cursor objects by default link themselves to \"Primary Cursor\".</p>"
"<p>You only need change the name of this link if your layout needs more than one cursor.");
setup_link_postback_ = new LH_Qt_QString(this, "Cursor Postback", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSOURCE | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
setup_link_current_pos = new LH_Qt_QString(this, "Cursor Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY /* | LH_FLAG_HIDDEN*/);
setup_link_current_pos->setHelp("<p>Displays the coordinates of the cursor at present, as well as whether the controller is currently active:</p>"
"<p>(x,y) [active]</p>"
"<p>This is mainly provided for advanced layout designers if they want to link something to the current cursor position.</p>");
setup_link_selected_pos = new LH_Qt_QString(this, "Selected Position", "", LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY /* | LH_FLAG_HIDDEN*/);
setup_link_selected_pos->setHelp("<p>Displays the coordinates of the selected point at present, as well as whether the controller is currently active:</p>"
"<p>(x,y) [active]</p>"
"<p>This is mainly provided for advanced layout designers if they want to link something to the current selection position.</p>");
//setup_link_postback_->setLinkFilter("CursorPostback");
//setup_link_json_data_->setLinkFilter("Cursors");
setup_cursor_active_ = new LH_Qt_bool(this, "Active", cursor_data_.active, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
setup_cursor_sel_x_ = new LH_Qt_int(this, "X (Selected)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
setup_cursor_sel_y_ = new LH_Qt_int(this, "Y (Selected)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
setup_cursor_x_ = new LH_Qt_int(this, "X (Current)", cursor_data_.x, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
setup_cursor_y_ = new LH_Qt_int(this, "Y (Current)", cursor_data_.y, LH_FLAG_NOSAVE_DATA | LH_FLAG_NOSINK | LH_FLAG_READONLY | LH_FLAG_HIDDEN);
new LH_Qt_QString(this, "hr1", "<hr>", LH_FLAG_NOSOURCE | LH_FLAG_NOSINK | LH_FLAG_HIDETITLE, lh_type_string_html );
setup_coordinate_ = new LH_Qt_QString(this, "Coordinate", "1,1", LH_FLAG_NOSAVE_DATA | LH_FLAG_READONLY | LH_FLAG_FIRST | LH_FLAG_HIDDEN);
setup_coordinate_->setHelp("The current cursor location.");
cursorModes.append((cursorMode){smSelectDeselect, true , "Activate, Move & Select / Deselect"});
cursorModes.append((cursorMode){smSelect , true , "Activate, Move & Select Only (one is always selected)"});
cursorModes.append((cursorMode){smNone , true , "Activate & Move Only (Highlighted option is selected)"});
cursorModes.append((cursorMode){smNone , false, "Move Only (Highlighted option is selected, always activated)"});
cursorModes.append((cursorMode){smSelectDeselect, false, "Move & Select / Deselect Only (Always activated)"});
cursorModes.append((cursorMode){smSelect , false, "Move & Select Only (Always activated)"});
//cursor_data_ = (cursorData){1,1,false,0,0,false,0,0,false,false,0,0,(bounds){(minmax){0,0},(minmax){0,0}}};
QStringList modeNames = QStringList();
foreach(cursorMode cm, cursorModes) modeNames.append(cm.description);
setup_mode_ = new LH_Qt_QStringList(this,"Cursor Mode",modeNames,LH_FLAG_AUTORENDER);
setup_mode_->setHelp("This allows the user to select how the cursor should behave. Each cursor mode is a combination of several options:<br/>"
"<br/>"
"<ul>"
"<li><b>Activate</b></br>"
"If a mode includes \"activation\" then in it's default state the cursor is hidden and nothing happens when using the movement or selection keys. Insetad the user must first press the activation key to display the cursor. Whilst active the cursor is visible, can be moved and, if appropriate, items can be selected and deselected. If activation is not included in the mode, then the cursor is assumed to always be active.</li>"
"<li><b>Select</b></br>"
"For modes that include selecting, the user must first move the cursor over the desired option and then press the select key before anything happens. If a mode does not include selection, then simply moving the cursor changes the selection immediately.</li>"
"</li>"
"<li><b>Deselect</b></br>"
"Some modes have select/deselect behaviour, specified by this option. With this ability the user can \"turn off\" everything; without it there will always be one item selected.</li>"
"</li>"
"</ul>");
connect( setup_mode_, SIGNAL(changed()), this, SLOT(changeMode()) );
setup_boundry_ = new LH_Qt_QString(this,"Boundries","1,1,3,3",0);
setup_boundry_->setHelp("This box should contain the borders of the \"box\" the cusror can move in.</br></br>The format is [left],[top],[right],[bottom] <br/><br/>e.g.:<br/>\"1,1,1,4\" would denote a box one column wide and four rows high<br/>\"1,1,3,3\" would be a square of three columns and three rows.");
connect( setup_boundry_, SIGNAL(changed()), this, SLOT(changeBounds()) );
setup_boundry_loop_ = new LH_Qt_bool(this, "Loop at edges", false);
setup_boundry_loop_->setHelp("By default when at the furthest edge of the box the cursor stops. Ticking this however will change that so that moving off one edge will bring the cursor back in on the opposite side.");
setup_invalid_coordinates_ = new LH_Qt_QString(this,"Invalid Points\n(x,y;x,y;x,y)","",0);
setup_invalid_coordinates_->setHelp("If you wish to create a \"void\" in the cusrsor space, this allows you to do so. List all the points here that the cursor is not allowed to land on and it will be prevented from doing so either by jumping over the invlid points to the next valid one or simply by blocking its movement.<br/><br/>The format is [x1],[y1];[x2],[y2];[x3][y3]; etc...<br/>e.g.: for the boundry \"1,1,2,5\" the invalid points \"1,2;1,3;1,4\" would prevent the cursor landing on any of the top three middle cells, creating a \"U\"-like shape.");
setup_jump_invalid_ = new LH_Qt_bool(this, "Jump over invalid points", true);
setup_jump_invalid_->setHelp("By default when the cursor tries to move onto an invlid point it \"jumps\" the cell in question, and keeps moving in the same direction until reaching one where it is allowed to be. Alternatively, checking this box will prevent this, turning invalid points into \"walls\" that have to be moved around manually.");
setup_move_up_ = new LH_Qt_InputState(this,"Up","",0);
setup_move_up_->setHelp("The key used to move the cursor up, usually the up key from the LCD control");
connect( setup_move_up_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveUp(QString,int,int)) );
setup_move_down_ = new LH_Qt_InputState(this,"Down","",0);
setup_move_down_->setHelp("The key used to move the cursor down, usually the down key from the LCD control");
connect( setup_move_down_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveDown(QString,int,int)) );
setup_move_left_ = new LH_Qt_InputState(this,"Left","",0);
setup_move_left_->setHelp("The key used to move the cursor left, usually the left key from the LCD control");
connect( setup_move_left_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveLeft(QString,int,int)) );
setup_move_right_ = new LH_Qt_InputState(this,"Right","",0);
setup_move_right_->setHelp("The key used to move the cursor right, usually the right key from the LCD control");
connect( setup_move_right_, SIGNAL(input(QString,int,int)), this, SLOT(doMoveRight(QString,int,int)) );
setup_select_ = new LH_Qt_InputState(this,"Select","",0);
setup_select_->setHelp("The key used to select the currently highlighted option, usually the Ok key from the LCD control");
connect( setup_select_, SIGNAL(input(QString,int,int)), this, SLOT(doSelect(QString,int,int)) );
setup_reselect_ = new LH_Qt_InputState(this,"Reselect","",0);
setup_reselect_->setHelp("The key used to reselect the previously selected highlighted option. Usually this is unused, but is very useful for menu layouts where it acts as a \"return to last layout\" (or cancel) command");
connect( setup_reselect_, SIGNAL(input(QString,int,int)), this, SLOT(doReselect(QString,int,int)) );
setup_activate_ = new LH_Qt_InputState(this,"Enable","",0);
setup_activate_->setHelp("The key used to activate the cursor control");
connect( setup_activate_, SIGNAL(input(QString,int,int)), this, SLOT(doActivate(QString,int,int)) );
setup_persistent_ = new LH_Qt_bool(this,"Persistent Selection",false);
setup_persistent_->setHelp("Ticking this box will cause the system to automatically recall the cursor's last position whether you save the layout or not.<br/><br/>This is mainly of use within menu layouts and allows the menu to open with the last selected option still highlighted.");
//.........这里部分代码省略.........
开发者ID:AllainFortier,项目名称:lcdhost,代码行数:101,代码来源:LH_CursorController.cpp
示例20: change
void Sudoku::transform(){
change();
printOut(false);
}
开发者ID:ying33119,项目名称:pd2-sudoku,代码行数:4,代码来源:Sudoku.cpp
注:本文中的change函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论