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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
function tables(hObj,event)
global decalage_h;
global decalage_v;
global nombre_table;
global panel;
global list;
%mise à 0 des variables
decalage_h1=0;
decalage_v1=0;
panel=0;
list=0;
nombre_table=0;
decalage_h=0;
decalage_v=0;
figure('units','pixels',...
'position',[10 10 1300 900],...
'color',[1,1,0.9],...
'menubar','none',...
'numbertitle','off',...
'name','TABLES');
uicontrol('style','pushbutton',...
'units','normalized',...
'position', [0.15 0.85 0.1 0.07],...
'string','Retour',...
'callback','close gcbf;');
uicontrol('style','pushbutton',...
'units','normalized',...
'position', [0.25 0.90 0.2 0.07],...
'string','Nouvelle table',...
'callback',{@ajouter_table});
uicontrol('style','pushbutton',...
'units','normalized',...
'position', [0.50 0.90 0.2 0.07],...
'string','Enlever table',...
'callback',{@enlever_table});
t4= uicontrol('style','list',...
'units','normalized',...
'String',{'joueur'},...
'Position',[0.0,0.0,0.15 1],...
'callback',@poser_joueur1);
for compt=1:nombre_table %rafraichissement des tables deja installées
panel = uipanel('Title',['table' char(compt+48)],...
'FontSize',12,...
'BackgroundColor','white',...
'Position',[.15+0.2*decalage_h1 .5-0.3*decalage_v1 .15 .25]);
decalage_h1=decalage_h1+1;
if decalage_h1==4
decalage_h1 = 0;
decalage_v1=decalage_v1+1;
end
list = uicontrol('style','list',...
'Parent',panel,...
'units','normalized',...
'String','joueurs',...
'Position',[0.1,0.1,0.8 0.8]);
compt = compt + 1;
end
function [] = ajouter_table(hobj,event)
nombre_table=nombre_table+1;
panel1 = uipanel('Title',['table' char(nombre_table+48)],...
'FontSize',12,...
'BackgroundColor','white',...
'Position',[.15+0.2*decalage_h .5-0.3*decalage_v .15 .25]);
list1=uicontrol('style','list',...
'Parent',panel1,...
'units','normalized',...
'String','joueurs',...
'callback',@poser_joueur2,...
'Position',[0.1,0.1,0.8 0.8]);
decalage_h=decalage_h+1; %on décale leur position
if decalage_h==4
decalage_h=0;
decalage_v=decalage_v+1;
end
panel = [panel;panel1]; %on ajoute une ligne aux matrices
list = [list;list1];
end
function [] = enlever_table(varargin)
delete(list(nombre_table + 1));
delete(panel(nombre_table + 1));
nombre_table = nombre_table - 1;
panel = panel(1:size(panel,1)-1);
list = list(1:size(list,1)-1);
if decalage_h == 0
decalage_h = 3;
decalage_v = decalage_v - 1;
else decalage_h = decalage_h - 1;
end
end
function poser_joueur1(hobj,event)
joueur_choisi = get(t4,{'string','value'}); %selection du joueur (au clic) dans la liste a gauche
end
function poser_joueur2(hobj,event)
%COMMENT DETERMINER QUELLE LISTE EST SELECTIONNEE?
end
end |
Partager