Browse code

PlaygroundEditor added

Lorenz Glaser authored onWed/Sep/2020 18:0:nd
Showing64 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,1394 @@
1
+#!/boot/home/config/bin/yab
2
+//******************* ProjektVerzeichnisse bestimmen *************************************
3
+ProjectRoot$="/boot/home/.besly/PlaygroundED"
4
+ProjectFolder$=ProjectRoot$+"/projects"
5
+ProjectFolderTemp$=ProjectRoot$+"/temp"
6
+BGFolder$=ProjectFolderTemp$+"/backgrounds"
7
+OBFolder$=ProjectFolderTemp$+"/objects"
8
+
9
+//******************* ExportVerzeichnis bestimmen ************************************
10
+ProjectExport$="/boot/home/PlaygroundED/projects/export"
11
+
12
+//******************* ProgrammVerzeichnis bestimmen ************************************
13
+//WorkingDir$="/SharedBFS/projects/yab/PlaygroundEditor"
14
+WorkingDir$="/Share/Projekte/yab_hpkg/PlaygroundEditor/"
15
+SWFolder$=WorkingDir$+"data/gfx/SW"
16
+BTFolder$=WorkingDir$+"data/gfx/BT"
17
+
18
+//******************* VerzeichnisPruefung  ************************************
19
+if(IfExists(ProjectFolder$)) then
20
+else
21
+        Output$=System$("mkdir -p "+ProjectFolder$)
22
+endif
23
+if(IfExists(ProjectFolderTemp$)) then
24
+else
25
+        Output$=System$("mkdir -p "+ProjectFolderTemp$)
26
+endif
27
+if(IfExists(BGFolder$)) then
28
+else
29
+        Output$=System$("mkdir -p "+BGFolder$)
30
+endif
31
+if(IfExists(OBFolder$)) then
32
+else
33
+        Output$=System$("mkdir -p "+OBFolder$)
34
+endif
35
+//******************* VerzeichnisPruefung EXPORT ************************************
36
+if(IfExists(ProjectExport$)) then
37
+else
38
+        Output$=System$("mkdir -p "+ProjectExport$)
39
+endif
40
+	
41
+//******************* ProgrammVariablen definieren ************************************
42
+//Ermittlung des Screengroesse
43
+	screenWidth = peek("desktopwidth")
44
+	screenHeight = peek("desktopheight")  
45
+	
46
+	HBPF =  500 //Halbe Breite Programmfenster
47
+	HHPF =  400 //Halbe Hoehe Programmfenster
48
+	ExportPreviewImage=0
49
+	BITMAP 32, 32, "DrawBG"
50
+        	BITMAP 32, 32, "DrawOB"
51
+        	BITMAP 10, 10, "DrawSW"       	
52
+//******************* Window ID definieren ************************************
53
+	WindowID$="playgroundED"
54
+//******************* Anzeigename des Programms definieren ************************************
55
+	ProgrammName$="Playground Editor"
56
+//******************* ViewNamen definieren ************************************
57
+//Stackviews
58
+	SVplaygroundED$="SVPlaygroundED"
59
+
60
+//******************* Erstelle ProgrammFenster ************************************
61
+// Generate Window
62
+	WINDOW OPEN screenWidth/2-HBPF,screenHeight/2-HHPF to screenWidth/2+HBPF,screenHeight/2+HHPF , WindowID$, ProgrammName$
63
+        	WINDOW SET  WindowID$, "MinimumTo", HBPF*2,HHPF*2
64
+        	WINDOW SET  WindowID$, "flags", "not-zoomable, not-resizable"
65
+//******************* Definition des Stackviews ************************************  
66
+	width_window=WINDOW GET WindowID$, "Width"
67
+        	height_window=WINDOW GET WindowID$, "Height"
68
+        	//BUTTON width_window-110,height_window-60 TO width_window-10, height_window-10, "BTAbout", "Info",  WindowID$
69
+        
70
+        	STACKVIEW 0,0 TO width_window,height_window, SVPlaygroundED$, 5,  WindowID$
71
+       
72
+        //Stack1 = View User Stack
73
+        //Stack2 = Editor
74
+        //Docu?
75
+        //Stack4 = Export
76
+        //Stack5 = Tiles
77
+       
78
+        //Stack 1
79
+       
80
+        STACKVIEW width_window/2-200,height_window/2-300 TO width_window/2+200,height_window/2+300, "VIUserMenu", 4, SVPlaygroundED$+"1"
81
+       
82
+        //User Stack1 = Load or Create
83
+        //User Stack2 = Loading Project
84
+        //User Stack3 = Creating project
85
+
86
+        		STACKVIEW SET "VIUserMenu",1
87
+        			 BUTTON 400/2-150,600/2+70 TO 400/2+150,600/2+110, "BTAbout", "About",  "VIUserMenu1"
88
+ 		//User Stack 1		- Selecting loading of creating
89
+ 		BUTTON 400/2-150,600/2-50 TO 400/2+150,600/2-10, "BTLoadProject", "Load Project", "VIUserMenu1"
90
+ 			option set "BTLoadProject", "enabled", false
91
+ 		BUTTON 400/2-150,600/2+10 TO 400/2+150,600/2+50, "BTNewProject", "New Project", "VIUserMenu1"
92
+ 			option set "BTNewProject", "enabled", false
93
+ 			
94
+ 		//User Stack 2		- loading project
95
+ 		
96
+ 		//Stackview Open Project Button/Statusbar
97
+ 		//STACKVIEW 400/2-150,600/2-200 TO 400/2+150,600/2-160, "SVOpenProject", 4, "VIUserMenu2"
98
+ 		STACKVIEW 400/2-150,600/2+160 TO 400/2+150,600/2+200, "SVOpenProject", 4, "VIUserMenu2"
99
+ 			
100
+ 			//Stack 1 Open Project Button
101
+ 			BUTTON 400/2-150,600/2-200 TO 400/2+150,600/2-160, "BTBack", "Back", "VIUserMenu2"
102
+ 			
103
+ 			BUTTON 0,0 TO 300,40, "BTOpenProject", "Open Project", "SVOpenProject1"
104
+ 			option set "BTOpenProject", "enabled", false
105
+ 		
106
+ 			//BUTTON 400/2-150,600/2+160 TO 400/2+150,600/2+200, "BTBack", "Back", "VIUserMenu2"	
107
+ 			//Stack 2 Open Project Button - Statusbar
108
+ 			STATUSBAR 0, 0 to 300, 30, "SBOpenProject", "Loading project data", "", "SVOpenProject2"
109
+ 			
110
+ 			LISTBOX 400/2-150,600/2-140 TO 400/2+150,600/2+140, "LBProjects", 3, "VIUserMenu2"
111
+ 				LoadProjects()
112
+ 		
113
+        
114
+        		//User Stack 3		- create project
115
+ 		BUTTON 400/2-150,600/2-200 TO 400/2+150,600/2-160, "BTBack", "Back", "VIUserMenu3"
116
+ 		//DRAW SET "BGColor", 125,133,22, "VIUserMenu3"
117
+ 			
118
+ 		TEXTCONTROL 400/2-150,600/2-110 TO 400/2+150,600/2-90, "TCProjectName", "Project name:", "",  "VIUserMenu3"
119
+ 			
120
+ 		DRAW TEXT 400/2-150,600/2-35, "Size of playground (Count of filelds):", "VIUserMenu3"
121
+ 		
122
+ 			SPINCONTROL 400/2-140,600/2-10, "SCPlaygroundSizeX", "Horizontal:", 1, 9999, 1, "VIUserMenu3"
123
+ 				SPINCONTROL SET "SCPlaygroundSizeX", 23
124
+ 			SPINCONTROL 400/2+26,600/2-10, "SCPlaygroundSizeY", "Vertical:", 1, 9999, 1, "VIUserMenu3"
125
+ 				SPINCONTROL SET "SCPlaygroundSizeY", 23
126
+ 		
127
+ 		DRAW TEXT 400/2-150,600/2+55, "Size of tiles:", "VIUserMenu3"		
128
+ 			
129
+ 			SPINCONTROL 400/2-140,600/2+80, "SCTileSizeX", "Height:", 1, 9999, 1, "VIUserMenu3"
130
+ 				SPINCONTROL SET "SCTileSizeX", 32
131
+ 			SPINCONTROL 400/2+30,600/2+80, "SCTileSizeY", "Width:", 1, 9999, 1, "VIUserMenu3"
132
+ 				SPINCONTROL SET "SCTileSizeY", 32	
133
+ 		
134
+ 		//Stackview Create Project Button/Statusbar
135
+ 		STACKVIEW 400/2-150,600/2+160 TO 400/2+150,600/2+200, "SVCreateProject", 2, "VIUserMenu3"
136
+ 			// Stack 1 Create Project Button - Statusbar
137
+ 			BUTTON 0,0 TO 300,40, "BTCreateProject", "Create Project", "SVCreateProject1"
138
+        				//option set "BTCreateProject", "enabled", false
139
+        			//Stack 2 Create Project Button - Statusbar
140
+ 			STATUSBAR 0, 0 to 300, 30, "SBCreateProject", "", "", "SVCreateProject2"
141
+        		
142
+        			
143
+        //Stack 2		//Editor
144
+        
145
+        VIEW 0,3 TO 1000/2+200, 23, "VIMenu", SVPlaygroundED$+"2"
146
+        	       	//MENU "App", "About", "A", "VIMenu"        
147
+        		//MENU "Project", "Save", "S", "VIMenu"
148
+
149
+        		//MENU "Project", "--", "", "VIMenu"
150
+        		//MENU "Project", "Export", "E", "VIMenu"
151
+        		//SUBMENU "Project", "Export", "Background", "", "VIMenu"    
152
+        		//SUBMENU "Project", "Export", "Background with objects", "", "VIMenu"    
153
+        		//SUBMENU "Project", "Export", "Background with switches", "", "VIMenu"    
154
+        		//SUBMENU "Project", "Export", "Objects", "", "VIMenu"    
155
+        		//SUBMENU "Project", "Export", "Objects with switches", "", "VIMenu"    
156
+        		//SUBMENU "Project", "Export", "Switches", "", "VIMenu"    
157
+        		//SUBMENU "Project", "Export", "All", "", "VIMenu"    
158
+        		//SUBMENU "Project", "Export", "Export_playground", "E", "VIMenu"        		
159
+        		//MENU "Project", "--", "", "VIMenu"
160
+        		//MENU "Project", "Close", "", "VIMenu"
161
+        		//MENU "Tileset", "Add", "", "VIMenu"
162
+        		
163
+        		//BUTTON 5,0 TO 45,20, "BTAbout", "About", "VIMenu"
164
+        		BUTTON IMAGE 5,0, "BTAbout", BTFolder$+"/BTMenuAbouta.gif", BTFolder$+"/BTMenuAbouta.gif", Disabled$, "VIMenu"
165
+        		//BUTTON 50,0 TO 90,20, "BTSave", "Save", "VIMenu"        	
166
+        		BUTTON IMAGE 75,0, "BTSave", BTFolder$+"/BTMenuSavea.gif", BTFolder$+"/BTMenuSavea.gif", Disabled$, "VIMenu"	
167
+        		//BUTTON 95,0 TO 135,20, "BTExport", "Export", "VIMenu"
168
+        		BUTTON IMAGE 145,0, "BTExport", BTFolder$+"/BTMenuExporta.gif", BTFolder$+"/BTMenuExporta.gif", Disabled$, "VIMenu"	
169
+        		//BUTTON 140,0 TO 180,20, "BTBack", "Close", "VIMenu"
170
+        		BUTTON IMAGE 215,0, "BTBack2", BTFolder$+"/BTMenuBacka.gif", BTFolder$+"/BTMenuBacka.gif", Disabled$, "VIMenu"	
171
+        		//BUTTON 185,0 TO 225,20, "BTTiles", "Tiles", "VIMenu"
172
+        		BUTTON IMAGE 285,0, "BTTiles", BTFolder$+"/BTMenuTilesa.gif", BTFolder$+"/BTMenuTilesa.gif", Disabled$, "VIMenu"
173
+        
174
+      	  	TEXTCONTROL 1000/2+201, 0 TO 970, 20, "TCInput", "", "", SVPlaygroundED$+"2"
175
+      	  		OPTION SET "TCInput", "Enabled", false
176
+       	 	BUTTON 974, 0 TO 994, 24, "BTSetDescription", "v",  SVPlaygroundED$+"2"
177
+        			OPTION SET "BTSetDescription", "Enabled", false
178
+          
179
+       	 	BOXVIEW 5,25 TO 695,785, "BVEditor", "Playground", 3, SVPlaygroundED$+"2"
180
+         	       		VIEW 5,5 to 665, 720, "VIEditor", "BVEditor"        	       		
181
+         	               		DRAW SET "BGColor", 0,0,0, "VIEditor"
182
+         	               		//LAYOUT "Right, Bottom" , "VIEd"
183
+         	               		SCROLLBAR "SBEditor", 3, "VIEditor"
184
+                
185
+       	 	SPLITVIEW 705,25 TO 995,530, "SVList", 0, 1, SVPlaygroundED$+"2"
186
+                		SPLITVIEW SET "SVList", "Divider", 250
187
+        
188
+        		LAYOUT "Top,Bottom", "SVList1"          
189
+        		BOXVIEW 0,0 TO 288,245, "BGList", "Backgrounds", 3, "SVList1"
190
+                		COLUMNBOX 5,5 TO 277,220, "CBBG", 3, "resizable", "BGList"
191
+                        	COLUMNBOX COLUMN "CBBG", "Tile", 1, 64, 64, 64, "align-center,"
192
+                        	COLUMNBOX COLUMN "CBBG", "Description", 2, 500, 190, 190, "align-left,"
193
+        			
194
+        		LAYOUT "Top, Bottom", "SVList2" 
195
+        		BOXVIEW 0,0 TO 288,245, "OBList", "Objects", 3, "SVList2"
196
+                		COLUMNBOX 5,5 TO 277,220, "CBOB", 3, "resizable", "OBList"
197
+                        	COLUMNBOX COLUMN "CBOB", "Tile", 1, 64, 64, 64, "align-center,"
198
+        		     	COLUMNBOX COLUMN "CBOB", "Description", 2, 500, 190, 190, "align-left,"
199
+        
200
+        		BOXVIEW 705,535 TO 995,785, "SWList", "Switches", 3, SVPlaygroundED$+"2"
201
+        			COLUMNBOX 5,5 TO 277,220, "CBSW", 3, "resizable", "SWList"
202
+                        		COLUMNBOX COLUMN "CBSW", "Key", 1, 64, 64, 64, "align-center,"
203
+                        		COLUMNBOX COLUMN "CBSW", "Description", 2, 500, 190, 190, "align-left,"
204
+     	
205
+       	//Stack 3 - About
206
+      		About()
207
+       	
208
+       	 //Stack 4	-  Export
209
+       	
210
+       		STACKVIEW 1000/2-150,800/2-200 TO 1000/2+150,800/2-160, "SVExportProject", 2, SVPlaygroundED$+"4"
211
+ 			//Stack 1 Export Project Button
212
+ 			BUTTON 0,0 TO 300,40, "BTExportPlayground", "Export", "SVExportProject1"
213
+ 				option set "BTExportPlayground", "enabled", false
214
+ 			//Stack 2 Export Project Button - Statusbar
215
+ 			STATUSBAR 0, 0 to 300, 30, "SBExportProject", "Export project data", "", "SVExportProject2"
216
+       		LISTBOX 1000/2-150,800/2-140 TO 1000/2+150,800/2+140, "LBExport", 3, SVPlaygroundED$+"4"
217
+       			LISTBOX ADD "LBExport", "Background only"
218
+       			LISTBOX ADD "LBExport", "Background with objects"
219
+       			LISTBOX ADD "LBExport", "Background wich switches"
220
+       			LISTBOX ADD "LBExport", "Background with objects and switches"
221
+       			LISTBOX ADD "LBExport", "Objects only"
222
+       			LISTBOX ADD "LBExport", "Objects with switches"
223
+       			LISTBOX ADD "LBExport", "Switches only"
224
+       			
225
+       			CHECKBOX 1000/2-150,800/2+160, "CBPreviewPicture", "Export with preview image", 0, SVPlaygroundED$+"4"
226
+       			option set "CBPreviewPicture", "enabled", false
227
+       			
228
+       		BUTTON 1000/2-150,800/2+200 TO 1000/2+150,800/2+240, "BTExportBack", "Back", SVPlaygroundED$+"4"
229
+       		
230
+     
231
+          //Stack 5	-  Tileset
232
+          
233
+           BOXVIEW 10,100 TO 490,700, "BVSystemFolder", "System", 3, SVPlaygroundED$+"5"
234
+           	 COLUMNBOX 5,5 TO 470,575, "CBSystemFolder", 3, "resizable", "BVSystemFolder"
235
+           	 	COLUMNBOX COLUMN "CBSystemFolder", "Icon", 1, 64, 64, 64, "align-center,"
236
+                        	COLUMNBOX COLUMN "CBSystemFolder", "List", 2, 500, 190, 190, "align-left,"
237
+                        	
238
+                        	BUTTON 5,70 TO 205,90, "BTRefresh", "Refresh SystemFolder", SVPlaygroundED$+"5"
239
+                        	//BUTTON 495,122 TO 515,335, "BTAddBackground", ">", SVPlaygroundED$+"5"
240
+                        	BUTTON IMAGE 495,122, "BTAddBackground", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", SVPlaygroundED$+"5"
241
+                        		option set "BTAddBackground", "enabled", false
242
+                        	//BUTTON 495,340 TO 515,395, "BTRemoveBackground", "x", SVPlaygroundED$+"5"
243
+                        	BUTTON IMAGE 495,340, "BTRemoveBackground", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", SVPlaygroundED$+"5"
244
+                        		option set "BTRemoveBackground", "enabled", false
245
+                        	//BUTTON 495,427 TO 515,645, "BTAddObject", ">", SVPlaygroundED$+"5"
246
+                        	BUTTON IMAGE 495,427, "BTAddObject", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", BTFolder$+"/BTCopya.gif", SVPlaygroundED$+"5"
247
+                        		option set "BTAddObject", "enabled", false
248
+                        	//BUTTON 495,650 TO 515,700, "BTRemoveObject", "x", SVPlaygroundED$+"5"
249
+                        	BUTTON IMAGE 495,645, "BTRemoveObject", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", BTFolder$+"/BTRemovea.gif", SVPlaygroundED$+"5"
250
+                        		option set "BTRemoveObject", "enabled", false
251
+                        	
252
+                        	BUTTON 495,710 TO 515,730, "BTBackToEditor", "Back", SVPlaygroundED$+"5"                      	
253
+                        	
254
+           BOXVIEW 520,100 TO 995,395, "BVBackgroundsFolder", "Backgrounds", 3, SVPlaygroundED$+"5"
255
+           	COLUMNBOX 5,5 TO 464,270, "CBBackgroundsFolder", 3, "resizable", "BVBackgroundsFolder"
256
+           		COLUMNBOX COLUMN "CBBackgroundsFolder", "Icon", 1, 64, 64, 64, "align-center,"
257
+                        	COLUMNBOX COLUMN "CBBackgroundsFolder", "Background", 2, 500, 190, 190, "align-left,"
258
+           BOXVIEW 520,405 TO 995,700, "BVObjectsFolder", "Objects", 3, SVPlaygroundED$+"5"            
259
+           	COLUMNBOX 5,5 TO 464,270, "CBObjectsFolder", 3, "resizable", "BVObjectsFolder"      
260
+           		COLUMNBOX COLUMN "CBObjectsFolder", "Icon", 1, 64, 64, 64, "align-center,"
261
+                        	COLUMNBOX COLUMN "CBObjectsFolder", "Object", 2, 500, 190, 190, "align-left," 
262
+               	//***** SUB Folder *****
263
+	ProgramStart=1
264
+	BGFolder(ProgramStart)
265
+	OBFolder(ProgramStart)
266
+	SWFolder(ProgramStart)
267
+       	//********************             	
268
+           ReadFolderSystem()
269
+           ReadFolderBackgrounds()
270
+           ReadFolderObjects()
271
+                        	
272
+                        	
273
+          option set "BTNewProject", "enabled", true
274
+ 	option set "BTLoadProject", "enabled", true           
275
+ 	  	
276
+//Main Loop
277
+dim part$(1)
278
+dim mouse$(1)
279
+inloop = true
280
+while(inloop)
281
+        //General Messages
282
+        msg$ = message$
283
+        if (split(msg$, part$(), ":|") > 2) then
284
+                PartOne$=part$(1)
285
+                PartTwo$ = part$(2)
286
+                PartThree$ = part$(3)
287
+        fi
288
+        if (split(msg$, part$(), ":|") > 3) then
289
+                PartFour$ = part$(4)
290
+        fi
291
+        if (split(msg$, part$(), ":|") > 4) then
292
+                PartFife$ = part$(5)
293
+        fi
294
+        if (msg$ <> "") print msg$
295
+        
296
+        switch (msg$)
297
+        		
298
+        		case "playgroundED:_QuitRequested|"
299
+                        WINDOW CLOSE "playgroundED"
300
+                        break
301
+        		
302
+        		//Load Project
303
+        		
304
+        		case "BTLoadProject|"
305
+        			STACKVIEW SET "VIUserMenu",2
306
+        			break
307
+        			
308
+        		case "LBProjects:_Select:"+PartThree$+"|"
309
+        			option set "BTOpenProject", "enabled", true
310
+        			ProjectName$ = LISTBOX GET$ "LBProjects", val(PartThree$)
311
+        			break	
312
+        			
313
+        		case "BTOpenProject|"
314
+        			//if (VIEW GET "VIEditor", "Exists") then
315
+			//	VIEW REMOVE "VIEditor"
316
+			//endif
317
+			DRAW FLUSH "VIEditor"
318
+			//VIEW 0,0 to 665, 720, "VIEditor", "VIEd"
319
+				//DRAW SET "BGColor", 0,0,0, "VIEditor"
320
+			      //SCROLLBAR "SBEditor", 3, "VIEditor"
321
+        			option set "BTOpenProject", "enabled", false
322
+        			option set "BTBack", "enabled", false
323
+        			//print ProjectName$
324
+        			PlaygroundSize_Rows=1
325
+        			PlaygroundSize_Cols=1
326
+        			TileSize_x=0
327
+        			TileSize_y=0
328
+        			STACKVIEW SET "SVOpenProject",2
329
+        			//print ProjectFolderTemp$+"/projects/"+ProjectName$+".zip"
330
+        			Output$=System$("rm -r "+ProjectFolderTemp$)
331
+        			Output$=system$("cd /; unzip "+ProjectFolder$+"/"+ProjectName$+".zip")
332
+        				
333
+        				readout=open(ProjectFolderTemp$+"/project.info", "r")
334
+				x=0
335
+				while (not EOF(readout))
336
+					x=x+1
337
+					dim DocumentText$(x)
338
+					line input #readout b$
339
+						DocumentText$(x)=b$
340
+						if(left$(DocumentText$(x), 11)= "ProjectName")then
341
+							//dtleng=len(DocumentText$(x))
342
+							ProjectName$=right$(DocumentText$(x), len(DocumentText$(x))-12)
343
+							//print ProjectName$
344
+						endif
345
+						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 5
346
+						if(left$(DocumentText$(x), 15)= "Playground_Rows")then
347
+							//dtleng=len(DocumentText$(x))
348
+							//print mid$(DocumentText$(x), 17)
349
+							PlaygroundSize_Rows=val(mid$(DocumentText$(x), 17))
350
+							//print PlaygroundSize_Rows
351
+						endif
352
+						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 10
353
+        						if(left$(DocumentText$(x), 15)= "Playground_Cols")then
354
+							//dtleng=len(DocumentText$(x))
355
+							PlaygroundSize_Cols=val(mid$(DocumentText$(x), 17))
356
+							//print PlaygroundSize_Cols
357
+							//print "---------------------------------------"
358
+						endif
359
+						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 15
360
+        						if(left$(DocumentText$(x), 9)= "TileSizeX")then
361
+							//dtleng=len(DocumentText$(x))
362
+							TileSize_x=val(right$(DocumentText$(x), len(DocumentText$(x))-10))
363
+						endif
364
+						STATUSBAR SET "SBOpenProject", "Loading project data", "", 20
365
+						if(left$(DocumentText$(x), 9)= "TileSizeY")then
366
+							//dtleng=len(DocumentText$(x))
367
+							TileSize_y=val(right$(DocumentText$(x), len(DocumentText$(x))-10))
368
+						endif
369
+						STATUSBAR SET "SBOpenProject", "Loading project data...", "", 25
370
+        					wend
371
+					close(readout)
372
+					
373
+				first=0	
374
+				BGFolder(first)
375
+      					STATUSBAR SET "SBOpenProject", "Loading project data...", "", 35
376
+				OBFolder(first)
377
+                				STATUSBAR SET "SBOpenProject", "Generating playground...", "", 45
378
+                			SWFolder(first)
379
+        				
380
+        				TestePlayGroundFile()
381
+        				//LoadPlayGround()
382
+        				PlayGround()
383
+        				draw_playground()
384
+        				//print "playground: "+Playground$(0,0)
385
+        			wait 3
386
+        			
387
+        			STATUSBAR SET "SBOpenProject", "Ready", "", 100
388
+        			wait 1
389
+        			STACKVIEW SET SVPlaygroundED$,2	
390
+        			STACKVIEW SET "SVOpenProject",1
391
+        			option set "BTBack", "enabled", true
392
+        			break	
393
+        			
394
+        		//Create Project	
395
+        
396
+        		case "BTNewProject|"
397
+        			STACKVIEW SET "VIUserMenu",3
398
+        				first=0
399
+        				BGFolder(first)
400
+      				OBFolder(first)
401
+                			SWFolder(first)
402
+        			break        			
403
+        		
404
+       		
405
+        		case "BTCreateProject|"
406
+        			Output$=System$("rm -r "+ProjectFolderTemp$)
407
+        			Output$=System$("mkdir "+ProjectFolderTemp$)
408
+        			Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/backgrounds")
409
+        			Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/objects")
410
+        			COLUMNBOX CLEAR "CBBG"
411
+        			COLUMNBOX CLEAR "CBOB"
412
+        			
413
+        			PlaygroundSize_Rows = SPINCONTROL GET "SCPlaygroundSizeY"        			
414
+        			PlaygroundSize_Cols = SPINCONTROL GET "SCPlaygroundSizeX"
415
+        			
416
+        			TileSize_x = SPINCONTROL GET "SCTileSizeX"
417
+        			TileSize_y = SPINCONTROL GET "SCTileSizeY"        		
418
+        				
419
+        			//Result_x= VIEW GET "VIEditor", "Width"
420
+        		//	Result_y= VIEW GET "VIEditor", "Height"
421
+        		//	SCROLLBAR SET "SBEditor", "Horizontal Range", 0,(PlaygroundSize_Cols*TileSize_y)-Result_x
422
+        		//	SCROLLBAR SET "SBEditor", "Vertical Range", 0,(PlaygroundSize_Rows*TileSize_x)-Result_y
423
+        			
424
+			DRAW FLUSH "VIEditor"
425
+						
426
+        			STACKVIEW SET "SVCreateProject",2
427
+        			OPTION SET "SCPlaygroundSizeX", "Focus", true
428
+        			OPTION SET "SCPlaygroundSizeY", "Focus", true
429
+        			OPTION SET "SCTileSizeX", "Focus", true
430
+        			OPTION SET "SCTileSizeY", "Focus", true
431
+        			STATUSBAR SET "SBCreateProject", "Catching data...", "", 20
432
+        		
433
+        			ProjectName$=TEXTCONTROL GET$ "TCProjectName"
434
+        			
435
+         			STATUSBAR SET "SBCreateProject", "Catching data...", "", 40        			
436
+        			
437
+        			if(trim$(ProjectName$)="")then
438
+        				STATUSBAR SET "SBCreateProject", "Error", "", 0
439
+        				ALERT "You need to define a project name first!", "Ok", "warning"
440
+        			else
441
+        				STATUSBAR SET "SBCreateProject", "Generating playground...", "", 50
442
+        				PlayGround()                 		
443
+                      		
444
+                      		STATUSBAR SET "SBCreateProject", "Ready", "", 100
445
+        				wait 1
446
+        				STACKVIEW SET SVPlaygtoundED$,2
447
+        			endif        	
448
+        			STACKVIEW SET "SVCreateProject",1		
449
+        			break        			
450
+                        
451
+                case "CBBG:_Select:"+PartThree$+"|"
452
+                		//OPTION SET "TCInput", "Enabled", false
453
+                	     OPTION SET "CBBG", "Focus", true
454
+                	     SelectedObject=val(PartThree$)
455
+                	     
456
+                        if (TileSize_x =0 ) then
457
+                        else
458
+                              //ItemBG$ = COLUMNBOX GET$ "CBBG", 1, val(PartThree$)
459
+                              // ItemBG$=mid$(ItemBG$, 10)
460
+                              ItemBG$="BG"+str$(SelectedObject)
461
+                                
462
+                                BITMAP REMOVE "DrawBG"
463
+                                //BITMAP REMOVE "DrawOB"
464
+                                //BITMAP REMOVE "DrawSW"
465
+                                
466
+                                BITMAP TileSize_x, TileSize_y, "DrawBG"
467
+       			    //BITMAP TileSize_x, TileSize_y, "DrawOB"
468
+      	 		    //BITMAP TileSize_x, TileSize_y, "DrawSW"
469
+      	 		                              
470
+                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
471
+                                SelectedCB$=PartOne$
472
+                        endif
473
+                        break
474
+                        
475
+                case "CBOB:_Select:"+PartThree$+"|"
476
+                		//OPTION SET "TCInput", "Enabled", false
477
+                	     OPTION SET "CBOB", "Focus", true
478
+                	     SelectedObject=val(PartThree$)
479
+                        if (TileSize_x =0 ) then
480
+                        else
481
+                        
482
+                                //ItemOB$ = COLUMNBOX GET$ "CBOB", 1, val(PartThree$)
483
+                                //ItemOB$=mid$(ItemOB$, 10)
484
+                                ItemOB$="OB"+str$(SelectedObject)
485
+                                //BITMAP REMOVE "DrawBG"
486
+                                BITMAP REMOVE "DrawOB"
487
+                                //BITMAP REMOVE "DrawSW"
488
+                                
489
+                                //BITMAP TileSize_x, TileSize_y, "DrawBG"
490
+       			    BITMAP TileSize_x, TileSize_y, "DrawOB"
491
+      	 		    //BITMAP TileSize_x, TileSize_y, "DrawSW"
492
+                                
493
+                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
494
+                                SelectedCB$=PartOne$
495
+                        endif                           
496
+                        break                   
497
+                   
498
+                   case "CBSW:_Select:"+PartThree$+"|"
499
+                   	//OPTION SET "TCInput", "Enabled", false
500
+                	     	OPTION SET "CBSW", "Focus", true
501
+                	    	SelectedObject=val(PartThree$)
502
+                        	if (TileSize_x =0 ) then
503
+                        	else
504
+                        	 	//ItemSW$ = COLUMNBOX GET$ "CBSW", 1, val(PartThree$)
505
+                            	//ItemSW$=mid$(ItemSW$, 10)
506
+                            	ItemSW$="SW"+str$(SelectedObject)
507
+                                
508
+                            	//BITMAP REMOVE "DrawBG"
509
+                            	//BITMAP REMOVE "DrawOB"
510
+                            	BITMAP REMOVE "DrawSW"
511
+                                
512
+                            	//BITMAP TileSize_x, TileSize_y, "DrawBG"
513
+       			    	//BITMAP TileSize_x, TileSize_y, "DrawOB"
514
+      	 		    	BITMAP TileSize_x, TileSize_y, "DrawSW"
515
+      	 		    
516
+                                	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
517
+                                	SelectedCB$=PartOne$
518
+                        	endif                           
519
+                        	break    
520
+                        
521
+                   case "TCInput|"     
522
+ 		case "BTSetDescription|"
523
+ 			Description$= TEXTCONTROL GET$ "TCInput"
524
+ 			print Description$
525
+ 			if(SelectedCB$="CBBG")then
526
+ 			ReadFolderObjects()
527
+ 				ATTRIBUTE SET "String", "PGED:DESC", Description$, BGFolder$+"/"+ItemBG$
528
+ 				COLUMNBOX ADD "CBBG", 2, SelectedObject, 20, Description$
529
+ 			elseif(SelectedCB$="CBOB")then
530
+ 				ATTRIBUTE SET "String", "PGED:DESC", Description$, OBFolder$+"/"+ItemOB$
531
+ 				COLUMNBOX ADD "CBOB", 2, SelectedObject, 20, Description$
532
+ 			elseif(SelectedCB$="CBSW")then
533
+ 				ATTRIBUTE SET "String", "PGED:DESC", Description$, SWFolder$+"/"+ItemSW$
534
+ 				COLUMNBOX ADD "CBSW", 2, SelectedObject, 20, Description$
535
+ 			endif
536
+ 			OPTION SET "TCInput", "Enabled", false
537
+ 			OPTION SET "BTSetDescription", "Enabled", false
538
+ 			break      			
539
+ 			
540
+ 		case "BTSave|" 			
541
+ 		print ProjectFolder$+"/"+ProjectName$+".zip"
542
+ 			if(IfExists(ProjectFolder$+"/"+ProjectName$+".zip")) then
543
+				Output$=System$("rm -r "+ProjectFolder$+"/"+ProjectName$+".zip")
544
+			endif
545
+			WriteProjectInfo()
546
+ 			WritePlaygroundInfo() 		
547
+ 			Output$=System$("zip -r9yu "+ProjectFolder$+"/"+ProjectName$+" "+ProjectFolderTemp$)
548
+ 			LoadProjects()
549
+ 			break     
550
+ 			
551
+		case "BTExport|"
552
+ 			STACKVIEW SET SVPlaygroundED$,4		
553
+ 			break
554
+		case "BTBack|"
555
+ 			STACKVIEW SET "VIUserMenu",1
556
+ 			STACKVIEW SET SVPlaygtoundED$,1
557
+ 			break    
558
+ 		case "BTBack2|"
559
+ 				SelectedAlert = ALERT "Do you really want to leave this project?\nHave you saved the last stand?", "Cancel", "", "Ok", "warning"	
560
+ 				//print SelectedAlert
561
+ 				wait 2
562
+ 				if(SelectedAlert=2)then
563
+ 					COLUMNBOX CLEAR "CBBackgroundsFolder"
564
+					COLUMNBOX CLEAR "CBObjectsFolder" 
565
+					STACKVIEW SET "VIUserMenu",1
566
+ 					STACKVIEW SET SVPlaygtoundED$,1					
567
+ 				else
568
+ 				endif 			
569
+ 			break    
570
+ 		case "BTRefresh|"
571
+ 			ReadFolderSystem()
572
+ 		break	
573
+ 		//About
574
+ 		
575
+ 		case "BTAbout|"
576
+ 			OPTION SET "BTAbout", "Enabled", 0 
577
+ 			PreviewStack = STACKVIEW GET SVPlaygtoundED$
578
+ 			STACKVIEW SET SVPlaygtoundED$,3
579
+ 			break
580
+ 		case "BTClose|"
581
+ 			OPTION SET "BTAbout", "Enabled", 1  
582
+ 			STACKVIEW SET SVPlaygtoundED$,PreviewStack
583
+ 			break	
584
+ 		//Export	"BTAbout"
585
+
586
+ 			
587
+ 		case "CBPreviewPicture:"+PartTwo$+"|"
588
+ 			if(PartTwo$="ON")then
589
+ 				ExportPreviewImage=1
590
+ 			else
591
+ 				ExportPreviewImage=0
592
+ 			endif
593
+ 			break
594
+ 			
595
+ 		case "LBExport:_Select:"+PartThree$+"|"
596
+ 		case "LBExport:_Invoke:"+PartThree$+"|"
597
+ 			option set "BTExportPlayground", "enabled", true
598
+ 			option set "CBPreviewPicture", "enabled", true
599
+  			if(PartThree$="1")then
600
+  				Type$="BG"
601
+  			elseif(PartThree$="2")then
602
+  				Type$="BGOB"
603
+  			elseif(PartThree$="3")then
604
+  				Type$="BGSW"
605
+  			elseif(PartThree$="4")then
606
+  				Type$="BGOBSW"
607
+  			elseif(PartThree$="5")then
608
+  				Type$="OB"
609
+  			elseif(PartThree$="6")then
610
+  				Type$="OBSW"
611
+  			elseif(PartThree$="7")then
612
+  				Type$="SW"
613
+  			endif
614
+ 			break
615
+ 		
616
+ 		case "BTExportPlayground|" 			
617
+ 			option set "BTExportPlayground", "enabled", false
618
+ 			option set "BTExportBack", "enabled", false
619
+ 			option set "CBPreviewPicture", "enabled", false
620
+ 			STACKVIEW SET "SVExportProject",2
621
+ 			if(ExportPreviewImage=1)then
622
+ 				playground_preview_export()
623
+ 			endif
624
+ 			PlaygroundExport()	
625
+ 			option set "BTExportBack", "enabled", true
626
+ 			STATUSBAR SET "SBExportProject", "Export project data...", "", 0
627
+ 			STACKVIEW SET "SVExportProject",1
628
+ 			break
629
+ 			
630
+ 		case "BTExportBack|"
631
+ 			STACKVIEW SET SVPlaygroundED$,2	
632
+ 			break
633
+ 		
634
+ 		//Tilesets
635
+  		
636
+        		case "BTTiles|"
637
+        			STACKVIEW SET SVPlaygroundED$,5
638
+        			ReadFolderBackgrounds()
639
+			ReadFolderObjects()
640
+        			break
641
+        		
642
+        		case "CBSystemFolder:_Select:"+PartThree$+"|"
643
+        			option set "BTAddBackground", "enabled", true
644
+                        	option set "BTRemoveBackground", "enabled", false
645
+                        	option set "BTAddObject", "enabled", true
646
+                        	option set "BTRemoveObject", "enabled", false
647
+        			SystemFolderItem$ = COLUMNBOX GET$ "CBSystemFolder", 2, val(PartThree$)
648
+        			break
649
+        			
650
+        			
651
+        		case "CBSystemFolder:_Invoke:"+PartThree$+"|"
652
+        			option set "BTAddBackground", "enabled", false
653
+                        	option set "BTRemoveBackground", "enabled", false
654
+                        	option set "BTAddObject", "enabled", false
655
+                        	option set "BTRemoveObject", "enabled", false
656
+        			SystemFolderItem$ = COLUMNBOX GET$ "CBSystemFolder", 2, val(PartThree$)
657
+        			if(IfDirectory(CurrentFolderSystem$+"/"+SystemFolderItem$))then
658
+        			
659
+        			else
660
+        				LAUNCH CurrentFolderSystem$+"/"+SystemFolderItem$
661
+        			endif
662
+        			break
663
+        		
664
+        		case "CBBackgroundsFolder:_Select:"+PartThree$+"|"
665
+        			option set "BTAddBackground", "enabled", false
666
+                        	option set "BTRemoveBackground", "enabled", true
667
+                        	option set "BTAddObject", "enabled", false
668
+                        	option set "BTRemoveObject", "enabled", false
669
+        			break        		
670
+        		
671
+        		case "CBBackgroundsFolder:_Invoke:"+PartThree$+"|"
672
+        			option set "BTAddBackground", "enabled", false
673
+                        	option set "BTRemoveBackground", "enabled", false
674
+                        	option set "BTAddObject", "enabled", false
675
+                        	option set "BTRemoveObject", "enabled", false
676
+        			BackgroundsFolderItem$ = COLUMNBOX GET$ "CBBackgroundsFolder", 2, val(PartThree$)
677
+        			LAUNCH BGFolder$+"/"+BackgroundsFolderItem$
678
+        			break
679
+        		
680
+        		case "CBObjectsFolder:_Select:"+PartThree$+"|"
681
+        			option set "BTAddBackground", "enabled", false
682
+                        	option set "BTRemoveBackground", "enabled", false
683
+                        	option set "BTAddObject", "enabled", false
684
+                        	option set "BTRemoveObject", "enabled", true
685
+        			break        
686
+        		
687
+        		case "CBObjectsFolder:_Invoke:"+PartThree$+"|"
688
+        			option set "BTAddBackground", "enabled", false
689
+                        	option set "BTRemoveBackground", "enabled", false
690
+                        	option set "BTAddObject", "enabled", false
691
+                        	option set "BTRemoveObject", "enabled", false
692
+        			ObjectsFolderItem$ = COLUMNBOX GET$ "CBObjectsFolder", 2, val(PartThree$)
693
+        			LAUNCH  OBFolder$+"/"+ObjectsFolderItem$
694
+        			break
695
+        		
696
+        		case "BTAddBackground|"
697
+        			print "BG"
698
+        			CBBackgroundCount = COLUMNBOX COUNT "CBBackgroundsFolder"
699
+        			output$=system$("cp -r "+CurrentFolderSystem$+"/"+SystemFolderItem$+" "+BGFolder$+"/BG"+str$(CBBackgroundCount+1))
700
+        			ATTRIBUTE SET "String", "PGED:DESC", "", BGFolder$+"/BG"+str$(CBBackgroundCount+1)
701
+ 			
702
+ 			ReadFolderBackgrounds()
703
+        			break
704
+        			
705
+        		case "BTAddObject|"
706
+        			print "OB"
707
+        			CBObjectsCount = COLUMNBOX COUNT "CBObjectsFolder"
708
+        			output$=system$("cp -r "+CurrentFolderSystem$+"/"+SystemFolderItem$+"  "+OBFolder$+"/OB"+str$(CBObjectsCount+1))
709
+        			ATTRIBUTE SET "String", "PGED:DESC", "", OBFolder$+"/OB"+str$(CBObjectsCount+1)
710
+        			ReadFolderObjects()
711
+        			break
712
+        			
713
+        		case "BTRemoveBackground|"
714
+        			BackgroundsFolderItem$ = COLUMNBOX GET$ "CBBackgroundsFolder", 2, val(PartThree$)
715
+        			output$=system$("rm -r "+BGFolder$+"/"+BackgroundsFolderItem$)
716
+        			ReadFolderBackgrounds()
717
+        			break
718
+        		
719
+        		case "BTRemoveObject|"
720
+        			ObjectssFolderItem$ = COLUMNBOX GET$ "CBObjectsFolder", 2, val(PartThree$)
721
+        			output$=system$("rm -r  "+OBFolder$+"/"+ObjectssFolderItem$)
722
+        			ReadFolderObjects()
723
+        			break
724
+        			
725
+        		case "BTBackToEditor|"
726
+                		first=0	
727
+			BGFolder(first)
728
+      			OBFolder(first)
729
+      			first=1
730
+        			STACKVIEW SET SVPlaygroundED$,2
731
+        			break
732
+                       
733
+        default:
734
+        break
735
+        end switch
736
+        
737
+        wait 0.05
738
+        
739
+        mmsg$ = MOUSE MESSAGE$
740
+        if (mmsg$<>"" and mmsg$<>old_mmsg$) then
741
+                //print mmsg$
742
+                old_mmsg$= mmsg$ 
743
+                nx = split(mmsg$, mouse$(), ":")
744
+                Viewname$=mouse$(1)
745
+                Xmouse  = val(mouse$(2))
746
+                Ymouse  = val(mouse$(3))
747
+                BLmouse = val(mouse$(4))
748
+                BCmouse= val(mouse$(5))
749
+                BRmouse= val(mouse$(6))
750
+	      Array_Col=int(Xmouse/TileSize_x)
751
+                Array_Row=int(Ymouse/TileSize_y)
752
+         endif
753
+         if(Viewname$="CBBG" AND BRmouse=1 AND PartTwo$="_Select")then         		
754
+         		OPTION SET "BGList", "Focus", true
755
+         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "BGList"  
756
+         		
757
+         		if(PopUpSelected$="Edit description")then
758
+         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", BGFolder$+"/"+ItemBG$
759
+         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
760
+         		else
761
+         		       	TEXTCONTROL SET "TCInput", "Enter description"
762
+         		endif
763
+         		OPTION SET "TCInput", "Enabled", true
764
+         		OPTION SET "BTSetDescription", "Enabled", true
765
+         		
766
+     
767
+         	elseif(Viewname$="CBOB" AND BRmouse=1 AND PartTwo$="_Select")then   
768
+         		OPTION SET "OBList", "Focus", true      		
769
+         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "OBList"    
770
+         		
771
+         		if(PopUpSelected$="Edit description")then
772
+         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", OBFolder$+"/"+ItemOB$
773
+         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
774
+         		else
775
+         			TEXTCONTROL SET "TCInput", "Enter description"
776
+         		endif
777
+         		
778
+         		OPTION SET "TCInput", "Enabled", true
779
+         		OPTION SET "BTSetDescription", "Enabled", true
780
+         	elseif(Viewname$="CBSW" AND BRmouse=1)then         		
781
+         		OPTION SET "SWList", "Focus", true
782
+         		PopUpSelected$=POPUPMENU Xmouse,Ymouse, "Add description|--|Edit description", "SWList"       	
783
+         		
784
+         		if(PopUpSelected$="Edit description")then
785
+         			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", SWFolder$+"/"+ItemSW$
786
+         			TEXTCONTROL SET "TCInput", AttributeInfo$ 
787
+         		else
788
+         			TEXTCONTROL SET "TCInput", "Enter description"
789
+         		endif
790
+         		
791
+         		OPTION SET "TCInput", "Enabled", true	
792
+         		OPTION SET "BTSetDescription", "Enabled", true
793
+         endif
794
+        if(Viewname$="VIEditor")then
795
+          if( Array_Col>PlaygroundSize_Cols AND Array_Row>PlaygroundSize_Rows OR Array_Col>PlaygroundSize_Cols OR Array_Row>PlaygroundSize_Rows) then
796
+                else
797
+                if (BLmouse=1) then
798
+                
799
+                        //DRAW SET "highColor", 0,255,0, "VIEditor"
800
+                        //DRAW SET false, "HighSolidFill"
801
+                        //print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)+TileSize_x-2
802
+                        //draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
803
+                      
804
+                      dim elements$(1)						//Hintergrund
805
+                       if(SelectedCB$="CBBG")then
806
+                        		if(Playground$(Array_Row,Array_Col)="")then
807
+                        			Playground$(Array_Row,Array_Col)="BG"+str$(SelectedObject)+":OB0:SW0"
808
+                        			//print Playground$(Array_Row,Array_Col)
809
+                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1,"DrawBG", "copy", "VIEditor"
810
+                        		else
811
+                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
812
+                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
813
+                        			//ItemBG$=elements$(1)		//Wird beim Selektieren bestimmt
814
+                        			ItemOB$=elements$(2)
815
+                        			ItemSW$=elements$(3)
816
+                        			
817
+               			
818
+                        			//ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/BG"+str$(SelectedObject), "DrawBG"
819
+                        			 
820
+                        			Playground$(Array_Row,Array_Col)="BG"+str$(SelectedObject)+":"+ItemOB$+":"+ItemSW$
821
+                        			//print Playground$(Array_Row,Array_Col)
822
+                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1,"DrawBG", "alpha", "VIEditor"
823
+                        			 
824
+                        			 if(ItemOB$="OB0")then                        			 	
825
+                        			 else
826
+                        			 	//BITMAP REMOVE "DrawOB"
827
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawOB"
828
+                               			
829
+                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
830
+                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
831
+                        			 endif
832
+                        			 
833
+                        			 if(ItemSW$="SW0")then
834
+                        			 else
835
+                        			 	//BITMAP REMOVE "DrawSW"
836
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawSW"
837
+                        			 	
838
+                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
839
+                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"    
840
+                        			 endif                         			  
841
+                        		endif
842
+                  	
843
+                        elseif(SelectedCB$="CBOB")then            				//Objekt
844
+                        		if(Playground$(Array_Row,Array_Col)="")then
845
+                        			Playground$(Array_Row,Array_Col)="BG0:OB"+str$(SelectedObject)+":SW0"
846
+                        			//print Playground$(Array_x,Array_y)
847
+                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
848
+                        		else
849
+                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
850
+                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
851
+                        			//print "Count Entries:"+str$(count_entries)
852
+                        			ItemBG$=elements$(1)
853
+                        			//ItemOB$=elements$(2)			//Wird beim Selektieren bestimmt
854
+                        			ItemSW$=elements$(3)
855
+                        			
856
+                        			
857
+                        			if(ItemBG$="BG0")then
858
+                        			//	 draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
859
+                        			else
860
+                        				//BITMAP REMOVE "DrawBG"
861
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawBG"
862
+                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
863
+                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawBG", "alpha", "VIEditor"
864
+                        			endif
865
+                        			
866
+                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
867
+                        			 
868
+                        			 if(ItemSW$="SW0")then
869
+                        			 else
870
+                        			 	//BITMAP REMOVE "DrawSW"
871
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawSW"
872
+                        			 	
873
+                        			 	ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, SWFolder$+"/"+ItemSW$, "DrawSW"
874
+                        			 	DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"           
875
+                        			 endif
876
+                        			Playground$(Array_Row,Array_Col)=ItemBG$+":OB"+str$(SelectedObject)+":"+ItemSW$
877
+                        			//print Playground$(Array_Row,Array_Col)                              			    			
878
+                        		endif
879
+                         elseif(SelectedCB$="CBSW")then            				//Schalter
880
+                         	
881
+                        		if(Playground$(Array_Row,Array_Col)="")then
882
+                        			Playground$(Array_Row,Array_Col)="BG0:OB0:SW"+str$(SelectedObject)
883
+                        			
884
+                        			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20,"DrawSW", "alpha", "VIEditor"
885
+                        		else
886
+                        			//draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
887
+                        			count_entries=split(Playground$(Array_Row,Array_Col), elements$(), ":")
888
+                        			//print "Count Entries:"+str$(count_entries)
889
+                        			ItemBG$=elements$(1)
890
+                        			ItemOB$=elements$(2)
891
+                        			//ItemSW$=elements$(3)		//Wird beim Selektieren bestimmt
892
+                        			
893
+                        			if(ItemBG$="BG0")then
894
+                        				 //draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
895
+                        			else
896
+                        				//BITMAP REMOVE "DrawBG"
897
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawBG"
898
+                        			 	
899
+                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+ItemBG$, "DrawBG"
900
+                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawBG", "alpha", "VIEditor"
901
+                        			endif
902
+                        			
903
+                        			if(ItemOB$="OB0")then
904
+                        			else
905
+                        				//BITMAP REMOVE "DrawOB"
906
+                        			 	//BITMAP TileSize_x, TileSize_y, "DrawOB"                        			 	
907
+                        				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+ItemOB$, "DrawOB"
908
+                        				DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
909
+                        			endif
910
+                        			 
911
+                        			Playground$(Array_Row,Array_Col)=ItemBG$+":"+ItemOB$+":SW"+str$(SelectedObject)
912
+                        			//print Playground$(Array_x,Array_y)    
913
+                          			DRAW BITMAP (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-20,(Array_Row*TileSize_y)+TileSize_y-20, "DrawSW", "alpha", "VIEditor"                    			
914
+                        		endif                   
915
+                        endif                
916
+                       
917
+                endif
918
+                if (BRmouse=1) then
919
+                        DRAW SET "highColor", 0,0,0, "VIEditor"
920
+                        DRAW SET false, "HighSolidFill"
921
+                       // print "löschen"
922
+                        //print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)-2
923
+                        Playground$(Array_Row,Array_Col)=""
924
+                        draw rect (Array_Col*TileSize_x)+1,(Array_Row*TileSize_y)+1 to (Array_Col*TileSize_x)+TileSize_x-1,(Array_Row*TileSize_y)+TileSize_y-1 ,"VIEditor"
925
+                endif
926
+                endif
927
+        endif
928
+        switch (casestring$)
929
+                
930
+        end switch
931
+
932
+        
933
+        if(window count<1) inloop = false
934
+        sleep 0.05
935
+wend
936
+//******************* Spielfeld  ************************************
937
+sub PlayGround()
938
+ //******************* Spielfeldarray leeren ************************************
939
+ 	dim Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)
940
+ 	for x=0 to PlaygroundSize_Rows-1
941
+		for y=0 to PlaygroundSize_Cols-1
942
+			Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)=""
943
+		next y
944
+	next x
945
+//******************* Loesche Spielfeld ************************************
946
+	DRAW FLUSH "VIEditor"
947
+//******************* Setze Farben neu und erstelle Grid ************************************
948
+	DRAW SET "highColor", 255,0,0, "VIEditor"
949
+         	DRAW SET true, "HighSolidFill"
950
+         	print PlaygroundSize_Rows
951
+	print	PlaygroundSize_Cols
952
+         for x=1 to PlaygroundSize_Rows
953
+		for y=1 to PlaygroundSize_Cols
954
+			draw rect 0*y,0*x to TileSize_y*y,TileSize_x*x ,"VIEditor"
955
+		next y
956
+	next x
957
+//******************* erstelle Scrollbar Spielfeld ************************************
958
+	wait 1
959
+ 	STATUSBAR SET "SBOpenProject", "Generating playground...", "", 55
960
+ 	x=0
961
+ 	y=0
962
+	ViewBreite=VIEW GET "VIEditor", "Width"
963
+  	ViewHoehe=VIEW GET "VIEditor", "Height"
964
+  	SCROLLBAR SET "SBEditor", "Horizontal Range", 0,(PlaygroundSize_Cols*TileSize_y)-ViewBreite
965
+        	SCROLLBAR SET "SBEditor", "Vertical Range", 0,(PlaygroundSize_Rows*TileSize_x)-ViewHoehe
966
+	PlaygroundSize_Rows = PlaygroundSize_Rows-1        
967
+   	PlaygroundSize_Cols = PlaygroundSize_Cols-1             		
968
+	STATUSBAR SET "SBOpenProject", "Generating playground...", "", 75
969
+end sub
970
+//******************* Zeichne Spielfeld  ************************************
971
+sub draw_playground()
972
+	local row,col
973
+	col=0
974
+	row=0
975
+	//print "Playground: "+Playground$(0,0)
976
+	for row=0 to PlaygroundSize_Rows //Male pro Reihe
977
+		for col=0 to PlaygroundSize_Cols //Male pro Zeile
978
+			BITMAP REMOVE "DrawBG"
979
+			BITMAP REMOVE "DrawOB"
980
+			BITMAP REMOVE "DrawSW"
981
+			BITMAP TileSize_x, TileSize_y, "DrawBG"
982
+			BITMAP TileSize_x, TileSize_y, "DrawOB"
983
+ 			BITMAP TileSize_x, TileSize_y, "DrawSW"
984
+      	 		                              
985
+      	 		//print left$(Playground$(row,col),3)                       
986
+      	 		//print mid$(Playground$(row,col),5,3)
987
+      	 		//print mid$(Playground$(row,col),9,3)      
988
+      	 		
989
+		         ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+left$(Playground$(row,col),3), "DrawBG"
990
+			ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+mid$(Playground$(row,col),5,3), "DrawOB"
991
+			ErrCode = DRAW IMAGE 0,0 to  TileSize_x-20, TileSize_y-20, SWFolder$+"/"+mid$(Playground$(row,col),9,3),"DrawSW"
992
+			//print col*TileSize_x
993
+			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawBG", "alpha", "VIEditor"   //Spalte, dann Reihe
994
+			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawOB", "alpha", "VIEditor"  //Spalte, dann Reihe
995
+			DRAW BITMAP (col*TileSize_x),(row*TileSize_y) to (col*TileSize_x)+TileSize_x,(row*TileSize_y)+TileSize_y, "DrawSW", "alpha", "VIEditor"  //Spalte, dann Reihe     
996
+			//print str$(col*TileSize_x)+","+str$(row*TileSize_y) +" to "+ str$(((col*TileSize_x)+TileSize_x))+","+str$(((row*TileSize_y)+TileSize_y))+" : "+Playground$(row,col)+" :"+str$(row)+":"+str$(col)
997
+       		next col
998
+       		col=0
999
+       	next row
1000
+       
1001
+end sub
1002
+//******************* Projekte laden  ************************************
1003
+sub LoadProjects()
1004
+	LISTBOX CLEAR "LBProjects"
1005
+	Projects$=system$("ls -G -1 "+ProjectFolder$)
1006
+      	dim SplitDirProjects$(1) 
1007
+         		files = split(Projects$, SplitDirProjects$(), "\n")            
1008
+         		for pjf = 1 to files-1
1009
+         			projectnamelen=len(SplitDirProjects$(pjf))
1010
+         			LISTBOX ADD "LBProjects", left$(SplitDirProjects$(pjf), projectnamelen-4) 
1011
+         		next pjf
1012
+end sub    
1013
+//******************* Ueberpruefe Spielfeld auf Inhalt groesser 0  ************************************
1014
+sub TestePlayGroundFile()
1015
+	Result$=trim$(system$("stat -c %s "+ProjectFolderTemp$+"/playground.info"))
1016
+	if (Result$="0") then		
1017
+		Alert "The playground file is empty. Please generate a new one.", "Ok", "STOP"
1018
+		STACKVIEW SET "VIUserMenu",1
1019
+ 		STACKVIEW SET SVPlaygtoundED$,1 		
1020
+	else	
1021
+		LoadPlayGround()
1022
+	endif
1023
+end sub
1024
+
1025
+//******************* Lade Spielfeld  ************************************
1026
+sub LoadPlayGround()
1027
+	local playground_info_entry$
1028
+	local row,col, numElements
1029
+	playground_info_entry$=""
1030
+	numElements=0
1031
+
1032
+	//readout=open(ProjectFolderTemp$+"/playground.info", "r")
1033
+	//while (not EOF(readout))		
1034
+	//	line input #readout playground_info_entry$
1035
+	//	redim file_rows$(1)
1036
+	//	redim elements$(1)
1037
+	//
1038
+	//	quantity_token=len(playground_info_entry$)
1039
+	//	numElements_rows = split(playground_info_entry$, file_rows$(),"\n")
1040
+		
1041
+	//	if (numElements_rows=1) then
1042
+	//		file_row=file_row+1
1043
+	//		print 	file_row
1044
+	//	endif				
1045
+	//	numElements = split(left$(playground_info_entry$,len(playground_info_entry$)-1), elements$(),"|")
1046
+	//	if (numElements>=1) then
1047
+	//		file_cols=file_cols+1	
1048
+				
1049
+	//	endif		
1050
+	//wend
1051
+	//close(readout)	
1052
+	//print "file_row:"+str$(file_row)
1053
+	//print "file_cols:"+str$(file_cols)
1054
+	//print	 "-rows-"+str$(PlaygroundSize_Rows)
1055
+	//print	 "-cols-"+str$(PlaygroundSize_Cols)
1056
+	dim Playground$(PlaygroundSize_Rows,PlaygroundSize_Cols)
1057
+	readoutA=open(ProjectFolderTemp$+"/playground.info", "r")	
1058
+	col=0
1059
+	cols=0
1060
+	row=0
1061
+	
1062
+	while (not EOF(readoutA))
1063
+		dim elements$(1)
1064
+		line input #readout playground_info_entry$
1065
+		numElements = split(left$(playground_info_entry$,len(playground_info_entry$)-1), elements$(),"|")
1066
+		if (numElements=0) then
1067
+		else
1068
+			
1069
+			for cols =1 to numElements
1070
+				//if (cols<numElements+1) then
1071
+				print cols
1072
+				print elements$(cols)				
1073
+					Playground$(row,col) = elements$(cols)
1074
+					print "Playground: "+str$(row)+":"+str$(col)+":"+elements$(cols) //Playground$(row,col)
1075
+					col=col+1
1076
+				//else					
1077
+				//endif
1078
+			next cols	
1079
+			col=0
1080
+		row=row+1				
1081
+		endif
1082
+	wend
1083
+	close(readoutA)	
1084
+end sub
1085
+
1086
+//******************* Schreibe Projekt File  ************************************
1087
+sub WriteProjectInfo()
1088
+	writefile = open(ProjectFolderTemp$+"/project.info", "w") 		
1089
+ 	
1090
+ 	print #writefile "ProjectName:"+ProjectName$	
1091
+ 	print #writefile "Playground_Rows:"+str$(PlaygroundSize_Rows+1)		// +1 da der Array mit 0 beginnt
1092
+ 	print #writefile "Playground_Cols:"+str$(PlaygroundSize_Cols+1)		// +1 da der Array mit 0 beginnt
1093
+ 	print #writefile "TileSizeX:"+str$(TileSize_x)
1094
+ 	print #writefile "TileSizeY:"+str$(TileSize_y)
1095
+ 				
1096
+ 	CountCBBG = COLUMNBOX COUNT "CBBG"
1097
+ 	i=0
1098
+ 	for i = 1 to CountCBBG
1099
+ 		CBBGItem$ = COLUMNBOX GET$ "CBBG", 2, i
1100
+ 		print #writefile "BG"+str$(i)+":"+CBBGItem$
1101
+ 	next i
1102
+ 	CountCBOB = COLUMNBOX COUNT "CBOB"
1103
+ 	i=0
1104
+ 	for i = 1 to CountCBOB
1105
+ 		CBOBItem$ = COLUMNBOX GET$ "CBOB", 2, i
1106
+ 		print #writefile "OB"+str$(i)+":"+CBOBItem$
1107
+ 	next i
1108
+ 	CountCBSW = COLUMNBOX COUNT "CBSW"
1109
+ 	i=0
1110
+ 	for i = 1 to CountCBSW
1111
+ 		CBSWItem$ = COLUMNBOX GET$ "CBSW", 2, i
1112
+ 		print #writefile "SW"+str$(i)+":"+CBSWItem$
1113
+ 	next i
1114
+	close(writefile)
1115
+end sub
1116
+//******************* Schreibe Spielfeld ************************************
1117
+sub WritePlaygroundInfo()			
1118
+	//print PlaygroundSize_Rows
1119
+	//print PlaygroundSize_Cols
1120
+	//write playground field text file
1121
+	writefile = open(ProjectFolderTemp$+"/playground.info", "w")
1122
+	i=0
1123
+	run_x=0
1124
+	run_y=0
1125
+	LineEntries$=""
1126
+	//print "PlaygroundSize_Rows:"+str$(PlaygroundSize_Rows)
1127
+	//print "PlaygroundSize_Cols:"+str$(PlaygroundSize_Cols)
1128
+	for reihe = 0 to PlaygroundSize_Rows
1129
+		for spalte = 0 to PlaygroundSize_Cols
1130
+			if(Playground$(reihe,spalte)="")then
1131
+				LineEntries$=LineEntries$+"BG0:OB0:SW0|"
1132
+			else
1133
+				LineEntries$=LineEntries$+Playground$(reihe,spalte)+"|"
1134
+			endif			
1135
+		next spalte
1136
+		spalte=0
1137
+		print #writefile trim$(LineEntries$)
1138
+		//print LineEntries$
1139
+		LineEntries$=""
1140
+	next reihe
1141
+	close(writefile)
1142
+end sub
1143
+//******************* Spielfeld Export  ************************************
1144
+sub PlaygroundExport()			
1145
+	STATUSBAR SET "SBExportProject", "Export project data...", "", 10
1146
+	//write playground field text file	
1147
+	writefile = open(ProjectExport$+"/"+ProjectName$+"_"+Type$, "w")
1148
+	i=0
1149
+	run_x=0
1150
+	run_y=0
1151
+	LineEntries$=""
1152
+	STATUSBAR SET "SBExportProject", "Export project data...", "", 20	
1153
+	
1154
+	for reihe = 0 to PlaygroundSize_Rows
1155
+		for spalte = 0 to PlaygroundSize_Cols
1156
+			if(Playground$(run_x,spalte)="")then
1157
+				LineEntries$=LineEntries$+"BG0:OB0:SW0|"
1158
+			else
1159
+				if (Type$="BG") then
1160
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":"))+"|"				
1161
+				elseif (Type$="BGOB") then
1162
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":",instr(Playground$(reihe,spalte),":")+1))+"|"
1163
+				elseif (Type$="BGSW") then
1164
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),0,instr(Playground$(reihe,spalte),":"))+":"+mid$(Playground$(reihe,spalte),rinstr(Playground$(reihe,spalte),":")+1)+"|"
1165
+				elseif (Type$="OB") then
1166
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),instr(Playground$(reihe,spalte),":")+1,instr(Playground$(reihe,spalte),":")-1)+"|"
1167
+				elseif (Type$="OBSW") then
1168
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),instr(Playground$(reihe,spalte),":")+1)+"|"
1169
+				elseif (Type$="SW") then
1170
+					LineEntries$=LineEntries$+mid$(Playground$(reihe,spalte),rinstr(Playground$(reihe,spalte),":")+1)+"|"
1171
+				elseif (Type$="BGOBSW") then
1172
+					LineEntries$=LineEntries$+Playground$(reihe,spalte)+"|"
1173
+				endif
1174
+			endif
1175
+			STATUSBAR SET "SBExportProject", "Export project data...", "", 70	
1176
+		next spalte
1177
+		spalte=0
1178
+		print #writefile trim$(LineEntries$)
1179
+		//print LineEntries$
1180
+		LineEntries$=""
1181
+	next reihe			
1182
+	
1183
+	STATUSBAR SET "SBExportProject", "Export project data...", "", 100	
1184
+	close(writefile)
1185
+end sub
1186
+//******************* Spielfeld Export als Bild  ************************************
1187
+sub playground_preview_export()		
1188
+	STATUSBAR SET "SBExportProject", "Export preview image...", "", 10
1189
+	if (VIEW GET "ExportCanvas", "Exists") then
1190
+		View Remove "ExportCanvas"		
1191
+	endif
1192
+		view 0,0 to  ((PlaygroundSize_Cols+1)*TileSize_x), ((PlaygroundSize_Rows+1)*TileSize_y), "ExportCanvas", SVPlaygtoundED$+"3"
1193
+	
1194
+		H_Canvas=(VIEW GET "ExportCanvas", "Height")+1
1195
+		B_Canvas=(VIEW GET "ExportCanvas", "Width")+1
1196
+	//CANVAS 0,0 to ((PlaygroundSize_x+1)*TileSize_x), ((PlaygroundSize_y+1)*TileSize_y), "ExportBitmap","ExportCanvas"	
1197
+	STATUSBAR SET "SBExportProject", "Export preview image...", "", 20
1198
+	CANVAS 0,0 to B_Canvas,H_Canvas, "ExportBitmap","ExportCanvas"	
1199
+		//DRAW SET "BGColor", 40,40,40, "ExportCanvas"
1200
+		DRAW SET "lowColor", 0,0,0, "ExportBitmap"
1201
+		DRAW SET false, "lowSolidFill"
1202
+		DRAW RECT 0,0 to ((PlaygroundSize_Cols+1)*TileSize_x)+50, ((PlaygroundSize_Rows+1)*TileSize_y)+50, "ExportBitmap"
1203
+		DRAW SET "HighColor", 255,0,0, "ExportBitmap"
1204
+		DRAW SET true, "HighSolidFill"
1205
+         		STATUSBAR SET "SBExportProject", "Export preview image...", "", 30
1206
+         		for x=0 to PlaygroundSize_Rows+1
1207
+			for y=0 to PlaygroundSize_Cols+1
1208
+				draw rect 0*y,0*x to TileSize_y*y,TileSize_x*x ,"ExportBitmap"
1209
+			next y
1210
+		next x
1211
+		STATUSBAR SET "SBExportProject", "Export preview image...", "", 50
1212
+		for row=0 to PlaygroundSize_Rows
1213
+			for col=0 to PlaygroundSize_Cols
1214
+				BITMAP REMOVE "DrawBG"
1215
+				BITMAP REMOVE "DrawOB"
1216
+				BITMAP REMOVE "DrawSW"
1217
+				BITMAP TileSize_x, TileSize_y, "DrawBG"
1218
+				BITMAP TileSize_x, TileSize_y, "DrawOB"
1219
+ 				BITMAP TileSize_x, TileSize_y, "DrawSW"      	 		                              
1220
+      	 			ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, BGFolder$+"/"+left$(Playground$(row,col),3), "DrawBG"
1221
+				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, OBFolder$+"/"+mid$(Playground$(row,col),5,3), "DrawOB"
1222
+				ErrCode = DRAW IMAGE 0,0 to  TileSize_x-20, TileSize_y-20, SWFolder$+"/"+mid$(Playground$(row,col),9,3),"DrawSW"
1223
+				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawBG", "alpha", "ExportBitmap"   
1224
+				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawOB", "alpha", "ExportBitmap"  
1225
+				DRAW BITMAP (col*TileSize_x)-1,(row*TileSize_y)-1 to (col*TileSize_x)+(TileSize_x)-1,(row*TileSize_y)+(TileSize_y)-1, "DrawSW", "alpha", "ExportBitmap"    
1226
+			next col
1227
+			col=0
1228
+		next row
1229
+		STATUSBAR SET "SBExportProject", "Export preview image...", "", 70
1230
+		Hoehe_Canvas=(VIEW GET "ExportBitmap", "Height")
1231
+		Breite_Canvas=(VIEW GET "ExportBitmap", "Width")
1232
+		//BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
1233
+		//ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+".jpg",".jpg"
1234
+		BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
1235
+		ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+"_Preview.png",".png"
1236
+		//BITMAP GET 0, 0 to Breite_Canvas,Hoehe_Canvas, "Target_bitmap", "ExportBitmap"
1237
+		//ErrCode = BITMAP SAVE "Target_bitmap",ProjectExport$+"/"+ProjectName$+"_Preview.bmp",".bmp"
1238
+		STATUSBAR SET "SBExportProject", "Export preview image...", "", 100
1239
+end sub
1240
+//******************* Columnboxen erstellen ************************************    
1241
+//******************* Background auslesen   ************************************           
1242
+sub BGFolder(first)
1243
+	if (first=1) then
1244
+	else
1245
+		COLUMNBOX CLEAR "CBBG"
1246
+	endif	
1247
+	Files$=system$("ls -G -1 "+BGFolder$)
1248
+        	dim SplitDirObjects$(1) 
1249
+		files = split(Files$, SplitDirObjects$(), "\n")            
1250
+                	for ibg = 1 to files-1
1251
+                   	objectlen=len(SplitDirObjects$(ibg))
1252
+                   	COLUMNBOX ADD "CBBG", 1, ibg, 32, "__Icon__="+BGFolder$+"/"+SplitDirObjects$(ibg)
1253
+                       	AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC",  BGFolder$+"/"+SplitDirObjects$(ibg)		//This attribute must be included the files by adding into the program
1254
+                       	if(AttributeInfo$="")then
1255
+                       		print "no entrie"
1256
+                       	else
1257
+                            	COLUMNBOX ADD "CBBG", 2, ibg, 32, AttributeInfo$
1258
+                       	endif                        
1259
+                	next ibg
1260
+end sub
1261
+//******************* Objectfolder auslesen   ************************************     
1262
+sub OBFolder(first)
1263
+	if (first=1) then
1264
+	else
1265
+		COLUMNBOX CLEAR "CBOB"
1266
+	endif	
1267
+	Files$=system$("ls -G -1 "+OBFolder$)
1268
+	dim SplitDirObjects$(1) 
1269
+		files = split(Files$, SplitDirObjects$(), "\n")            
1270
+         		for iob = 1 to files-1
1271
+			objectlen=len(SplitDirObjects$(iob))
1272
+			COLUMNBOX ADD "CBOB", 1, iob, 32, "__Icon__="+OBFolder$+"/"+SplitDirObjects$(iob)
1273
+			AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", OBFolder$+"/"+SplitDirObjects$(iob)		//This attribute must be included the files by adding into the program
1274
+			COLUMNBOX ADD "CBOB", 2, iob, 32, AttributeInfo$   
1275
+                	next iob
1276
+end sub
1277
+//******************* Switchfolder auslesen   ************************************     
1278
+sub SWFolder(first)
1279
+	if (first=1) then
1280
+	else
1281
+		COLUMNBOX CLEAR "CBSW"
1282
+	endif	
1283
+	Files$=system$("ls -G -1 "+SWFolder$+"/")
1284
+       	dim SplitDirObjects$(1) 
1285
+		files = split(Files$, SplitDirObjects$(), "\n")            
1286
+               	for isw = 1 to files-1
1287
+                        	objectlen=len(SplitDirObjects$(isw))
1288
+                        	COLUMNBOX ADD "CBSW", 1, isw, 20, "__Icon__="+SWFolder$+"/"+SplitDirObjects$(isw)
1289
+                        	//AttributeInfo$ = ATTRIBUTE GET$ "PGED:DESC", SWFolder$+"/"+SplitDirObjects$(isw)	//This attribute must be included the files by adding into the program
1290
+ 			COLUMNBOX ADD "CBSW", 2, isw, 32, AttributeInfo$   
1291
+                	next isw
1292
+end sub      
1293
+//******************* TILES  ************************************	
1294
+//******************* Background Folder auslesen  ************************************	
1295
+sub ReadFolderBackgrounds()
1296
+	COLUMNBOX CLEAR "CBBackgroundsFolder"
1297
+	ReadFolderBackgrounds$=system$("ls -GH -1 "+BGFolder$)
1298
+         CurrentFolderBackgrounds$=BGFolder$
1299
+				
1300
+	dim ReadBackroundsFolder$(1)
1301
+		files = split(ReadFolderBackgrounds$, ReadBackroundsFolder$(), "\n")
1302
+		i=0
1303
+		x=1
1304
+		for i = 1 to files-1
1305
+			COLUMNBOX ADD "CBBackgroundsFolder", 1, x, 40, "__Path__="+CurrentFolderBackgrounds$+"/"+ReadBackroundsFolder$(i)
1306
+			COLUMNBOX ADD "CBBackgroundsFolder", 2, x, 40, ReadBackroundsFolder$(i)
1307
+			x=x+1
1308
+		next i     	
1309
+end sub
1310
+//******************* Object Folder auslesen  ************************************
1311
+sub ReadFolderObjects()
1312
+	COLUMNBOX CLEAR "CBObjectsFolder"
1313
+	ReadFolderObjects$=system$("ls -GH -1 "+OBFolder$)
1314
+         CurrentFolderObjects$=OBFolder$
1315
+		
1316
+	dim ReadFolderObjects$(1)
1317
+		files = split(ReadFolderObjects$, ReadFolderObjects$(), "\n")
1318
+		i=0
1319
+		x=1
1320
+		for i = 1 to files-1
1321
+			COLUMNBOX ADD "CBObjectsFolder", 1, x, 40, "__Path__="+CurrentFolderObjects$+"/"+ReadFolderObjects$(i)
1322
+			COLUMNBOX ADD "CBObjectsFolder", 2, x, 40, ReadFolderObjects$(i)
1323
+			x=x+1
1324
+		next i     
1325
+end sub
1326
+//******************* System Folder auslesen  ************************************
1327
+sub ReadFolderSystem()
1328
+	COLUMNBOX CLEAR "CBSystemFolder"
1329
+	  CurrentFolderSystem$="/boot/home"
1330
+	ReadFolderSystem$=system$("ls -GH -1 "+ CurrentFolderSystem$)	
1331
+	dim ReadSystemFolder$(1)
1332
+		files = split(ReadFolderSystem$, ReadSystemFolder$(), "\n")
1333
+		i=0
1334
+		x=1
1335
+		for i = 1 to files-1
1336
+			if(right$(ReadSystemFolder$(i), 3)="bmp" or right$(ReadSystemFolder$(i), 3)="gif" or right$(ReadSystemFolder$(i), 3)="jpg" or right$(ReadSystemFolder$(i), 3)="png" or right$(ReadSystemFolder$(i), 4)="jpeg" or right$(ReadSystemFolder$(i), 4)="tiff")then
1337
+				COLUMNBOX ADD "CBSystemFolder", 1, x, 40, "__Path__="+CurrentFolderSystem$+"/"+ReadSystemFolder$(i)
1338
+				COLUMNBOX ADD "CBSystemFolder", 2, x, 40, ReadSystemFolder$(i)
1339
+				x=x+1
1340
+			endif
1341
+			if(IfDirectory(CurrentFolderSystem$+"/"+ReadSystemFolder$(i)))then
1342
+				COLUMNBOX ADD "CBSystemFolder", 1, x, 40, "__Path__="+CurrentFolderSystem$+"/"+ReadSystemFolder$(i)
1343
+				COLUMNBOX ADD "CBSystemFolder", 2, x, 40, ReadSystemFolder$(i)
1344
+				x=x+1
1345
+			endif
1346
+		next i     	
1347
+end sub
1348
+//******************* teste Verzeichnis  ************************************
1349
+sub IfDirectory(filename$)
1350
+	return not system("test -d "+filename$)
1351
+end sub
1352
+//******************* teste Dateien  ************************************
1353
+//Check if a file or folder already exisits
1354
+sub IfExists(filename$)
1355
+	return not system("test -e "+filename$)
1356
+end sub     
1357
+//******************* About  ************************************
1358
+sub About()
1359
+	//View 0,0 to width_window,height_window, "View_About", SVPlaygroundED$+"3"
1360
+	View width_window/2-200,height_window/2-300 TO width_window/2+200,height_window/2+300, "View_About", SVPlaygroundED$+"3"
1361
+		//DRAW SET "BGColor", 100,100,100, SVPlaygroundED$+"3"
1362
+		
1363
+		DRAW TEXT 10,30, "BeSly Software Solutions", "View_About"
1364
+  		DRAW LINE 0,40 TO View_breite_box,41, "View_About" 
1365
+  	 	  	
1366
+  		DRAW TEXT 10,60, "Name:", "View_About"
1367
+  		DRAW TEXT 10,80, "Version / Build:", "View_About"
1368
+  		DRAW TEXT 10,100, "Version Status:", "View_About"
1369
+  		DRAW TEXT 10,120, "Developers:", "View_About"  
1370
+  		DRAW TEXT 10,140, "Contact:", "View_About"
1371
+  		DRAW TEXT 10,160, "Website:", "View_About"
1372
+  		DRAW TEXT 10,180, "Bug-Reporting:", "View_About"
1373
+  		
1374
+  		DRAW TEXT 150,60, ProgrammName$, "View_About"
1375
+  		DRAW TEXT 150,80, "0.0.1/ 24.12.2019", "View_About"
1376
+  		DRAW TEXT 150,100, "Alpha", "View_About"
1377
+  		DRAW TEXT 150,120, "Lorglas / Lelldorin", "View_About"
1378
+  		DRAW SET "system-plain,regular,16,regular,0,45" ,"View_About"
1379
+  		TEXTURL 150,130, "email", "webmaster@besly.de", "webmaster@besly.de", "View_About"  	
1380
+  		TEXTURL 150,150, "website", "http://software.besly.de", "http://software.besly.de", "View_About"   	
1381
+  		//TEXTURL 150,167, "Bug-Report", "http://trac.besly.de", "http://trac.besly.de", "View_About" 
1382
+		
1383
+		TEXTEDIT 5,220 TO 395, 500, "not_implemented", 1, "View_About"
1384
+		TEXTEDIT SET "not_implemented", "bold", "12"
1385
+		TEXTEDIT ADD "not_implemented", "The Playground Editor is a program for creating playgrounds in the form of text files.\nThis form of playing field can actually be used for any kind of game when using fixed playing fields.\n\n"
1386
+  		TEXTEDIT SET "not_implemented", "bold", "12"
1387
+  		TEXTEDIT ADD "not_implemented", "New in this Revision:\n"
1388
+  		TEXTEDIT SET "not_implemented", "plain", "12"
1389
+  		TEXTEDIT ADD "not_implemented", "None\n"
1390
+  		TEXTEDIT SET "not_implemented", "editable", false
1391
+  		//button HBPF-50, height_window-60 to HBPF+50, height_window-10, "BTClose", "Close",  "View_About"	
1392
+  		BUTTON 5,520 TO 395,560, "BTClose", "Back", "View_About"
1393
+end sub	
1394
+
0 1395
new file mode 100644
1 1396
Binary files /dev/null and b/PlaygroundEditor/2020-04-08_playgroundED.yab.zip differ
2 1397
new file mode 100644
3 1398
Binary files /dev/null and b/PlaygroundEditor/2temp.zip differ
4 1399
new file mode 100644
... ...
@@ -0,0 +1,201 @@
1
+#!/boot/home/config/bin/yab
2
+
3
+
4
+if(IfExists("/boot/home/.besly/PlaygroundED/projects")) then
5
+else
6
+	Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/projects")
7
+endif
8
+
9
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/backgrounds")) then
10
+else
11
+	Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/backgrounds")
12
+endif
13
+
14
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/objects")) then
15
+else
16
+	Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/objects")
17
+endif
18
+
19
+
20
+
21
+//Variables
22
+screenWidth = peek("desktopwidth")
23
+screenHeight = peek("desktopheight")
24
+
25
+VisibleName$="Playground Editor"
26
+
27
+
28
+WINDOW OPEN screenWidth/2-500,screenHeight/2-400 to screenWidth/2+500,screenHeight/2+400 , "playgroundED", VisibleName$
29
+	WINDOW SET  "playgroundED", "MinimumTo", 1000,800
30
+	WINDOW SET  "playgroundED", "flags", "not-zoomable, not-resizable"
31
+	
32
+	MENU "App", "About", "", "playgroundED"
33
+	SUBMENU "Settings", "Tile Size", "32x32", "", "playgroundED"
34
+	SUBMENU "Settings", "Tile Size", "64x64", "", "playgroundED"
35
+	SUBMENU "Settings", "Tile Size", "100x100", "", "playgroundED"
36
+	SUBMENU "Settings", "Tile Size", "128x128", "", "playgroundED"	
37
+	BOXVIEW 5,25 TO 695,785, "BVEditor", "Playground", 3, "playgroundED"
38
+		VIEW 5,5 to 680, 735, "VIEditor", "BVEditor"
39
+			DRAW SET "BGColor", 0,0,0, "VIEditor"
40
+		
41
+	SPLITVIEW 705,25 TO 995,530, "SVList", 0, 1, "playgroundED"
42
+		SPLITVIEW SET "SVList", "Divider", 250
43
+	
44
+	LAYOUT "Top,Bottom", "SVList1"		
45
+	BOXVIEW 0,0 TO 288,245, "BGList", "Backgrounds", 3, "SVList1"
46
+		COLUMNBOX 5,5 TO 277,220, "CBBG", 3, "", "BGList"
47
+			COLUMNBOX COLUMN "CBBG", "Tile", 1, 64, 64, 64, "align-center,"
48
+	LAYOUT "Top, Bottom", "SVList2"	
49
+	BOXVIEW 0,0 TO 288,245, "OBList", "Objects", 3, "SVList2"
50
+		COLUMNBOX 5,5 TO 277,220, "CBOB", 3, "", "OBList"
51
+			COLUMNBOX COLUMN "CBOB", "Tile", 1, 64, 64, 64, "align-center,"
52
+	
53
+	BOXVIEW 705,535 TO 995,785, "SWList", "Switches", 3, "playgroundED"
54
+	
55
+
56
+	Files$=system$("ls -G -1 /boot/home/.besly/PlaygroundED/temp/backgrounds")
57
+	dim SplitDirObjects$(1)	
58
+		files = split(Files$, SplitDirObjects$(), "\n")            
59
+		for ibg = 1 to files-1
60
+			objectlen=len(SplitDirObjects$(ibg))
61
+			COLUMNBOX ADD "CBBG", 1, ibg, 32, "__Icon__=/boot/home/.besly/PlaygroundED/temp/backgrounds/"+SplitDirObjects$(ibg)
62
+		next ibg
63
+
64
+
65
+	Files$=system$("ls -G -1 /boot/home/.besly/PlaygroundED/temp/objects")
66
+	dim SplitDirObjects$(1)	
67
+		files = split(Files$, SplitDirObjects$(), "\n")            
68
+		for iob = 1 to files-1
69
+			objectlen=len(SplitDirObjects$(iob))
70
+			COLUMNBOX ADD "CBOB", 1, iob, 32, "__Icon__=/boot/home/.besly/PlaygroundED/temp/objects/"+SplitDirObjects$(iob)
71
+		next iob
72
+		
73
+		BITMAP 32, 32, "DrawBG"
74
+		BITMAP 32, 32, "DrawOB"
75
+	
76
+				
77
+//Main Loop
78
+dim part$(1)
79
+dim mouse$(1)
80
+inloop = true
81
+while(inloop)
82
+	//General Messages
83
+	msg$ = message$
84
+	if (split(msg$, part$(), ":|") > 2) then
85
+		PartOne$=part$(1)
86
+		PartTwo$ = part$(2)
87
+		PartThree$ = part$(3)
88
+	fi
89
+	if (split(msg$, part$(), ":|") > 3) then
90
+		PartFour$ = part$(4)
91
+	fi
92
+	if (split(msg$, part$(), ":|") > 4) then
93
+		PartFife$ = part$(5)
94
+	fi
95
+	if (msg$ <> "") print msg$
96
+	
97
+	switch msg$
98
+	
99
+		//cases
100
+		case "playgroundED:_QuitRequested|"
101
+			WINDOW CLOSE "playgroundED"
102
+			break
103
+
104
+		case "playgroundED:Settings:Tile Size:"+PartFour$+"|"
105
+			DRAW FLUSH "VIEditor"
106
+			TileSize_x=val(left$(PartFour$, instr(PartFour$, "x")))
107
+			TileSize_y=val(mid$(PartFour$, instr(PartFour$, "x")+1)) 
108
+			print TileSize_x
109
+			print TileSize_y
110
+			BITMAP TileSize_x, TileSize_y, "DrawBG"
111
+			BITMAP TileSize_x, TileSize_y, "DrawOB"
112
+			
113
+			
114
+			
115
+			DRAW SET "highColor", 255,0,0, "VIEditor"
116
+			DRAW SET true, "HighSolidFill"
117
+			for x=1 to TileSize_x //(32 =Levelgröße )
118
+				for y=1 to TileSize_y //(32 =Levelgröße ) 				
119
+					draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
120
+				next y
121
+			next x
122
+			break
123
+		
124
+		case "CBBG:_Select:"+PartThree$+"|"
125
+		case "CBOB:_Select:"+PartThree$+"|"
126
+			if(PartOne$="CBBG")then
127
+				ItemBG$ = COLUMNBOX GET$ "CBBG", 1, val(PartThree$)
128
+				ItemBG$=mid$(ItemBG$, 10)
129
+				BITMAP REMOVE "DrawBG"
130
+				BITMAP TileSize_x, TileSize_y, "DrawBG"
131
+				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, ItemBG$, "DrawBG"
132
+			
133
+			elseif(PartOne$="CBOB")then
134
+				ItemOB$ = COLUMNBOX GET$ "CBOB", 1, val(PartThree$)
135
+				ItemOB$=mid$(ItemOB$, 10)
136
+				
137
+				BITMAP REMOVE "DrawOB"
138
+				BITMAP TileSize_x, TileSize_y, "DrawOB"
139
+				ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, ItemOB$, "DrawOB"
140
+			endif
141
+			SelectedCB$=PartOne$
142
+			break
143
+			
144
+			
145
+			
146
+	default:
147
+	
148
+	end switch
149
+	
150
+	wait 0.05
151
+	
152
+	mmsg$ = MOUSE MESSAGE$
153
+	if (mmsg$<>"" and mmsg$<>old_mmsg$) then
154
+		//print mmsg$
155
+		old_mmsg$= mmsg$ 
156
+		nx = split(mmsg$, mouse$(), ":")
157
+		Viewname$=mouse$(1)
158
+		Xmouse	= val(mouse$(2))
159
+		Ymouse	= val(mouse$(3))
160
+		BLmouse	= val(mouse$(4))
161
+		BCmouse= val(mouse$(5))
162
+		BRmouse= val(mouse$(6))
163
+
164
+		Array_x=int(Xmouse/TileSize_x)
165
+		Array_y=int(Ymouse/TileSize_y)
166
+		print Array_x
167
+		print Array_y
168
+	endif
169
+	if(Viewname$="VIEditor")then
170
+		if (BLmouse=1) then
171
+			//DRAW SET "highColor", 0,255,0, "VIEditor"
172
+			//DRAW SET false, "HighSolidFill"
173
+			print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)+TileSize_x-2
174
+			//draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
175
+			if(SelectedCB$="CBBG")then
176
+				DRAW BITMAP (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1, "DrawBG", "copy", "VIEditor"
177
+			elseif(SelectedCB$="CBOB")then				
178
+				DRAW BITMAP (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
179
+			endif
180
+			
181
+		endif
182
+		if (BRmouse=1) then
183
+			DRAW SET "highColor", 0,0,0, "VIEditor"
184
+			DRAW SET false, "HighSolidFill"
185
+			print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)-2
186
+			draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
187
+		endif
188
+	endif
189
+	switch (casestring$)
190
+		
191
+	end switch
192
+
193
+	
194
+	if(window count<1) inloop = false
195
+	sleep 0.05
196
+wend
197
+		
198
+//Check if a file or folder already exisits
199
+sub IfExists(filename$)
200
+     return not system("test -e "+filename$)
201
+end sub		
0 202
new file mode 100644
... ...
@@ -0,0 +1,217 @@
1
+#!/boot/home/config/bin/yab
2
+
3
+
4
+if(IfExists("/boot/home/.besly/PlaygroundED/projects")) then
5
+else
6
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/projects")
7
+endif
8
+
9
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/backgrounds")) then
10
+else
11
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/backgrounds")
12
+endif
13
+
14
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/objects")) then
15
+else
16
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/objects")
17
+endif
18
+
19
+
20
+
21
+//Variables
22
+screenWidth = peek("desktopwidth")
23
+screenHeight = peek("desktopheight")
24
+
25
+VisibleName$="Playground Editor"
26
+        BITMAP 32, 32, "DrawBG"
27
+        BITMAP 32, 32, "DrawOB"
28
+
29
+WINDOW OPEN screenWidth/2-500,screenHeight/2-400 to screenWidth/2+500,screenHeight/2+400 , "playgroundED", VisibleName$
30
+        WINDOW SET  "playgroundED", "MinimumTo", 1000,800
31
+        WINDOW SET  "playgroundED", "flags", "not-zoomable, not-resizable"
32
+        
33
+        MENU "App", "About", "", "playgroundED"
34
+        SUBMENU "Settings", "Tile Size", "32x32", "", "playgroundED"
35
+        SUBMENU "Settings", "Tile Size", "64x64", "", "playgroundED"
36
+        SUBMENU "Settings", "Tile Size", "100x100", "", "playgroundED"
37
+        SUBMENU "Settings", "Tile Size", "128x128", "", "playgroundED"  
38
+        
39
+        
40
+        
41
+        
42
+        BOXVIEW 5,25 TO 695,785, "BVEditor", "Playground", 3, "playgroundED"
43
+                VIEW 5,5 to 680, 735, "VIEditor", "BVEditor"
44
+                        DRAW SET "BGColor", 0,0,0, "VIEditor"
45
+                
46
+        SPLITVIEW 705,25 TO 995,530, "SVList", 0, 1, "playgroundED"
47
+                SPLITVIEW SET "SVList", "Divider", 250
48
+        
49
+        LAYOUT "Top,Bottom", "SVList1"          
50
+        BOXVIEW 0,0 TO 288,245, "BGList", "Backgrounds", 3, "SVList1"
51
+                COLUMNBOX 5,5 TO 277,220, "CBBG", 3, "", "BGList"
52
+                        COLUMNBOX COLUMN "CBBG", "Tile", 1, 64, 64, 64, "align-center,"
53
+        LAYOUT "Top, Bottom", "SVList2" 
54
+        BOXVIEW 0,0 TO 288,245, "OBList", "Objects", 3, "SVList2"
55
+                COLUMNBOX 5,5 TO 277,220, "CBOB", 3, "", "OBList"
56
+                        COLUMNBOX COLUMN "CBOB", "Tile", 1, 64, 64, 64, "align-center,"
57
+        
58
+        BOXVIEW 705,535 TO 995,785, "SWList", "Switches", 3, "playgroundED"
59
+        
60
+
61
+        Files$=system$("ls -G -1 /boot/home/.besly/PlaygroundED/temp/backgrounds")
62
+        dim SplitDirObjects$(1) 
63
+                files = split(Files$, SplitDirObjects$(), "\n")            
64
+                for ibg = 1 to files-1
65
+                        objectlen=len(SplitDirObjects$(ibg))
66
+                        COLUMNBOX ADD "CBBG", 1, ibg, 32, "__Icon__=/boot/home/.besly/PlaygroundED/temp/backgrounds/"+SplitDirObjects$(ibg)
67
+                next ibg
68
+
69
+
70
+        Files$=system$("ls -G -1 /boot/home/.besly/PlaygroundED/temp/objects")
71
+        dim SplitDirObjects$(1) 
72
+                files = split(Files$, SplitDirObjects$(), "\n")            
73
+                for iob = 1 to files-1
74
+                        objectlen=len(SplitDirObjects$(iob))
75
+                        COLUMNBOX ADD "CBOB", 1, iob, 32, "__Icon__=/boot/home/.besly/PlaygroundED/temp/objects/"+SplitDirObjects$(iob)
76
+                next iob
77
+                
78
+        
79
+        
80
+                                
81
+//Main Loop
82
+dim part$(1)
83
+dim mouse$(1)
84
+inloop = true
85
+while(inloop)
86
+        //General Messages
87
+        msg$ = message$
88
+        if (split(msg$, part$(), ":|") > 2) then
89
+                PartOne$=part$(1)
90
+                PartTwo$ = part$(2)
91
+                PartThree$ = part$(3)
92
+        fi
93
+        if (split(msg$, part$(), ":|") > 3) then
94
+                PartFour$ = part$(4)
95
+        fi
96
+        if (split(msg$, part$(), ":|") > 4) then
97
+                PartFife$ = part$(5)
98
+        fi
99
+        if (msg$ <> "") print msg$
100
+        
101
+        switch msg$
102
+        
103
+                //cases
104
+                case "playgroundED:_QuitRequested|"
105
+                        WINDOW CLOSE "playgroundED"
106
+                        break
107
+
108
+                case "playgroundED:Settings:Tile Size:"+PartFour$+"|"
109
+                        DRAW FLUSH "VIEditor"
110
+                        TileSize_x=val(left$(PartFour$, instr(PartFour$, "x")))
111
+                        TileSize_y=val(mid$(PartFour$, instr(PartFour$, "x")+1)) 
112
+                        print TileSize_x
113
+                        print TileSize_y
114
+                        BITMAP TileSize_x, TileSize_y, "DrawBG"
115
+                        BITMAP TileSize_x, TileSize_y, "DrawOB"
116
+                                                
117
+                        DRAW SET "highColor", 255,0,0, "VIEditor"
118
+                        DRAW SET true, "HighSolidFill"
119
+                        for x=1 to TileSize_x //(32 =Levelgröße )
120
+                                for y=1 to TileSize_y //(32 =Levelgröße )                             
121
+                                        draw rect 0*x,0*y to TileSize_x*x,TileSize_y*y ,"VIEditor"
122
+                                next y
123
+                        next x
124
+                        
125
+                        break
126
+                
127
+                case "CBBG:_Select:"+PartThree$+"|"
128
+                        if (TileSize_x =0 ) then
129
+                        else
130
+                                ItemBG$ = COLUMNBOX GET$ "CBBG", 1, val(PartThree$)
131
+                                ItemBG$=mid$(ItemBG$, 10)
132
+                                
133
+                                BITMAP REMOVE "DrawBG"
134
+                                BITMAP TileSize_x, TileSize_y, "DrawBG"
135
+                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, ItemBG$, "DrawBG"
136
+                                SelectedCB$=PartOne$
137
+                        endif
138
+                        break
139
+                case "CBOB:_Select:"+PartThree$+"|"
140
+                        //if(PartOne$="CBBG")then
141
+                        //      ItemBG$ = COLUMNBOX GET$ "CBBG", 1, val(PartThree$)
142
+                        //      ItemBG$=mid$(ItemBG$, 10)
143
+                                
144
+                        //      BITMAP REMOVE "DrawBG"
145
+                        //      BITMAP TileSize_x, TileSize_y, "DrawBG"
146
+                        //      ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, ItemBG$, "DrawBG"
147
+                        //
148
+                        //elseif(PartOne$="CBOB")then
149
+                        if (TileSize_x =0 ) then
150
+                        else
151
+                        
152
+                                ItemOB$ = COLUMNBOX GET$ "CBOB", 1, val(PartThree$)
153
+                                ItemOB$=mid$(ItemOB$, 10)
154
+                                
155
+                                BITMAP REMOVE "DrawOB"
156
+                                BITMAP TileSize_x, TileSize_y, "DrawOB"
157
+                                ErrCode = DRAW IMAGE 0,0 to  TileSize_x, TileSize_y, ItemOB$, "DrawOB"
158
+                                SelectedCB$=PartOne$
159
+                        endif                           
160
+                        break                   
161
+        default:
162
+        break
163
+        end switch
164
+        
165
+        wait 0.05
166
+        
167
+        mmsg$ = MOUSE MESSAGE$
168
+        if (mmsg$<>"" and mmsg$<>old_mmsg$) then
169
+                //print mmsg$
170
+                old_mmsg$= mmsg$ 
171
+                nx = split(mmsg$, mouse$(), ":")
172
+                Viewname$=mouse$(1)
173
+                Xmouse  = val(mouse$(2))
174
+                Ymouse  = val(mouse$(3))
175
+                BLmouse = val(mouse$(4))
176
+                BCmouse= val(mouse$(5))
177
+                BRmouse= val(mouse$(6))
178
+
179
+                Array_x=int(Xmouse/TileSize_x)
180
+                Array_y=int(Ymouse/TileSize_y)
181
+                print Array_x
182
+                print Array_y
183
+        endif
184
+        if(Viewname$="VIEditor")then
185
+                if (BLmouse=1) then
186
+                        //DRAW SET "highColor", 0,255,0, "VIEditor"
187
+                        //DRAW SET false, "HighSolidFill"
188
+                        print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)+TileSize_x-2
189
+                        //draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
190
+                        if(SelectedCB$="CBBG")then
191
+                                DRAW BITMAP (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1, "DrawBG", "copy", "VIEditor"
192
+                        elseif(SelectedCB$="CBOB")then                          
193
+                                DRAW BITMAP (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1, "DrawOB", "alpha", "VIEditor"
194
+                        endif
195
+                
196
+                endif
197
+                if (BRmouse=1) then
198
+                        DRAW SET "highColor", 0,0,0, "VIEditor"
199
+                        DRAW SET false, "HighSolidFill"
200
+                        print "löschen"
201
+                        print (Array_x*TileSize_x)+1: print (Array_x*TileSize_x)-2
202
+                        draw rect (Array_x*TileSize_x)+1,(Array_y*TileSize_y)+1 to (Array_x*TileSize_x)+TileSize_x-1,(Array_y*TileSize_y)+TileSize_y-1 ,"VIEditor"
203
+                endif
204
+        endif
205
+        switch (casestring$)
206
+                
207
+        end switch
208
+
209
+        
210
+        if(window count<1) inloop = false
211
+        sleep 0.05
212
+wend
213
+                
214
+//Check if a file or folder already exisits
215
+sub IfExists(filename$)
216
+     return not system("test -e "+filename$)
217
+end sub         
0 218
new file mode 100644
... ...
@@ -0,0 +1,879 @@
1
+#!/boot/home/config/bin/yab
2
+
3
+
4
+if(IfExists("/boot/home/.besly/PlaygroundED/projects")) then
5
+else
6
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/projects")
7
+endif
8
+
9
+if(IfExists("/boot/home/.besly/PlaygroundED/temp")) then
10
+else
11
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp")
12
+endif
13
+
14
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/backgrounds")) then
15
+else
16
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/backgrounds")
17
+endif
18
+
19
+if(IfExists("/boot/home/.besly/PlaygroundED/temp/objects")) then
20
+else
21
+        Output$=System$("mkdir -p /boot/home/.besly/PlaygroundED/temp/objects")
22
+endif
23
+if(IfExists("/boot/home/PlaygroundED/projects/export")) then
24
+else
25
+        Output$=System$("mkdir -p /boot/home/PlaygroundED/projects/export")
26
+endif
27
+	
28
+  ProjectFolderTemp$="/boot/home/.besly/PlaygroundED/temp"
29
+  ProjectFolder$="/boot/home/.besly/PlaygroundED/projects"
30
+  ProjectExport$="/boot/home/PlaygroundED/projects/export"
31
+  BGFolder$=ProjectFolderTemp$+"/backgrounds"
32
+  OBFolder$=ProjectFolderTemp$+"/objects"
33
+  SWFolder$="/SharedBFS/projects/yab/PlaygroundEditor/data/gfx"
34
+  
35
+//Variables
36
+screenWidth = peek("desktopwidth")
37
+screenHeight = peek("desktopheight")
38
+
39
+VisibleName$="Playground Editor"
40
+        BITMAP 32, 32, "DrawBG"
41
+        BITMAP 32, 32, "DrawOB"
42
+        BITMAP 10, 10, "DrawSW"
43
+
44
+WINDOW OPEN screenWidth/2-500,screenHeight/2-400 to screenWidth/2+500,screenHeight/2+400 , "playgroundED", VisibleName$
45
+        WINDOW SET  "playgroundED", "MinimumTo", 1000,800
46
+        WINDOW SET  "playgroundED", "flags", "not-zoomable, not-resizable"
47
+        
48
+        STACKVIEW 0,0 TO 1000,800, "SVPlaygtoundED", 3,  "playgroundED"      
49
+        
50
+        //Stack 1
51
+        STACKVIEW 1000/2-200,800/2-300 TO 1000/2+200,800/2+300, "VIUserMenu", 4, "SVPlaygtoundED1"
52
+        		STACKVIEW SET "VIUserMenu",1
53
+        		
54
+ 		//User Stack 1		- Selecting loading of creating
55
+ 		BUTTON 400/2-150,600/2-50 TO 400/2+150,600/2-10, "BTLoadProject", "Load Project", "VIUserMenu1"
56
+ 		BUTTON 400/2-150,600/2+10 TO 400/2+150,600/2+50, "BTNewProject", "New Project", "VIUserMenu1"
57
+ 		
58
+ 		//User Stack 2		- loading project
59
+ 		
60
+ 		//Stackview Open Project Button/Statusbar
61
+ 		STACKVIEW 400/2-150,600/2-200 TO 400/2+150,600/2-160, "SVOpenProject", 2, "VIUserMenu2"
62
+ 			//Stack 1 Open Project Button
63
+ 			BUTTON 0,0 TO 300,40, "BTOpenProject", "Open Project", "SVOpenProject1"
64
+ 				option set "BTOpenProject", "enabled", false
65
+ 			//Stack 2 Open Project Button - Statusbar
66
+ 			STATUSBAR 0, 0 to 300, 30, "SBOpenProject", "Loading project data", "", "SVOpenProject2"
67
+