Beispiel #1
0
static gint
panel_size_alloc(GtkWidget *widget, GtkAllocation *a, panel *p)
{
    static gint x, y;
    
    ENTER;
    DBG("gtk: size (%d, %d). pos (%d, %d)\n", a->width, a->height, a->x, a->y);
    DBG("our: size (%d, %d). pos (%d, %d)\n", p->aw, p->ah, p->ax, p->ay);
    if (p->widthtype == WIDTH_REQUEST)
        p->width = (p->orientation == ORIENT_HORIZ) ? a->width : a->height;
    if (p->heighttype == HEIGHT_REQUEST)
        p->height = (p->orientation == ORIENT_HORIZ) ? a->height : a->width;
    calculate_position(p);
    DBG("our: size (%d, %d). pos (%d, %d)\n", p->aw, p->ah, p->ax, p->ay);
    if (a->width == p->aw && a->height == p->ah && x == p->ax && y == p ->ay) {
        DBG("actual coords eq to preffered. just returning\n");
        RET(TRUE);
    }
    x = p->ax;
    y = p->ay;
    gtk_window_move(GTK_WINDOW(p->topgwin), p->ax, p->ay);
    DBG("moving to %d %d\n", p->ax, p->ay);
    if (p->setstrut)
        panel_set_wm_strut(p);
    RET(TRUE);
}
Beispiel #2
0
/*
 * Calculate the initial position.
 */
