Load.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. #include <AsynchronCall.h>
  2. #include <Datei.h>
  3. #include <Array.h>
  4. #include <DateiSystem.h>
  5. #include <Text.h>
  6. #include <Textur.h>
  7. #include <GraphicsApi.h>
  8. #include <M3Datei.h>
  9. #include "Load.h"
  10. #include "Initialisierung.h"
  11. #include "Globals.h"
  12. #include "Login.h"
  13. void createDefaultCube(Bildschirm* zScreen)
  14. {
  15. Model3DData* data = zScreen->zGraphicsApi()->createModel("cube");
  16. data->setAmbientFactor(0.8f);
  17. data->setDiffusFactor(0.1f);
  18. data->setSpecularFactor(0.1f);
  19. float size = 1;
  20. float left, right, top, bottom;
  21. // Calculate the screen coordinates of the left side of the bitmap.
  22. left = (float)((size / 2.0) * -1);
  23. // Calculate the screen coordinates of the right side of the bitmap.
  24. right = left + (float)size;
  25. // Calculate the screen coordinates of the top of the bitmap.
  26. top = (float)(size / 2.0);
  27. // Calculate the screen coordinates of the bottom of the bitmap.
  28. bottom = top - (float)size;
  29. float front = -size / 2;
  30. float back = front + size;
  31. Vertex3D* vertecies = new Vertex3D[24];
  32. for (int i = 0; i < 24; i++)
  33. vertecies[i].knochenId = 0;
  34. vertecies[0].pos = Vec3<float >(left, top, front);
  35. vertecies[0].tPos = Vec2< float >(0.f, 0.f);
  36. vertecies[1].pos = Vec3<float >(right, top, front);
  37. vertecies[1].tPos = Vec2< float >(1.f, 0.f);
  38. vertecies[2].pos = Vec3<float >(left, bottom, front);
  39. vertecies[2].tPos = Vec2< float >(0.f, 1.f);
  40. vertecies[3].pos = Vec3<float >(right, bottom, front);
  41. vertecies[3].tPos = Vec2< float >(1.f, 1.f);
  42. vertecies[4].pos = Vec3<float >(left, top, back);
  43. vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
  44. vertecies[5].pos = Vec3<float >(right, top, back);
  45. vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
  46. vertecies[6].pos = Vec3<float >(left, bottom, back);
  47. vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
  48. vertecies[7].pos = Vec3<float >(right, bottom, back);
  49. vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
  50. vertecies[8].pos = Vec3<float >(left, top, front);
  51. vertecies[8].tPos = Vec2< float >(1.f, 0.f);
  52. vertecies[9].pos = Vec3<float >(right, top, front);
  53. vertecies[9].tPos = Vec2< float >(0.f, 0.f);
  54. vertecies[10].pos = Vec3<float >(left, bottom, front);
  55. vertecies[10].tPos = Vec2< float >(1.f, 1.f);
  56. vertecies[11].pos = Vec3<float >(right, bottom, front);
  57. vertecies[11].tPos = Vec2< float >(0.f, 1.f);
  58. vertecies[12].pos = Vec3<float >(left, top, back);
  59. vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
  60. vertecies[13].pos = Vec3<float >(right, top, back);
  61. vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
  62. vertecies[14].pos = Vec3<float >(left, bottom, back);
  63. vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
  64. vertecies[15].pos = Vec3<float >(right, bottom, back);
  65. vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
  66. vertecies[16].pos = Vec3<float >(left, top, front);
  67. vertecies[16].tPos = Vec2< float >(0.f, 1.f);
  68. vertecies[17].pos = Vec3<float >(right, top, front);
  69. vertecies[17].tPos = Vec2< float >(1.f, 1.f);
  70. vertecies[18].pos = Vec3<float >(left, bottom, front);
  71. vertecies[18].tPos = Vec2< float >(0.f, 0.f);
  72. vertecies[19].pos = Vec3<float >(right, bottom, front);
  73. vertecies[19].tPos = Vec2< float >(1.f, 0.f);
  74. vertecies[20].pos = Vec3<float >(left, top, back);
  75. vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
  76. vertecies[21].pos = Vec3<float >(right, top, back);
  77. vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
  78. vertecies[22].pos = Vec3<float >(left, bottom, back);
  79. vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
  80. vertecies[23].pos = Vec3<float >(right, bottom, back);
  81. vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
  82. data->setVertecies(vertecies, 24);
  83. // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
  84. // down side
  85. Polygon3D* p = new Polygon3D();
  86. p->indexAnz = 6;
  87. p->indexList = new int[p->indexAnz];
  88. p->indexList[0] = 6 + 16;
  89. p->indexList[1] = 2 + 16;
  90. p->indexList[2] = 3 + 16;
  91. p->indexList[3] = 6 + 16;
  92. p->indexList[4] = 3 + 16;
  93. p->indexList[5] = 7 + 16;
  94. data->addPolygon(p);
  95. // right side
  96. p = new Polygon3D();
  97. p->indexAnz = 6;
  98. p->indexList = new int[p->indexAnz];
  99. p->indexList[0] = 1 + 8;
  100. p->indexList[1] = 7 + 8;
  101. p->indexList[2] = 3 + 8;
  102. p->indexList[3] = 1 + 8;
  103. p->indexList[4] = 5 + 8;
  104. p->indexList[5] = 7 + 8;
  105. data->addPolygon(p);
  106. // top side
  107. p = new Polygon3D();
  108. p->indexAnz = 6;
  109. p->indexList = new int[p->indexAnz];
  110. p->indexList[0] = 4 + 16;
  111. p->indexList[1] = 1 + 16;
  112. p->indexList[2] = 0 + 16;
  113. p->indexList[3] = 4 + 16;
  114. p->indexList[4] = 5 + 16;
  115. p->indexList[5] = 1 + 16;
  116. data->addPolygon(p);
  117. // left side
  118. p = new Polygon3D();
  119. p->indexAnz = 6;
  120. p->indexList = new int[p->indexAnz];
  121. p->indexList[0] = 0 + 8;
  122. p->indexList[1] = 2 + 8;
  123. p->indexList[2] = 6 + 8;
  124. p->indexList[3] = 0 + 8;
  125. p->indexList[4] = 6 + 8;
  126. p->indexList[5] = 4 + 8;
  127. data->addPolygon(p);
  128. // back side
  129. p = new Polygon3D();
  130. p->indexAnz = 6;
  131. p->indexList = new int[p->indexAnz];
  132. p->indexList[0] = 4;
  133. p->indexList[1] = 6;
  134. p->indexList[2] = 7;
  135. p->indexList[3] = 4;
  136. p->indexList[4] = 7;
  137. p->indexList[5] = 5;
  138. data->addPolygon(p);
  139. // front side
  140. p = new Polygon3D();
  141. p->indexAnz = 6;
  142. p->indexList = new int[p->indexAnz];
  143. p->indexList[0] = 0;
  144. p->indexList[1] = 3;
  145. p->indexList[2] = 2;
  146. p->indexList[3] = 0;
  147. p->indexList[4] = 1;
  148. p->indexList[5] = 3;
  149. data->addPolygon(p);
  150. data->calculateNormals();
  151. data->release();
  152. }
  153. void createCubeItem(Bildschirm* zScreen)
  154. {
  155. Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("itemCube");
  156. data->setAmbientFactor(0.8f);
  157. data->setDiffusFactor(0.1f);
  158. data->setSpecularFactor(0.1f);
  159. float size = 0.2f;
  160. float left, right, top, bottom;
  161. // Calculate the screen coordinates of the left side of the bitmap.
  162. left = (float)((size / 2.0) * -1);
  163. // Calculate the screen coordinates of the right side of the bitmap.
  164. right = left + (float)size;
  165. // Calculate the screen coordinates of the top of the bitmap.
  166. top = (float)(size / 2.0);
  167. // Calculate the screen coordinates of the bottom of the bitmap.
  168. bottom = top - (float)size;
  169. float front = -size / 2;
  170. float back = front + size;
  171. Vertex3D* vertecies = new Vertex3D[24];
  172. for (int i = 0; i < 24; i++)
  173. vertecies[i].knochenId = 0;
  174. vertecies[0].pos = Vec3<float >(left, top, front);
  175. vertecies[0].tPos = Vec2< float >(0.f, 0.f);
  176. vertecies[1].pos = Vec3<float >(right, top, front);
  177. vertecies[1].tPos = Vec2< float >(1.f, 0.f);
  178. vertecies[2].pos = Vec3<float >(left, bottom, front);
  179. vertecies[2].tPos = Vec2< float >(0.f, 1.f);
  180. vertecies[3].pos = Vec3<float >(right, bottom, front);
  181. vertecies[3].tPos = Vec2< float >(1.f, 1.f);
  182. vertecies[4].pos = Vec3<float >(left, top, back);
  183. vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
  184. vertecies[5].pos = Vec3<float >(right, top, back);
  185. vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
  186. vertecies[6].pos = Vec3<float >(left, bottom, back);
  187. vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
  188. vertecies[7].pos = Vec3<float >(right, bottom, back);
  189. vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
  190. vertecies[8].pos = Vec3<float >(left, top, front);
  191. vertecies[8].tPos = Vec2< float >(1.f, 0.f);
  192. vertecies[9].pos = Vec3<float >(right, top, front);
  193. vertecies[9].tPos = Vec2< float >(0.f, 0.f);
  194. vertecies[10].pos = Vec3<float >(left, bottom, front);
  195. vertecies[10].tPos = Vec2< float >(1.f, 1.f);
  196. vertecies[11].pos = Vec3<float >(right, bottom, front);
  197. vertecies[11].tPos = Vec2< float >(0.f, 1.f);
  198. vertecies[12].pos = Vec3<float >(left, top, back);
  199. vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
  200. vertecies[13].pos = Vec3<float >(right, top, back);
  201. vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
  202. vertecies[14].pos = Vec3<float >(left, bottom, back);
  203. vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
  204. vertecies[15].pos = Vec3<float >(right, bottom, back);
  205. vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
  206. vertecies[16].pos = Vec3<float >(left, top, front);
  207. vertecies[16].tPos = Vec2< float >(0.f, 1.f);
  208. vertecies[17].pos = Vec3<float >(right, top, front);
  209. vertecies[17].tPos = Vec2< float >(1.f, 1.f);
  210. vertecies[18].pos = Vec3<float >(left, bottom, front);
  211. vertecies[18].tPos = Vec2< float >(0.f, 0.f);
  212. vertecies[19].pos = Vec3<float >(right, bottom, front);
  213. vertecies[19].tPos = Vec2< float >(1.f, 0.f);
  214. vertecies[20].pos = Vec3<float >(left, top, back);
  215. vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
  216. vertecies[21].pos = Vec3<float >(right, top, back);
  217. vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
  218. vertecies[22].pos = Vec3<float >(left, bottom, back);
  219. vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
  220. vertecies[23].pos = Vec3<float >(right, bottom, back);
  221. vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
  222. data->setVertecies(vertecies, 24);
  223. // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
  224. // down side
  225. Polygon3D* p = new Polygon3D();
  226. p->indexAnz = 6;
  227. p->indexList = new int[p->indexAnz];
  228. p->indexList[0] = 6 + 16;
  229. p->indexList[1] = 2 + 16;
  230. p->indexList[2] = 3 + 16;
  231. p->indexList[3] = 6 + 16;
  232. p->indexList[4] = 3 + 16;
  233. p->indexList[5] = 7 + 16;
  234. data->addPolygon(p);
  235. // right side
  236. p = new Polygon3D();
  237. p->indexAnz = 6;
  238. p->indexList = new int[p->indexAnz];
  239. p->indexList[0] = 1 + 8;
  240. p->indexList[1] = 7 + 8;
  241. p->indexList[2] = 3 + 8;
  242. p->indexList[3] = 1 + 8;
  243. p->indexList[4] = 5 + 8;
  244. p->indexList[5] = 7 + 8;
  245. data->addPolygon(p);
  246. // top side
  247. p = new Polygon3D();
  248. p->indexAnz = 6;
  249. p->indexList = new int[p->indexAnz];
  250. p->indexList[0] = 4 + 16;
  251. p->indexList[1] = 1 + 16;
  252. p->indexList[2] = 0 + 16;
  253. p->indexList[3] = 4 + 16;
  254. p->indexList[4] = 5 + 16;
  255. p->indexList[5] = 1 + 16;
  256. data->addPolygon(p);
  257. // left side
  258. p = new Polygon3D();
  259. p->indexAnz = 6;
  260. p->indexList = new int[p->indexAnz];
  261. p->indexList[0] = 0 + 8;
  262. p->indexList[1] = 2 + 8;
  263. p->indexList[2] = 6 + 8;
  264. p->indexList[3] = 0 + 8;
  265. p->indexList[4] = 6 + 8;
  266. p->indexList[5] = 4 + 8;
  267. data->addPolygon(p);
  268. // back side
  269. p = new Polygon3D();
  270. p->indexAnz = 6;
  271. p->indexList = new int[p->indexAnz];
  272. p->indexList[0] = 4;
  273. p->indexList[1] = 6;
  274. p->indexList[2] = 7;
  275. p->indexList[3] = 4;
  276. p->indexList[4] = 7;
  277. p->indexList[5] = 5;
  278. data->addPolygon(p);
  279. // front side
  280. p = new Polygon3D();
  281. p->indexAnz = 6;
  282. p->indexList = new int[p->indexAnz];
  283. p->indexList[0] = 0;
  284. p->indexList[1] = 3;
  285. p->indexList[2] = 2;
  286. p->indexList[3] = 0;
  287. p->indexList[4] = 1;
  288. p->indexList[5] = 3;
  289. data->addPolygon(p);
  290. data->calculateNormals();
  291. data->release();
  292. }
  293. void createPlayer(Bildschirm* zScreen)
  294. {
  295. Framework::Model3DData* data = window->zBildschirm()->zGraphicsApi()->createModel("player");
  296. data->setAmbientFactor(0.8f);
  297. data->setDiffusFactor(0.1f);
  298. data->setSpecularFactor(0.1f);
  299. float size = 0.8f;
  300. float left, right, top, bottom;
  301. // Calculate the screen coordinates of the left side of the bitmap.
  302. left = (float)((size / 2.0) * -1);
  303. // Calculate the screen coordinates of the right side of the bitmap.
  304. right = left + (float)size;
  305. // Calculate the screen coordinates of the top of the bitmap.
  306. top = (float)(size / 2.0);
  307. // Calculate the screen coordinates of the bottom of the bitmap.
  308. bottom = top - (float)size;
  309. float front = -1.5f / 2;
  310. float back = front + 1.5f;
  311. Vertex3D* vertecies = new Vertex3D[24];
  312. for (int i = 0; i < 24; i++)
  313. vertecies[i].knochenId = 0;
  314. vertecies[0].pos = Vec3<float >(left, top, front);
  315. vertecies[0].tPos = Vec2< float >(0.f, 0.f);
  316. vertecies[1].pos = Vec3<float >(right, top, front);
  317. vertecies[1].tPos = Vec2< float >(1.f, 0.f);
  318. vertecies[2].pos = Vec3<float >(left, bottom, front);
  319. vertecies[2].tPos = Vec2< float >(0.f, 1.f);
  320. vertecies[3].pos = Vec3<float >(right, bottom, front);
  321. vertecies[3].tPos = Vec2< float >(1.f, 1.f);
  322. vertecies[4].pos = Vec3<float >(left, top, back);
  323. vertecies[4].tPos = Vec2< float >(0.0f, 0.0f);
  324. vertecies[5].pos = Vec3<float >(right, top, back);
  325. vertecies[5].tPos = Vec2< float >(1.0f, 0.0f);
  326. vertecies[6].pos = Vec3<float >(left, bottom, back);
  327. vertecies[6].tPos = Vec2< float >(0.0f, 1.0f);
  328. vertecies[7].pos = Vec3<float >(right, bottom, back);
  329. vertecies[7].tPos = Vec2< float >(1.0f, 1.0f);
  330. vertecies[8].pos = Vec3<float >(left, top, front);
  331. vertecies[8].tPos = Vec2< float >(1.f, 0.f);
  332. vertecies[9].pos = Vec3<float >(right, top, front);
  333. vertecies[9].tPos = Vec2< float >(0.f, 0.f);
  334. vertecies[10].pos = Vec3<float >(left, bottom, front);
  335. vertecies[10].tPos = Vec2< float >(1.f, 1.f);
  336. vertecies[11].pos = Vec3<float >(right, bottom, front);
  337. vertecies[11].tPos = Vec2< float >(0.f, 1.f);
  338. vertecies[12].pos = Vec3<float >(left, top, back);
  339. vertecies[12].tPos = Vec2< float >(0.0f, 0.0f);
  340. vertecies[13].pos = Vec3<float >(right, top, back);
  341. vertecies[13].tPos = Vec2< float >(1.0f, 0.0f);
  342. vertecies[14].pos = Vec3<float >(left, bottom, back);
  343. vertecies[14].tPos = Vec2< float >(0.0f, 1.0f);
  344. vertecies[15].pos = Vec3<float >(right, bottom, back);
  345. vertecies[15].tPos = Vec2< float >(1.0f, 1.0f);
  346. vertecies[16].pos = Vec3<float >(left, top, front);
  347. vertecies[16].tPos = Vec2< float >(0.f, 1.f);
  348. vertecies[17].pos = Vec3<float >(right, top, front);
  349. vertecies[17].tPos = Vec2< float >(1.f, 1.f);
  350. vertecies[18].pos = Vec3<float >(left, bottom, front);
  351. vertecies[18].tPos = Vec2< float >(0.f, 0.f);
  352. vertecies[19].pos = Vec3<float >(right, bottom, front);
  353. vertecies[19].tPos = Vec2< float >(1.f, 0.f);
  354. vertecies[20].pos = Vec3<float >(left, top, back);
  355. vertecies[20].tPos = Vec2< float >(0.0f, 0.0f);
  356. vertecies[21].pos = Vec3<float >(right, top, back);
  357. vertecies[21].tPos = Vec2< float >(1.0f, 0.0f);
  358. vertecies[22].pos = Vec3<float >(left, bottom, back);
  359. vertecies[22].tPos = Vec2< float >(0.0f, 1.0f);
  360. vertecies[23].pos = Vec3<float >(right, bottom, back);
  361. vertecies[23].tPos = Vec2< float >(1.0f, 1.0f);
  362. data->setVertecies(vertecies, 24);
  363. // the order of the polygons has to be NORTH, EAST, SOUTH, WEST, TOP, BOTTOM according to the Area definition
  364. // down side
  365. Polygon3D* p = new Polygon3D();
  366. p->indexAnz = 6;
  367. p->indexList = new int[p->indexAnz];
  368. p->indexList[0] = 6 + 16;
  369. p->indexList[1] = 2 + 16;
  370. p->indexList[2] = 3 + 16;
  371. p->indexList[3] = 6 + 16;
  372. p->indexList[4] = 3 + 16;
  373. p->indexList[5] = 7 + 16;
  374. data->addPolygon(p);
  375. // right side
  376. p = new Polygon3D();
  377. p->indexAnz = 6;
  378. p->indexList = new int[p->indexAnz];
  379. p->indexList[0] = 1 + 8;
  380. p->indexList[1] = 7 + 8;
  381. p->indexList[2] = 3 + 8;
  382. p->indexList[3] = 1 + 8;
  383. p->indexList[4] = 5 + 8;
  384. p->indexList[5] = 7 + 8;
  385. data->addPolygon(p);
  386. // top side
  387. p = new Polygon3D();
  388. p->indexAnz = 6;
  389. p->indexList = new int[p->indexAnz];
  390. p->indexList[0] = 4 + 16;
  391. p->indexList[1] = 1 + 16;
  392. p->indexList[2] = 0 + 16;
  393. p->indexList[3] = 4 + 16;
  394. p->indexList[4] = 5 + 16;
  395. p->indexList[5] = 1 + 16;
  396. data->addPolygon(p);
  397. // left side
  398. p = new Polygon3D();
  399. p->indexAnz = 6;
  400. p->indexList = new int[p->indexAnz];
  401. p->indexList[0] = 0 + 8;
  402. p->indexList[1] = 2 + 8;
  403. p->indexList[2] = 6 + 8;
  404. p->indexList[3] = 0 + 8;
  405. p->indexList[4] = 6 + 8;
  406. p->indexList[5] = 4 + 8;
  407. data->addPolygon(p);
  408. // back side
  409. p = new Polygon3D();
  410. p->indexAnz = 6;
  411. p->indexList = new int[p->indexAnz];
  412. p->indexList[0] = 4;
  413. p->indexList[1] = 6;
  414. p->indexList[2] = 7;
  415. p->indexList[3] = 4;
  416. p->indexList[4] = 7;
  417. p->indexList[5] = 5;
  418. data->addPolygon(p);
  419. // front side
  420. p = new Polygon3D();
  421. p->indexAnz = 6;
  422. p->indexList = new int[p->indexAnz];
  423. p->indexList[0] = 0;
  424. p->indexList[1] = 3;
  425. p->indexList[2] = 2;
  426. p->indexList[3] = 0;
  427. p->indexList[4] = 1;
  428. p->indexList[5] = 3;
  429. data->addPolygon(p);
  430. data->calculateNormals();
  431. data->release();
  432. }
  433. void createModels(Bildschirm* zScreen)
  434. {
  435. createDefaultCube(zScreen);
  436. createCubeItem(zScreen);
  437. createPlayer(zScreen);
  438. }
  439. LoadMenu::LoadMenu(Bildschirm* zScreen)
  440. : Menu(zScreen)
  441. {
  442. step = initFBalken(10, 90, 200, 30, FBalken::Style::normal);
  443. stage = initFBalken(10, 50, 200, 30, FBalken::Style::normal);
  444. all = initFBalken(10, 10, 200, 30, FBalken::Style::normal);
  445. elements.add(step);
  446. elements.add(stage);
  447. elements.add(all);
  448. new AsynchronCall("Load Menu", [this, zScreen]()
  449. {
  450. Sleep(1000);
  451. all->setAktionAnzahl(2);
  452. all->reset();
  453. // loading textures
  454. Datei texturF;
  455. texturF.setDatei("data/textures");
  456. RCArray<Text>* files = texturF.getDateiListe();
  457. if (files)
  458. {
  459. int count = 0;
  460. for (Text* fileName : *files)
  461. {
  462. LTDBDatei dat;
  463. dat.setDatei(new Text(Text("data/textures/") + *fileName));
  464. dat.leseDaten(0);
  465. count += dat.getBildAnzahl();
  466. }
  467. stage->setAktionAnzahl(count);
  468. stage->reset();
  469. for (Text* fileName : *files)
  470. {
  471. LTDBDatei dat;
  472. dat.setDatei(new Text(Text("data/textures/") + *fileName));
  473. dat.leseDaten(0);
  474. for (Text* name : *dat.zBildListe())
  475. {
  476. step->reset();
  477. Bild* b = dat.laden(step, new Text(*name));
  478. zScreen->zGraphicsApi()->createOrGetTextur(*fileName + "/" + *name, b)->release();
  479. stage->aktionPlus();
  480. }
  481. }
  482. files->release();
  483. }
  484. all->aktionPlus();
  485. // loading models
  486. stage->setAktionAnzahl(1);
  487. Datei modelF;
  488. modelF.setDatei("data/models");
  489. files = modelF.getDateiListe();
  490. if (files)
  491. {
  492. int count = 0;
  493. for (Text* fileName : *files)
  494. {
  495. M3Datei dat(Text("data/models/") + *fileName);
  496. dat.leseDaten();
  497. count += dat.getModelAnzahl();
  498. }
  499. stage->setAktionAnzahl(count + 1);
  500. stage->reset();
  501. for (Text* fileName : *files)
  502. {
  503. M3Datei dat(Text("data/models/") + *fileName);
  504. dat.leseDaten();
  505. for (int i = 0; i < dat.getModelAnzahl(); i++)
  506. {
  507. step->reset();
  508. Model3DData* d = dat.ladeModel(dat.zModelName(i)->getText(), zScreen->zGraphicsApi(), *fileName + "/" + *dat.zModelName(i));
  509. d->release();
  510. stage->aktionPlus();
  511. }
  512. }
  513. files->release();
  514. }
  515. createModels(zScreen);
  516. stage->aktionPlus();
  517. all->aktionPlus();
  518. stage->reset();
  519. zScreen->lock();
  520. hide();
  521. ((LoginMenu*)(Menu*)menuRegister->get("login"))->onLoadingFinished();
  522. menuRegister->get("login")->show();
  523. zScreen->unlock();
  524. });
  525. }