Esempio n. 1
0
static void chkwinner (enum EPlayer player)
{
    for (unsigned i = 0; i < RANKS; ++i)
	if (_hand[player][i] > 0 && _hand[player][i] < SUITS)
	    return;
    draw_panel();
    printplayer (player);
    waddstr (_wmsg, "don't have any more cards!\n\nMy books:");
    unsigned cb = countbooks (COMPUTER);
    waddstr (_wmsg, "Your books:");
    unsigned ub = countbooks (USER);
    wprintw (_wmsg, "\nI have %d, you have %d.\n", cb, ub);
    if (ub > cb) {
	waddstr (_wmsg, "\nYou win!!!\n");
	if (!nrand(64))
	    waddstr (_wmsg, "Cheater, cheater, pumpkin eater!\n");
    } else if (cb > ub) {
	waddstr (_wmsg, "\nI win!!!\n");
	if (!nrand(64))
	    waddstr (_wmsg, "Hah! Stupid peasant!\n");
    } else
	waddstr (_wmsg, "\nTie!\n");
    wgetch (_wmsg);
    exit (EXIT_SUCCESS);
}
Esempio n. 2
0
static unsigned usermove (void)
{
    for (;;) {
	draw_panel();
	int k = wgetch (_wmsg);
	unsigned n = parse_card_name (k);

	if (k == 'x' || k == KEY_F(10))
	    exit (EXIT_SUCCESS);
	else if (k == '?' || k == KEY_F(1))
	    instructions();
	else if (k == KEY_RESIZE)
	    initialize_windows();
	else if (n >= ArraySize(c_CardNames))
	    waddstr (_wmsg, "I don't understand!\n");
	else if (_hand[USER][n] < 1)
	    wprintw (_wmsg, "You don't have any %s's!\n", c_CardNames[n]);
	else if (_hand[USER][n] >= SUITS)
	    wprintw (_wmsg, "You have already completed a book of %s's.\n", c_CardNames[n]);
	else {
	    wprintw (_wmsg, "\nYou ask me for %s. ", c_CardNames[n]);
	    return n;
	}
    }
}
Esempio n. 3
0
void draw(void)
{
  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glLoadIdentity();

  //draw working window and panel with set of tools
  draw_grid();
  draw_panel(border);
  glColor3f(0, 0, 0);
  drawBitmapText("Tools", 2, 770);
  draw_buttons();
}
Esempio n. 4
0
static int draw_window(window_t *win)
{
    ctrl_t *child;
    void   *ctx;
    rect_t *rc = &win->client;

    draw_caption(&win->caption);
    draw_panel(&win->panel);
    send_message(win, MSG_DRAW_CLIENT,0,0);

//    draw_frame(win);

//    child  = (ctrl_t*)win->child.next;

//    while( &child->link != &win->child)
//    {
//        send_message(child, 1, 0, 0);
//        child = (ctrl_t*)child->link.next;
//    };

    return 0;
};
Esempio n. 5
0
void
gkrellm_panel_create(GtkWidget *vbox, GkrellmMonitor *mon, GkrellmPanel *p)
	{
	GtkWidget		*hbox;
	GkrellmPiximage	piximage;
	GtkWidget   	*top_win = gkrellm_get_top_window();

	if (!vbox || !mon || !p)
		return;
	p->monitor = (gpointer) mon;
	if (!p->style)	/* gkrellm_panel_configure() may not have been called. */
		setup_panel_style(p, mon->privat->panel_style);

	if (!p->bg_piximage_override)
		{
		if (mon->privat->style_type == CHART_PANEL_TYPE)
			p->bg_piximage = gkrellm_bg_panel_piximage(mon->privat->style_id);
		else
			p->bg_piximage = gkrellm_bg_meter_piximage(mon->privat->style_id);
		}
	p->bg_piximage_override = FALSE;

	/* If not being called from rebuild or after a panel destroy, then panel
	|  still has a height that must be accounted for.
	*/
	if (p->h && p->shown)
		gkrellm_monitor_height_adjust(- p->h);
	p->h = p->h_configure;
	p->w = _GK.chart_width;

	if (p->hbox == NULL)
		{
		hbox = gtk_hbox_new(FALSE, 0);
		gtk_container_add (GTK_CONTAINER(vbox), hbox);
		p->hbox = hbox;
		p->drawing_area = gtk_drawing_area_new();
		p->layout = gtk_widget_create_pango_layout(top_win, NULL);
		gtk_widget_set_events (p->drawing_area, GDK_EXPOSURE_MASK
				| GDK_LEAVE_NOTIFY_MASK | GDK_ENTER_NOTIFY_MASK
				| GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK
				| GDK_POINTER_MOTION_MASK);
		gtk_box_pack_start(GTK_BOX(p->hbox), p->drawing_area,
				FALSE, FALSE, 0);
		gtk_widget_show(p->drawing_area);
		gtk_widget_show(hbox);
		p->shown = TRUE;
		gtk_widget_realize(hbox);
		gtk_widget_realize(p->drawing_area);
		panel_list = g_list_append(panel_list, p);
		p->y_mapped = -1;
		g_signal_connect(G_OBJECT (p->drawing_area), "size_allocate",
					G_CALLBACK(cb_panel_size_allocate), p);
		}
	gtk_widget_set_size_request(p->drawing_area, p->w, p->h);

	if (_GK.frame_left_panel_overlap > 0 || _GK.frame_right_panel_overlap > 0)
		{
		piximage.pixbuf = gdk_pixbuf_new_subpixbuf(p->bg_piximage->pixbuf,
				_GK.frame_left_panel_overlap, 0,
				gdk_pixbuf_get_width(p->bg_piximage->pixbuf)
							- _GK.frame_left_panel_overlap
							- _GK.frame_right_panel_overlap,
				gdk_pixbuf_get_height(p->bg_piximage->pixbuf));
		piximage.border = p->bg_piximage->border;
		gkrellm_border_adjust(&piximage.border,
				-_GK.frame_left_panel_overlap, -_GK.frame_right_panel_overlap,
				0, 0);
//		gkrellm_scale_piximage_to_pixmap(&piximage, &p->bg_clean_pixmap,
//				&p->bg_mask, p->w, p->h);
		gkrellm_scale_theme_background(&piximage, &p->bg_clean_pixmap,
				&p->bg_mask, p->w, p->h);
		g_object_unref(G_OBJECT(piximage.pixbuf));
		}
	else
		gkrellm_scale_theme_background(p->bg_piximage, &p->bg_clean_pixmap,
			&p->bg_mask, p->w, p->h);
//		gkrellm_scale_piximage_to_pixmap(p->bg_piximage, &p->bg_clean_pixmap,
//			&p->bg_mask, p->w, p->h);

	if (p->bg_text_layer_pixmap)
		g_object_unref(G_OBJECT(p->bg_text_layer_pixmap));
	p->bg_text_layer_pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);
	if (p->bg_pixmap)
		g_object_unref(G_OBJECT(p->bg_pixmap));
	p->bg_pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);
	if (p->pixmap)
		g_object_unref(G_OBJECT(p->pixmap));
	p->pixmap = gdk_pixmap_new(top_win->window, p->w, p->h, -1);

	if (p->shown)
		{
		gkrellm_monitor_height_adjust(p->h);
		gkrellm_pack_side_frames();
		}
	p->need_decal_overlap_check = TRUE;
	draw_panel(p, FALSE);
	gkrellm_panel_button_signals_connect(p);
	}
