void Scene::load_points(const QString& filename) { if (!m_domain.is_valid()) return; std::vector<FT> weights; std::vector<Point> points; if (filename.contains(".dat", Qt::CaseInsensitive)) { load_dat(filename, points); weights.resize(points.size(), 0.0); } if (!points.empty()) { clear(); init_colors(points.size()); construct_triangulation(points, weights); return; } std::cout << red << "try (.dat) file format" << white << std::endl; return; }
c_scene_sp::c_scene_sp() { load_dat("effect.pat","data/effect"); }
int main(int argc, char *argv[]) { if (argc != 3 && argc != 4) { printf("Usage: %s width height high_path\n", argv[0]); return 0; } int width = atoi(argv[1]); int height = atoi(argv[2]); if (width <= 0) { printf("Width must be larger than 0.\n"); return 0; } if (width >= 7) { printf("Width must be less than 7.\n"); return 0; } if (height <= 0) { printf("Height must be larger than 0.\n"); return 0; } if (height >= 6) { printf("Height must be less than 6.\n"); return 0; } int player_low = 1; if (argc == 4) { player_low = 0; } state s_ = (state) {rectangle(width, height), 0, 0, 0, 0}; state *s = &s_; char dir_name[16]; sprintf(dir_name, "%dx%d", width, height); assert(chdir(dir_name) == 0); dict d_; dict *d = &d_; d->num_slots = load_dat("d_slots.dat", (void**) &(d->slots), sizeof(slot_t)); load_dat("d_checkpoints.dat", (void**) &(d->checkpoints), sizeof(size_t)); lin_dict ko_ld_; lin_dict *ko_ld = &ko_ld_; ko_ld->num_keys = load_dat("ko_ld_keys.dat", (void**) &(ko_ld->keys), sizeof(size_t)); node_value *base_nodes; load_dat("base_nodes_j.dat", (void**) &base_nodes, sizeof(node_value)); node_value *pass_nodes; load_dat("pass_nodes_j.dat", (void**) &pass_nodes, sizeof(node_value)); node_value *ko_nodes; load_dat("ko_nodes_j.dat", (void**) &ko_nodes, sizeof(node_value)); value_t *leaf_nodes; load_dat("leaf_nodes_j.dat", (void**) &leaf_nodes, sizeof(value_t)); canonize(s); inspect( d, ko_ld, base_nodes, pass_nodes, ko_nodes, leaf_nodes, s, base_nodes[key_index(d, to_key(s))], player_low, 1 ); /* FILE *f; f = fopen("d_slots.dat", "wb"); fwrite((void*) d->slots, sizeof(slot_t), d->num_slots, f); fclose(f); f = fopen("d_checkpoints.dat", "wb"); fwrite((void*) d->checkpoints, sizeof(size_t), (d->num_slots >> 4) + 1, f); fclose(f); f = fopen("ko_ld_keys.dat", "wb"); fwrite((void*) ko_ld->keys, sizeof(size_t), ko_ld->num_keys, f); fclose(f); */ }