Esempio n. 1
0
void draw_circle (ESContext *esContext, int16_t x, int16_t y, int16_t radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
#ifdef CONSOLE_ONLY
	return;
#endif
	GLfloat x1 = (float)x / (float)esContext->width * 2.0 * aspect - 1.0 * aspect;
	GLfloat y1 = (float)y / (float)esContext->height * 2.0 - 1.0;
	GLfloat radius1 = (float)radius / (float)esContext->width * 2.0 * aspect;
	y1 = y1 * -1;
	draw_circle_f3(esContext, x1, y1, 0.0, radius1, r, g, b, a);
}
Esempio n. 2
0
void draw_circle_f (ESContext *esContext, float x1, float y1, float radius, uint8_t r, uint8_t g, uint8_t b, uint8_t a) {
#ifdef CONSOLE_ONLY
	return;
#endif
	draw_circle_f3(esContext, x1, y1, 0.0, radius, r, g, b, a);
}
Esempio n. 3
0
void swarm_draw_setup(ESContext *esContext) {
	int n = 0;
	int ny = 1;
	int gx = 0;
	int gy = 0;
	char tmp_str[128];
	char tmp_str2[128];
	float px1 = -0.8;
	float py1 = -0.9;
	float px2 = 0.9;
	float py2 = 0.1;
	float sy = 0.08;
	reset_buttons();
	EntryList list[3];
	list[0].name = "ROLE";
	list[1].name = "OFFSET";
	list[2].name = NULL;
	draw_window(esContext, px1, py1, px2, py2, 0.002, "SwarmSetup.options", "Swarm-Setup", list, SwarmSetup.options, swarm_set);
	if (SwarmSetup.options == 0) {
		draw_text_button(esContext, "master_title", setup.view_mode, "Master:", FONT_WHITE, px1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		uint8_t n2 = 0;
		EntryList list[MODELS_MAX + 2];
		list[0].name = "GCS";
		for (n2 = 0; n2 < MODELS_MAX; n2++) {
			list[n2 + 1].name = ModelData[n2].name;
		}
		list[n2 + 1].name = NULL;
		draw_pulldown(esContext, px1 + 0.1, py1 + (float)ny * sy, 0.45, 0.01, "SwarmSetup.master", list, pd_openm, SwarmSetup.master + 1, swarm_set);
		ny++;
		draw_text_button(esContext, "sclave_title", setup.view_mode, "Slaves:", FONT_WHITE, px1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		for (n = 0; n < 4; n++) {
			sprintf(tmp_str2, "SwarmSetup.slave%i", n);
			draw_pulldown(esContext, px1 + 0.1, py1 + (float)ny * sy, 0.44, 0.01, tmp_str2, list, pd_open[n], SwarmSetup.slave[n] + 1, swarm_set);
			sprintf(tmp_str, "X=%im", SwarmSetup.offset_x[n]);
			sprintf(tmp_str2, "SwarmSetup.offx%i", n);
			draw_spinbox(esContext, px1 + 0.55, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "X=%0.0fm", SwarmSetup.offset_x[n], swarm_set);
			sprintf(tmp_str, "Y=%im", SwarmSetup.offset_y[n]);
			sprintf(tmp_str2, "SwarmSetup.offy%i", n);
			draw_spinbox(esContext, px1 + 0.9, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "Y=%0.0fm", SwarmSetup.offset_y[n], swarm_set);
			sprintf(tmp_str, "Z=%im", SwarmSetup.offset_z[n]);
			sprintf(tmp_str2, "SwarmSetup.offz%i", n);
			draw_spinbox(esContext, px1 + 1.25, py1 + (float)ny * sy, 0.34, 0.01, tmp_str2, "Z=%0.0fm", SwarmSetup.offset_z[n], swarm_set);
			ny++;
		}
		ny++;
		draw_text_button(esContext, "swarm_yawmode_", setup.view_mode, "Yaw-Rotate", FONT_GREEN, px1 + 0.1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		draw_checkbox(esContext, px1 + 0.7, py1 + (float)ny * sy, 0.005, "swarm_yawmode", SwarmSetup.yaw_mode, swarm_set);
		ny++;
		draw_text_button(esContext, "swarm_rotate_", setup.view_mode, "Pattern-Rotate", FONT_GREEN, px1 + 0.1, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		draw_checkbox(esContext, px1 + 0.7, py1 + (float)ny * sy, 0.005, "swarm_rotate", SwarmSetup.rotate, swarm_set);
		ny++;
	} else {
		float gx1 = px1 + 0.5;
		float gx2 = px2 - 0.1;
		float gy1 = py1 + 0.15;
		float gy2 = py2 - 0.15;
		int gxn = 80;
		int gyn = 40;
		ny++;
		ny++;
		sprintf(tmp_str, "SLAVE=%i", SwarmSetup.selected);
		draw_text_button(esContext, "SwarmSetup.selected", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, 0.0);
		ny++;
		sprintf(tmp_str, "%s", ModelData[SwarmSetup.slave[SwarmSetup.selected]].name);
		draw_text_button(esContext, "SwarmSetup.offn", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "X=%im", SwarmSetup.offset_x[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offx", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "Y=%im", SwarmSetup.offset_y[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offy", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		sprintf(tmp_str, "Z=%im", SwarmSetup.offset_z[SwarmSetup.selected]);
		draw_text_button(esContext, "SwarmSetup.offz", setup.view_mode, tmp_str, FONT_GREEN, px1 + 0.01, py1 + (float)ny * sy, 0.005, 0.06, ALIGN_LEFT, ALIGN_TOP, swarm_set, (float)SwarmSetup.selected);
		ny++;
		for (gx = 0; gx <= gxn; gx++) {
			draw_line_f3(esContext, gx1 + (float)gx * ((gx2 - gx1) / (float)gxn), gy1, 0.006, gx1 + (float)gx * ((gx2 - gx1) / (float)gxn), gy2, 0.006, 255, 255, 255, 90);
		}
		for (gy = 0; gy <= gyn; gy++) {
			draw_line_f3(esContext, gx1, gy1 + (float)gy * ((gy2 - gy1) / (float)gyn), 0.006, gx2, gy1 + (float)gy * ((gy2 - gy1) / (float)gyn), 0.006, 255, 255, 255, 90);
		}
		draw_circleFilled_f3(esContext, gx1 + (gx2 - gx1) / 2.0, gy1 + (gy2 - gy1) / 2.0, 0.007, 0.01, 255, 0, 0, 255);
		for (n = 0; n < 4; n++) {
			if (SwarmSetup.slave[n] == -1) {
				continue;
			}
			float offx = SwarmSetup.offset_x[n] / 50.0;
			float offy = SwarmSetup.offset_y[n] / 50.0;
			draw_circleFilled_f3(esContext, gx1 + (gx2 - gx1) / 2.0 + offx, gy1 + (gy2 - gy1) / 2.0 + offy, 0.007, 0.01, 255, 255, 0, 255);
			if (n == SwarmSetup.selected) {
				draw_circle_f3(esContext, gx1 + (gx2 - gx1) / 2.0 + offx, gy1 + (gy2 - gy1) / 2.0 + offy, 0.007, 0.02, 255, 0, 255, 255);
			}
		}
	}
	draw_buttonbox(esContext, "swarm_setup_done", setup.view_mode, "CLOSE", px2 - 0.33, py2 - 0.1, 0.3, 0.005, swarm_set, 0.0);
}