static void
calculate_initial_position (GtkWidget *ardesia_bar_window,
                            gint *x,
                            gint *y,
                            gint w_width,
                            gint w_height,
                            gint position)
{
  gint d_width = gdk_screen_width ();
  gint d_height = gdk_screen_height ();

  /* Resize if larger that screen width. */
  if (w_width>d_width)
    {
      w_width = d_width;
      gtk_window_resize (GTK_WINDOW (ardesia_bar_window), w_width, w_height);
    }

  /* Resize if larger that screen height. */
  if (w_height>d_height)
    {
      gint tollerance = 15;
      w_height = d_height - tollerance;
      gtk_widget_set_size_request (ardesia_bar_window, w_width, w_height);
    }

  calculate_position (ardesia_bar_window, d_width, d_height, x, y, w_width, w_height, position);
}
Beispiel #3
0
void			cylinder_inter(t_inter *inter, void *obj, t_ray ray,
								t_light *light)
{
	t_cylinder	cylinder;
	double		dist;
	t_ray		temp;

	cylinder = *((t_cylinder *)obj);
	temp = ray;
	change_frame(&ray, cylinder.inv, vector_inverse(cylinder.trans));
	dist = cylinder_distance(ray, cylinder);
	if (dist > EPS && (inter->dist == NULL || dist < *(inter->dist) - EPS))
	{
		if (inter->dist == NULL)
			inter->dist = malloc(sizeof(double));
		free_light_ray_list(inter);
		*(inter->dist) = dist;
		inter->pos = calculate_position(ray, dist);
		inter->normal = cylinder_normal(inter->pos, cylinder);
		if (vector_dot_product(inter->normal, ray.dir) > 0)
			inter->normal = vector_inverse(inter->normal);
		op_inv(cylinder.trans, cylinder.rot, &(inter->normal), &(inter->pos));
		inter->refl = calculate_reflection(temp, inter->normal);
		inter->color = cylinder.color;
		create_light_ray_list(inter, light, inter->pos);
		inter->refl_val = cylinder.refl;
	}
}
Beispiel #4
0
static gboolean
panel_monitors_changed(GdkScreen* s, panel* p)
{
    ENTER;
    p->monitor = gdk_screen_get_primary_monitor(s);
    calculate_position(p, distance,distancefrom);
    gdk_window_move_resize(p->topgwin->window, p->ax, p->ay, p->aw, p->ah);
    if (p->setstrut)
        panel_set_wm_strut(p);
    RET(TRUE);
}
Beispiel #5
0
/*Return 0 if command was applied/succesfull, -1 if it was not a valid commando or not possible to apply*/
int set(enum atc_commands cmd, struct atc_plane *plane)
{
	plane->time = get_time();
	if(calculate_position( plane, plane->time ) ) {
		switch (cmd){
			case speed_up : if(plane->speed  >= 280) { /*maximum plane speed 1000km/h expressed in 28m/s*/
								return -1;
							}
							else{
								plane->speed += 14;
								return sto_set(&sto_db, plane, plane->id);
							}
						break;
			case speed_down : if( plane->speed <= 42) {  /*minimum plane speed 150km/h expressed in m/s*/
								return -1;
							}
							else{
								plane->speed -= 14;
								return sto_set(&sto_db, plane, plane->id);
							}
						break;
			case climb : if( plane->elevation == 30) { 
								return -1;
							}
							else{
								plane->elevation = plane->elevation + 10;
								return sto_set(&sto_db, plane, plane->id);
							}
						break;
			case descend : if( plane->elevation == -30) { 
								return -1;
							}
							else{
							 	plane->elevation = plane->elevation - 10;
								return sto_set(&sto_db, plane, plane->id);
							}
						break;
			case turn_right : 	if(plane->heading == 0){
									plane->heading =360;
								}
								plane->heading = (plane->heading -45);
								return sto_set(&sto_db, plane, plane->id);
						break;
			case turn_left: 	plane->heading = (plane->heading +45) % 360;
								return sto_set(&sto_db, plane, plane->id);
						break;
			default: return -1;
		}
	}
	return 0;
}
Beispiel #6
0
static gint
panel_size_req(GtkWidget *widget, GtkRequisition *req, panel *p)
{
    ENTER;
    DBG("IN req=(%d, %d)\n", req->width, req->height);
    if (p->widthtype == WIDTH_REQUEST)
        p->width = (p->orientation == ORIENT_HORIZ) ? req->width : req->height;
    if (p->heighttype == HEIGHT_REQUEST)
        p->height = (p->orientation == ORIENT_HORIZ) ? req->height : req->width;
    calculate_position(p, distance,distancefrom);
    req->width  = p->aw;
    req->height = p->ah;
    DBG("OUT req=(%d, %d)\n", req->width, req->height);
    RET( TRUE );
}
Beispiel #7
0
static void
panel_size_req(GtkWidget *widget, GtkRequisition *req, panel *p)
{
    ENTER;
    DBG("IN req=(%d, %d)\n", req->width, req->height);
    if (p->widthtype == WIDTH_REQUEST)
        p->width = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? req->width : req->height;
    if (p->heighttype == HEIGHT_REQUEST)
        p->height = (p->orientation == GTK_ORIENTATION_HORIZONTAL) ? req->height : req->width;
    calculate_position(p);
    req->width  = p->aw;
    req->height = p->ah;
    DBG("OUT req=(%d, %d)\n", req->width, req->height);
    RET();
}
Beispiel #8
0
/*Returns the amount of planes flying currently, which are loaded into the received plane buffer. Also, updates the storage
when it detects that a plane has colided or landed, or -1 if there was an error*/
int get_airplanes(struct atc_plane buffer[])
{

	time_t current_time = get_time();
	struct atc_plane plane;
	int count = 0;
	int new_plane_flag = 1;
	struct sto_cursor query;
	int error_flag = 0;
	error_flag = sto_query(&query, &sto_db, NULL, NULL);
	if(error_flag == -1) {
		atcd_crashed_count = atcd_landed_count = -1; 
		sto_close(&query);
		return error_flag;
	}
	atcd_crashed_count = 0;
	atcd_landed_count = 0;
	new_plane_flag = sto_get(&query, &plane, NULL);

	while( (new_plane_flag > 0) ){
		if(plane.status == flying){
			if(calculate_position(&plane, current_time) && count < MAX_PLANES){
				memcpy(&buffer[count], &plane, sizeof(struct atc_plane));
				count++;
			}
		}
		else if(plane.status == crashed){
			atcd_crashed_count += 1;
		}
		else if(plane.status == landed){
			atcd_landed_count += 1;
		}
		new_plane_flag = sto_get(&query, &plane, NULL);
	}
	if(new_plane_flag == -1){
		atcd_crashed_count = atcd_landed_count = -1; 
		sto_close(&query);
		return -1;
	}
	_planes_count = count;	
	sto_close(&query);
	return count;
}
static GstPadProbeReturn
buffer_cb (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
{
  GstVideoOverlayRectangle *rect;
  GstVideoOverlayComposition *comp;
  GstVideoFrame frame;
  GstVideoMeta *vmeta;
  GstVideoInfo vinfo;
  GstCaps *caps;
  gint x, y;

  caps = gst_pad_get_current_caps (pad);
  gst_video_info_from_caps (&vinfo, caps);
  gst_caps_unref (caps);

  info->data = gst_buffer_make_writable (info->data);

  vmeta = gst_buffer_get_video_meta (logo_buf);

  calculate_position (&x, &y, vmeta->width, vmeta->height, ++count);

  GST_LOG ("%3d, %3d", x, y);

  rect = gst_video_overlay_rectangle_new_raw (logo_buf, x, y,
      vmeta->width, vmeta->height, GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE);
  comp = gst_video_overlay_composition_new (rect);
  gst_video_overlay_rectangle_unref (rect);

  gst_video_frame_map (&frame, &vinfo, info->data, GST_MAP_READWRITE);

  if (!gst_video_overlay_composition_blend (comp, &frame))
    g_warning ("Error blending overlay at position (%d,%d)", x, y);

  gst_video_frame_unmap (&frame);

  gst_video_overlay_composition_unref (comp);

  return GST_PAD_PROBE_OK;
}
Beispiel #10
0
void main() {
	int x,y;
	scanf("%d %d",&x, &y);	
	calculate_position(x,y);
}
Beispiel #11
0
void
panel_start_gui(panel *p)
{
    ENTER;
    //gtk_rc_parse_string(transparent_rc);
    p->topgwin      = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    gtk_container_set_border_width(GTK_CONTAINER(p->topgwin), 0);
    gtk_window_set_resizable(GTK_WINDOW(p->topgwin), FALSE);
    gtk_window_set_wmclass(GTK_WINDOW(p->topgwin), "panel", "trayer");
    gtk_window_set_title(GTK_WINDOW(p->topgwin), "panel");
    gtk_window_set_position(GTK_WINDOW(p->topgwin), GTK_WIN_POS_CENTER);
    g_signal_connect ( G_OBJECT(p->topgwin) , "delete-event" , G_CALLBACK(panel_delete_event) , p);
    g_signal_connect ( G_OBJECT(p->topgwin) , "destroy-event", G_CALLBACK(panel_destroy_event), p);
    g_signal_connect ( G_OBJECT (p->topgwin), "size-request" , G_CALLBACK(panel_size_req)  , p);
    g_signal_connect ( G_OBJECT (p->topgwin), "size-allocate", G_CALLBACK(panel_size_alloc), p);

    if (p->transparent) {
      g_signal_connect (G_OBJECT (p->topgwin), "configure-event", G_CALLBACK(panel_configure_event), p);
      g_signal_connect (G_OBJECT (p->topgwin), "style-set", G_CALLBACK( panel_style_set), p);
    }

    if (p->on_primary) {
        GdkDisplay *display = gdk_display_get_default ();
        GdkScreen *screen = gdk_display_get_screen(display, 0);
        g_signal_connect ( screen, "monitors-changed", G_CALLBACK(panel_monitors_changed), (gpointer)p );
        p->monitor = gdk_screen_get_primary_monitor(screen);

    }
    gtk_widget_realize(p->topgwin);
    gdk_window_set_decorations(p->topgwin->window, 0);
    gtk_widget_set_app_paintable(p->topgwin, TRUE);

    p->lbox = p->my_box_new(FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(p->lbox), 0);
    gtk_container_add(GTK_CONTAINER(p->topgwin), p->lbox);
    gtk_widget_show(p->lbox);

    if (p->allign == ALLIGN_RIGHT) {
        GtkWidget * expander = p->my_box_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(p->lbox), expander, TRUE, TRUE, 0);
        gtk_widget_show(expander);
    }

    p->box = p->my_box_new(FALSE, 1);
    gtk_container_set_border_width(GTK_CONTAINER(p->box), 1);
    gtk_box_pack_start(GTK_BOX(p->lbox), p->box, FALSE, TRUE, padding);
    gtk_widget_show(p->box);

    // get properties on topgwin
    p->topGdkWindow = gtk_widget_get_window(p->topgwin);
    p->topxwin = GDK_WINDOW_XWINDOW(GTK_WIDGET(p->topgwin)->window);

    bg_init(gdk_helper_display());

    /* make our window unfocusable */
    gdk_window_set_accept_focus(p->topGdkWindow,False);

    if (p->setdocktype) {
        gdk_window_set_type_hint(p->topGdkWindow,GDK_WINDOW_TYPE_HINT_DOCK);
    }

    Xclimsg(p->topxwin, a_NET_WM_DESKTOP, 0xFFFFFFFF, 0, 0, 0, 0);

    /************************/
    /* Window Mapping Point */
    gtk_widget_show_all(p->topgwin);
    Xclimsg(p->topxwin, a_NET_WM_DESKTOP, 0xFFFFFFFF, 0, 0, 0, 0);

    gdk_window_stick                 ( p->topGdkWindow);
    gdk_window_set_skip_pager_hint   ( p->topGdkWindow, True );
    gdk_window_set_skip_taskbar_hint ( p->topGdkWindow, True );

    XSelectInput (gdk_helper_display(), GDK_ROOT_WINDOW(), PropertyChangeMask);
    XSelectInput (gdk_helper_display(), p->topxwin, PropertyChangeMask | FocusChangeMask | StructureNotifyMask);
    gdk_window_add_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_wm_events, p);

    calculate_position(p, distance,distancefrom);
    gdk_window_move_resize(p->topgwin->window, p->ax, p->ay, p->aw, p->ah);
    if (p->setstrut)
        panel_set_wm_strut(p);
    if (p->lower)
        XLowerWindow(gdk_helper_display(), p->topxwin);

    RET();
}
Beispiel #12
0
void
panel_start_gui(panel *p)
{
    Atom state[3];
    XWMHints wmhints;
    guint32 val;
 
    
    ENTER;

    // main toplevel window
    p->topgwin =  gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(p->topgwin), 0);
    gtk_window_set_resizable(GTK_WINDOW(p->topgwin), FALSE);
    gtk_window_set_wmclass(GTK_WINDOW(p->topgwin), "panel", "fbpanel");
    gtk_window_set_title(GTK_WINDOW(p->topgwin), "panel");
    gtk_window_set_position(GTK_WINDOW(p->topgwin), GTK_WIN_POS_NONE);
    gtk_window_set_decorated(GTK_WINDOW(p->topgwin), FALSE);
    
    g_signal_connect(G_OBJECT(p->topgwin), "delete-event",
          G_CALLBACK(panel_delete_event), p);
    g_signal_connect(G_OBJECT(p->topgwin), "destroy-event",
          G_CALLBACK(panel_destroy_event), p);
    g_signal_connect (G_OBJECT (p->topgwin), "size-request",
          (GCallback) panel_size_req, p);
    g_signal_connect (G_OBJECT (p->topgwin), "size-allocate",
          (GCallback) panel_size_alloc, p);
    g_signal_connect (G_OBJECT (p->topgwin), "configure-event",
          (GCallback) panel_configure_event, p);
    g_signal_connect (G_OBJECT (p->topgwin), "realize",
          (GCallback) panel_realize, p);
    g_signal_connect (G_OBJECT (p->topgwin), "style-set",
          (GCallback) panel_style_set, p);
    
    gtk_widget_realize(p->topgwin);
    //gdk_window_set_decorations(p->topgwin->window, 0);
    gtk_widget_set_app_paintable(p->topgwin, TRUE);
    
    // background box all over toplevel
    p->bbox = gtk_bgbox_new();
    gtk_container_add(GTK_CONTAINER(p->topgwin), p->bbox);
    gtk_widget_show(p->bbox);
    gtk_container_set_border_width(GTK_CONTAINER(p->bbox), 0);
    if (p->transparent) {
        p->bg = fb_bg_get_for_display();
        gtk_bgbox_set_background(p->bbox, BG_ROOT, p->tintcolor, p->alpha);        
    }

    // main layout manager as a single child of background widget box
    p->lbox = p->my_box_new(FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(p->lbox), 0);
    gtk_container_add(GTK_CONTAINER(p->bbox), p->lbox);
    gtk_widget_show(p->lbox);
    if (p->round_corners)
        make_round_corners(p);
 
    p->box = p->my_box_new(FALSE, p->spacing); 
    gtk_container_set_border_width(GTK_CONTAINER(p->box), 0);
    gtk_box_pack_start(GTK_BOX(p->lbox), p->box, TRUE, TRUE, 0);
    gtk_widget_show(p->box);
      
    p->topxwin = GDK_WINDOW_XWINDOW(GTK_WIDGET(p->topgwin)->window);
    DBG("topxwin = %x\n", p->topxwin);

    /* the settings that should be done before window is mapped */
    wmhints.flags = InputHint;
    wmhints.input = 0;
    XSetWMHints (GDK_DISPLAY(), p->topxwin, &wmhints); 
