Beispiel #1
0
void spawn_http_pend(widget *x)
{
	widget *item, *w = widget_window_new(100, 100, "Pending Devices");
	item = widget_text_new(10, 65, "OpenGL");
	item->fontsize = 30.0f;
	item->fontface = 1;
	widget_child_add(w, item);
	item = widget_text_new(20, 90, hcopy(
		(const char*)glGetString(GL_VENDOR) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 110, hcopy(
		(const char*)glGetString(GL_RENDERER) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 130, hcopy(
		(const char*)glGetString(GL_VERSION) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 150, hcopy(
		(const char*)glGetString(GL_SHADING_LANGUAGE_VERSION) ));
	widget_child_add(w, item);

	w->size.x = 330;
	w->size.y = 155;
	w->noResize = 1;
	widget_add(w);
}
Beispiel #2
0
IMG* img_load(const char * filename)
{
	log_verbose("Loading Image(\"%s\")", filename);
	const int size = sizeof(IMG);
	IMG *i = malloc(size);
	if(!i)return 0;
	memset(i, 0, size);
	i->name = hcopy(filename);
	i->buf = stbi_load(filename, &i->x, &i->y, &i->channels, 0);
	img_glinit(i);
	return i;
}
Beispiel #3
0
widget* widget_window_new(int x, int y, char* title)
{
	int2 p = {x, y}, s = {400, 300};
	widget *w = widget_new(p, s);
	w->draw = widget_window_draw;
	w->data = hcopy(title);
	w->click = widget_window_click;
	w->onclick = widget_window_onclick;
	w->release = widget_window_release;
	w->free = widget_button_free;
	return w;
}
Beispiel #4
0
void spawn_gpuinfo(widget *x)
{
	widget *item, *w = widget_window_new(100, 100, "GPU Information");
	item = widget_text_new(10, 65, "OpenGL");
	item->fontsize = 30.0f;
	item->fontface = 1;
	widget_child_add(w, item);
	item = widget_text_new(20, 90, hcopy(
		(const char*)glGetString(GL_VENDOR) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 110, hcopy(
		(const char*)glGetString(GL_RENDERER) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 130, hcopy(
		(const char*)glGetString(GL_VERSION) ));
	widget_child_add(w, item);
	item = widget_text_new(20, 150, hcopy(
		(const char*)glGetString(GL_SHADING_LANGUAGE_VERSION) ));
	widget_child_add(w, item);

	item = widget_text_new(10, 175, "OpenCL");
	item->fontsize = 30.0f;
	item->fontface = 1;
	widget_child_add(w, item);

	int count = 0;
	size_t bs=1000;
	char buf[bs];
	OCLCONTEXT *c = OpenCL;
		for(int i=0; i<c->num_pid; i++)
	{
		bs = 1000;
		clGetPlatformInfo( c->pid[i], CL_PLATFORM_NAME, bs, buf, &bs);
		item = widget_text_new(10, 200+count*20, hcopy(buf));
		widget_child_add(w, item);
		count ++;

		for(int j=0; j<c->num_did[i]; j++)
		{
			bs = 1000;
			clGetDeviceInfo(c->did[i][j], CL_DEVICE_NAME, bs, buf, &bs);
			item = widget_text_new(20, 200+count*20, hcopy(buf));
			widget_child_add(w, item);
			count ++;
		}
	}

	w->size.x = 330;
	w->size.y = 190 + count * 20;
	w->noResize = 1;
	widget_add(w);
}
Beispiel #5
0
Signal::Signal(const Signal& sig): ref(NULL)
{
  sample = NULL;
  hcopy(sig);
}
Beispiel #6
0
Signal& Signal::operator=(const Signal& obj)
{
  hcopy(obj);
  return *this;
}
Beispiel #7
0
void spawn_open(widget *x)
{
	widget *w = widget_window_new(100, 100, "OPEN...");
	w->onclick = widget_open_onclick;
	w->click = widget_open_click;
	widget *b = widget_button_new(10, 40, "Open");
	b->action = x ? open_test : open_voxel;

	widget_child_add(w, b);


	int dmax = 100, fmax = 100;
	int dcnt = 0, fcnt = 0;
	char **dirs;
	char **files;

	dirs = malloc(sizeof(char*)*dmax);
	files = malloc(sizeof(char*)*fmax);

	char *path = "./data";
	w->data2 = path;
	DIR *dir = opendir(path);
	char tmp[1000];
	struct dirent *ent;
	while((ent = readdir(dir)))
	{
		if(ent->d_name[0] == '.')continue;

		struct stat s;
		memset(&s, 0, sizeof(struct stat));
		memset(tmp, 0, 1000);
		sprintf(tmp, "%s/%s", path, ent->d_name);
		stat(tmp, &s);
		if( S_ISDIR(s.st_mode) )
		{
			if(dcnt == dmax)
			{
				printf("dont forget to malloc some more\n");
				return;
			}
			dirs[dcnt++] = hcopy(ent->d_name);
		} else
		if( S_ISREG(s.st_mode) )
		{
			if(fcnt == fmax)
			{
				printf("dont forget to malloc some more\n");
				return;
			}
			if(x)
			{
				if(strstr(ent->d_name, ".obj"))
					files[fcnt++] = hcopy(ent->d_name);
				else if(strstr(ent->d_name, ".OpenCL"))
					files[fcnt++] = hcopy(ent->d_name);
			}
			else
			{
				if(strstr(ent->d_name, ".obj"))
					files[fcnt++] = hcopy(ent->d_name);
			}
		}
		else printf("Unexpected Filetype= %d \"%s\"\n", s.st_mode, ent->d_name);


	}
	closedir(dir);

	qsort(dirs, dcnt, sizeof(char*), cmp_str);
	qsort(files, fcnt, sizeof(char*), cmp_str);

	widget *item = widget_list_new(10, 80, dirs, dcnt);
	item->size.x = w->size.x / 3 - 15;
	item->size.y = w->size.y - 100;
	widget_child_add(w, item);
	item = widget_list_new(w->size.x/3 + 5, 80, files, fcnt);
	item->size.x = w->size.x / 3 * 2 - 15;
	item->size.y = w->size.y - 100;
	widget_child_add(w, item);
	item->action = open_test;
	widget_add(w);
}