1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* Copyright (c) 2002 Damien HENRY.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* code for seg pd class NOT WORKING YET*/
#include "m_pd.h"
#include "g_canvas.h"
typedef struct s_pd_obj_seg
{
t_object t_ob;
t_symbol *seg_name;
t_float *posx;
t_float *posy;
t_float *x1;
t_float *y1;
t_float *x2;
t_float *y2;
t_float *width;
t_symbol *color;
} t_seg;
typedef struct s_seg
{
t_object t_ob;
t_symbol* seg_name;
t_float posx;
t_float posy;
t_float x1;
t_float y1;
t_float x2;
t_float y2;
t_float width;
t_symbol color;
} t_seg;
void seg_help(t_seg *x)
{
post(" ");
post("seg v001");
post("+ symbol list :");
post("++ help : this help !!!");
post(" ");
}
void seg_width(t_seg *x, t_floatarg f)
{
post("seg: width %f",f);
t_atom my_atom ;
t_atom *my_pointer = &my_atom;
SETFLOAT(my_pointer, *f);
outlet_anything(x->x_obj.ob_outlet, gensym("!width"), 1,my_pointer);
}
void seg_pos(t_seg *x, t_floatarg f1, t_floatarg f2)
{
outlet_float(x->x_outlet1, (t_float)f1+(t_float)f2);
}
void seg_free(void)
{
post("seg_free");
}
t_class *seg_class;
void *seg_new(void)
{
t_seg *x = (t_seg *)pd_new(seg_class);
post("seg created");
sys_vgui(".x%x.c create oval 10 10 20 20\n",glist_getcanvas(glist),
x->x_obj.te_xpos+1,x->x_obj.te_ypos+1,
x->x_obj.te_xpos + x->x_width -1,
x->x_obj.te_ypos + x->x_height -1,x->x_color->s_name,x);
x->posx = 0; x->posy = 0;
x->x1 = 10; x->y1 = 10;
x->x1 = 20; x->y1 = 20;
x->x_outlet1 = outlet_new(&x->t_ob, &s_float);
return (void *)x;
}
void seg_setup(void)
{
post("seg_setup");
seg_class = class_new(gensym("seg"), (t_newmethod)seg_new,(t_method)seg_free, sizeof(t_seg), 0, A_GIMME, 0);
class_addmethod(seg_class, (t_method)seg_width, gensym("width"),A_FLOAT, 0);
class_addmethod(seg_class, (t_method)seg_pos, gensym("pos"),A_FLOAT,A_FLOAT, 0);
class_addmethod(seg_class, (t_method)seg_help, gensym("help"), 0);
class_sethelpsymbol(seg_class, gensym("xgui/help_seg"));
}
|