#define WIN_HINTS_SKIP_FOCUS      (1<<0)	/* "alt-tab" skips this win */
    val = WIN_HINTS_SKIP_FOCUS;
    XChangeProperty(GDK_DISPLAY(), p->topxwin,
          XInternAtom(GDK_DISPLAY(), "_WIN_HINTS", False), XA_CARDINAL, 32,
          PropModeReplace, (unsigned char *) &val, 1);

    if (p->setdocktype) {
        state[0] = a_NET_WM_WINDOW_TYPE_DOCK;
        XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_WINDOW_TYPE, XA_ATOM,
              32, PropModeReplace, (unsigned char *) state, 1);
    }

    /* window mapping point */
    gtk_widget_show_all(p->topgwin);

    /* the settings that should be done after window is mapped */

    /* send it to running wm */
    Xclimsg(p->topxwin, a_NET_WM_DESKTOP, 0xFFFFFFFF, 0, 0, 0, 0);
    /* and assign it ourself just for case when wm is not running */
    val = 0xFFFFFFFF;
    XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_DESKTOP, XA_CARDINAL, 32,
          PropModeReplace, (unsigned char *) &val, 1);

    state[0] = a_NET_WM_STATE_SKIP_PAGER;
    state[1] = a_NET_WM_STATE_SKIP_TASKBAR;
    state[2] = a_NET_WM_STATE_STICKY;
    XChangeProperty(GDK_DISPLAY(), p->topxwin, a_NET_WM_STATE, XA_ATOM,
          32, PropModeReplace, (unsigned char *) state, 3);

    XSelectInput (GDK_DISPLAY(), GDK_ROOT_WINDOW(), PropertyChangeMask);
    gdk_window_add_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_event_filter, p);

    calculate_position(p);
    gdk_window_move_resize(p->topgwin->window, p->ax, p->ay, p->aw, p->ah);
    if (p->setstrut)
        panel_set_wm_strut(p);
  
    RET();
}
Beispiel #13
0
static void
panel_start_gui(panel *p)
{
    ENTER;

    // main toplevel window
    p->topgwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(p->topgwin), 0);
    g_signal_connect(G_OBJECT(p->topgwin), "destroy-event",
                     (GCallback) panel_destroy_event, p);
    g_signal_connect(G_OBJECT(p->topgwin), "size-request",
                     (GCallback) panel_size_req, p);
    g_signal_connect(G_OBJECT(p->topgwin), "map-event",
                     (GCallback) panel_mapped, p);
    g_signal_connect(G_OBJECT(p->topgwin), "configure-event",
                     (GCallback) panel_configure_event, p);
    g_signal_connect(G_OBJECT(p->topgwin), "button-press-event",
                     (GCallback) panel_button_press_event, p);
    g_signal_connect(G_OBJECT(p->topgwin), "scroll-event",
                     (GCallback) panel_scroll_event, p);

    gtk_window_set_resizable(GTK_WINDOW(p->topgwin), FALSE);
    gtk_window_set_wmclass(GTK_WINDOW(p->topgwin), "panel", "fbpanel");
    gtk_window_set_title(GTK_WINDOW(p->topgwin), "panel");
    gtk_window_set_position(GTK_WINDOW(p->topgwin), GTK_WIN_POS_NONE);
    gtk_window_set_decorated(GTK_WINDOW(p->topgwin), FALSE);
    gtk_window_set_accept_focus(GTK_WINDOW(p->topgwin), FALSE);
    if (p->setdocktype)
        gtk_window_set_type_hint(GTK_WINDOW(p->topgwin),
                                 GDK_WINDOW_TYPE_HINT_DOCK);

    if (p->layer == LAYER_ABOVE)
        gtk_window_set_keep_above(GTK_WINDOW(p->topgwin), TRUE);
    else if (p->layer == LAYER_BELOW)
        gtk_window_set_keep_below(GTK_WINDOW(p->topgwin), TRUE);
    gtk_window_stick(GTK_WINDOW(p->topgwin));

    gtk_widget_realize(p->topgwin);
    p->topxwin = GDK_WINDOW_XWINDOW(p->topgwin->window);
    DBG("topxwin = %lx\n", p->topxwin);
    /* ensure configure event */
    XMoveWindow(GDK_DISPLAY(), p->topxwin, 20, 20);
    XSync(GDK_DISPLAY(), False);

    gtk_widget_set_app_paintable(p->topgwin, TRUE);
    calculate_position(p);
    gtk_window_move(GTK_WINDOW(p->topgwin), p->ax, p->ay);
    gtk_window_resize(GTK_WINDOW(p->topgwin), p->aw, p->ah);
    DBG("move-resize x %d y %d w %d h %d\n", p->ax, p->ay, p->aw, p->ah);
    //XSync(GDK_DISPLAY(), False);
    //gdk_flush();

    // background box all over toplevel
    p->bbox = gtk_bgbox_new();
    gtk_container_add(GTK_CONTAINER(p->topgwin), p->bbox);
    gtk_container_set_border_width(GTK_CONTAINER(p->bbox), 0);
    if (p->transparent) {
        p->bg = fb_bg_get_for_display();
        gtk_bgbox_set_background(p->bbox, BG_ROOT, p->tintcolor, p->alpha);
    }

    // main layout manager as a single child of background widget box
    p->lbox = p->my_box_new(FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(p->lbox), 0);
    gtk_container_add(GTK_CONTAINER(p->bbox), p->lbox);

    p->box = p->my_box_new(FALSE, p->spacing);
    gtk_container_set_border_width(GTK_CONTAINER(p->box), 0);
    gtk_box_pack_start(GTK_BOX(p->lbox), p->box, TRUE, TRUE,
                       (p->round_corners) ? p->round_corners_radius : 0);
    if (p->round_corners) {
        make_round_corners(p);
        DBG("make_round_corners\n");
    }
    /* start window creation process */
    gtk_widget_show_all(p->topgwin);
    /* .. and hide it from user until everything is done */
    gtk_widget_hide(p->topgwin);

    p->menu = panel_make_menu(p);

    if (p->setstrut)
        panel_set_wm_strut(p);

    XSelectInput(GDK_DISPLAY(), GDK_ROOT_WINDOW(), PropertyChangeMask);
    gdk_window_add_filter(gdk_get_default_root_window(),
                          (GdkFilterFunc)panel_event_filter, p);
    //XSync(GDK_DISPLAY(), False);
    gdk_flush();
    RET();
}
Beispiel #14
0
void cDlgOptions::create_hardpoints(HTREEITEM item)
{
	HTREEITEM fixed = utf->AddNewNode(tree, item, "Fixed");
	HTREEITEM revolute = utf->AddNewNode(tree, item, "Revolute");

	// iterate mesh list and create hardpoints
	list<MMESH *>::iterator i;
	for (i = meshList->begin(); i != meshList->end(); i ++)
	{
		MMESH * m = *i;
		char * hp_name = 0;

		// Hardpoint|Fixed|blah or Hardpoint|Revolute|blah
		if ( !_strnicmp(m->nname, "Hp", 2) )
		{
			HTREEITEM parent = 0;
			if ( !_strnicmp (m->nname + 3, "Fixed", 5) )
			{
				parent = fixed;
				hp_name = m->nname + 9;	// pointer to name Hp|Fixed|name
			}
			else if ( !_strnicmp (m->nname + 3, "Revolute", 8) )
			{
				parent = revolute;
				hp_name = m->nname + 12;	// pointer to name Hp|Revolute|name
			}
			else 
				continue;

 			HTREEITEM new_hp = utf->AddNewNode(tree, parent, hp_name);

				// only revolute hardpoints have these
				if (parent == revolute)
				{
					HTREEITEM axis = utf->AddNewNode(tree, new_hp, "Axis");
						float * axis_data = (float *) malloc (12 + 4);
						*(int *) axis_data = 12;
						axis_data[1] = 0.0f;
						axis_data[2] = 1.0f;
						axis_data[3] = 0.0f;
						tree->SetItemData(axis, (DWORD_PTR)axis_data);

					HTREEITEM max = utf->AddNewNode(tree, new_hp, "Max");
						float * max_data = (float *) malloc (8 + 4);
						*(int *) max_data = 8;
						max_data[1] = 0.785380f;
						max_data[2] = 0.0f;
						tree->SetItemData(max, (DWORD_PTR)max_data);

					HTREEITEM min = utf->AddNewNode(tree, new_hp, "Min");
						float * min_data = (float *) malloc (8 + 4);
						*(int *) min_data = 8;
						min_data[1] = -0.785400f;
						min_data[2] = 0.0f;
						tree->SetItemData(min, (DWORD_PTR)min_data);
				}

				// both fixed and revolute hardpoints have Orientation and Position
						float * position_data = (float *) malloc (12 + 4);
						*(int *) position_data = 12;
						calculate_position( position_data + 1, m);

						float * orientation_data = (float *) malloc (36 + 4);
						*(int *) orientation_data = 36;
						calculate_orientation( orientation_data + 1, position_data + 1, hp_name);

					HTREEITEM orientation = utf->AddNewNode(tree, new_hp, "Orientation");
						tree->SetItemData(orientation, (DWORD_PTR) orientation_data);

					HTREEITEM position = utf->AddNewNode(tree, new_hp, "Position");
						tree->SetItemData(position, (DWORD_PTR) position_data);
		}
	}
}
Beispiel #15
0
void	VersusScene::calculate_and_send_position()
{
	if ( m_player )
	{
		TEXEngine::Core::Message	parameters(3,0,0);

		parameters.add_integral_data(0,static_cast<TEXEngine::Core::MESSAGE_INTEGRAL_DATA_TYPE>(get_id()));
		parameters.add_integral_data(1,static_cast<TEXEngine::Core::MESSAGE_INTEGRAL_DATA_TYPE>(0));
		parameters.add_integral_data(2,static_cast<TEXEngine::Core::MESSAGE_INTEGRAL_DATA_TYPE>(calculate_position()));
		trigger_event(PLAYER_POSITION,parameters);
	}
}