Esempio n. 6
0
void
gkrellm_draw_panel_label(GkrellmPanel *p)
	{
	if (p)
		draw_panel(p, TRUE);
	}
Esempio n. 7
0
void draw_RegistanceFrame(void)
{
	draw_panel();
	draw_reg_scale();
	draw_wireframe();
}
Esempio n. 8
0
/*********************************************************************
 *	グラフ表示内の文字を書く.
 *********************************************************************
 */
void draw_AnalogFrame(void)
{
	draw_panel();
	draw_scale();
	draw_wireframe();
}
Esempio n. 9
0
void
Box::draw_window(const CL_Rect& rect)
{
  draw_panel(CL_Rect(rect.left+1, rect.top+1, rect.right-2, rect.bottom-2));
  CL_Display::draw_rect(rect, CL_Color(0, 0, 0));
}
Esempio n. 10
0
int panel_proc(ctrl_t *ctrl, uint32_t msg, uint32_t arg1, uint32_t arg2)
{
    panel_t *panel = (panel_t*)ctrl;
    window_t *win  = get_parent_window(ctrl);

    ctrl_t *child;
    int x, y;

    x = ((pos_t)arg2).x;
    y = ((pos_t)arg2).y;

    switch( msg )
    {
        case 1:
            draw_panel((panel_t*)ctrl);
            break;

        case MSG_MOUSEMOVE:
            child = get_child(ctrl, x, y);
            if( win->child_over )
            {
                if(child == win->child_over)
                    send_message(child, msg, 0, arg2);
                else
                    send_message(win->child_over, MSG_MOUSELEAVE, 0, arg2);
            }
            else if( child )
                send_message(child, MSG_MOUSEENTER, 0, arg2);

            win->child_over = child;
            if( child )
                send_message(child,msg,0,arg2);
            else if(main_cursor != 0)
            {
               set_cursor(0);
               main_cursor = 0;
            }
            break;

        case MSG_COMMAND:
            switch((short)arg1)
            {
                case ID_PLAY:
                case ID_STOP:
                case ID_PROGRESS:
                case ID_VOL_CTRL: 
                    win = get_parent_window(ctrl);
                    send_message(win, msg, arg1, arg2);
                    break;

                default:
                    break;
            };

        default:
            child = get_child(ctrl, x, y);
            if(child)
                return send_message(child, msg, 0, arg2);
    }
    return 1;
};