Would you like to make this site your homepage? It's fast and easy...
Yes, Please make this my home page!
sdi_appw.lua
1 -- SDI_HellCreator
2 -- Salomatine Dmitry.
3 -- sdihellcreator@bezeqint.net
4 -- Israel
5 -- original sdi_appw.lua
6 -- revision 13.04.2003
7 -- start app window definition
8 require("sdi_class");
9 require("sdi_types");
10 require("sdi_ext");
11 AppWindow = {}
12
13 local AppWindow_mt = Class(AppWindow)
14
15 -- via new function must provide arguments
16 function AppWindow:new(title,px,py,sx,sy,tbpp,tcva_arb,tmt_arb)
17 arbs={};
18 arbs[1]=ARB_ext:new("compiledvertexsarray_arb",tcva_arb);
19 arbs[2]=ARB_ext:new("multitexture_arb",tmt_arb);
20 t_r=Rect:new(px,py,sx,xy);
21 return setmetatable({w_title=title,w_r=t_r,w_bpp=tbpp,app_arbs=arbs}, AppWindow_mt);
22 end
23
24 --default constructor for object via new
25 function AppWindow:AppWindow()
26 return AppWindow:new("No Title",0,0,640,480,16,0,0);
27 end
28 -- set/get name of object(1=set)
29 function AppWindow:Title(sg,title)
30 if sg==1 then -- set
31 self.w_title=title;
32 else -- get
33 return self.w_title;
34 end
35 end
36 -- set/get position
37 function AppWindow:Pos(sg,x,y)
38 if sg==1 then -- set
39 self.w_r:Pos(x,y);
40 else -- get
41 return self.w_r:Pos();
42 end
43 end
44 -- set/get size of window
45 function AppWindow:Size(sg,x,y)
46 if sg==1 then --set
47 self.w_r:Size(x,y);
48 else -- get
49 return self.w_r:Size();
50 end
51 end
52 -- set/get bits per pixel
53 function AppWindow:BPP(sg,tbpp)
54 if sg==1 then --set
55 self.w_bpp=tbpp;
56 else -- get
57 return self.w_bpp;
58 end
59 end
60 -- prints all information
61 function AppWindow:Pinfo()
62 print("Window title is"..self:Title());
63 print("Window position is",self:Pos());
64 print("Window size is",self:Size());
65 print("Window Bits Per Pixel is",self:BPP());
66 --print all extensions
67 for ti=1,next(self.app_arbs,ti)+1 do
68 self.app_arbs[ti]:Pinfo();
69 end
70 end
71 -- creating window and seting its properties
72 mainwindow=AppWindow:new("Kill Them All By Dmitry Salomatine",0,0,640,480,16,1,1);
73 mainwindow:Pinfo();