commands.cpp
上传用户:jnfxsk
上传日期:2022-06-16
资源大小:3675k
文件大小:16k
源码类别:

游戏引擎

开发平台:

Visual C++

  1. /*
  2. ** Haaf's Game Engine 1.81
  3. ** Copyright (C) 2008, Relish Games
  4. ** hge.relishgames.com
  5. **
  6. ** Particle systems editor
  7. */
  8. #include "particleed.h"
  9. #include <windows.h>
  10. #include <string>
  11. using namespace std;
  12. bool HandleKeys(int key)
  13. {
  14. switch(key)
  15. {
  16. case 0:
  17. return false;
  18. case HGEK_ESCAPE:
  19. cmdSavePreset(state.nPreset);
  20. return true;
  21. case HGEK_TAB:
  22. state.bIFace = !state.bIFace;
  23. break;
  24. case HGEK_LBUTTON:
  25. if(state.mx>=168 && state.mx<=631) state.ps->Fire();
  26. break;
  27. case HGEK_SPACE:
  28. state.ps->Fire();
  29. break;
  30. case HGEK_1:
  31. case HGEK_2:
  32. case HGEK_3:
  33. case HGEK_4:
  34. case HGEK_5:
  35. case HGEK_6:
  36. case HGEK_7:
  37. case HGEK_8:
  38. case HGEK_9: cmdChangePreset(key-HGEK_1); break;
  39. }
  40. return false;
  41. }
  42. bool DoCommands(int id)
  43. {
  44. switch(id)
  45. {
  46. // Presets & stuff
  47. case 0: return false;
  48. case CMD_EXIT: cmdSavePreset(state.nPreset); return true;
  49. case CMD_HELP: state.bHelp=ButtonGetState(CMD_HELP); break;
  50. case CMD_BOUNDINGBOX: state.bBBox=ButtonGetState(CMD_BOUNDINGBOX); break;
  51. case CMD_PRESET1:
  52. case CMD_PRESET2:
  53. case CMD_PRESET3:
  54. case CMD_PRESET4:
  55. case CMD_PRESET5:
  56. case CMD_PRESET6:
  57. case CMD_PRESET7:
  58. case CMD_PRESET8:
  59. case CMD_PRESET9: cmdChangePreset(id-CMD_PRESET1); break;
  60. // System parameters
  61. case CMD_SYS_LIFETIME:
  62. state.ps->info.fLifetime=SliderGetValue(CMD_SYS_LIFETIME);
  63. GetTextCtrl(CMD_SYS_TLIFETIME)->printf("%.1f",state.ps->info.fLifetime);
  64. ButtonSetState(CMD_SYS_LIFECONT, false);
  65. state.ps->Stop();
  66. break;
  67. case CMD_SYS_LIFECONT:
  68. if(ButtonGetState(CMD_SYS_LIFECONT))
  69. {
  70. state.ps->info.fLifetime=-1.0f;
  71. state.ps->Fire();
  72. }
  73. else
  74. {
  75. state.ps->info.fLifetime=SliderGetValue(CMD_SYS_LIFETIME);
  76. state.ps->Stop();
  77. }
  78. break;
  79. case CMD_SYS_EMISSION:
  80. state.ps->info.nEmission=int(SliderGetValue(CMD_SYS_EMISSION));
  81. GetTextCtrl(CMD_SYS_TEMISSION)->printf("%d",state.ps->info.nEmission);
  82. break;
  83. case CMD_SYS_PARLIFETIMELOCK:
  84. if(ButtonGetState(CMD_SYS_PARLIFETIMELOCK))
  85. {
  86. SliderSetValue(CMD_SYS_PARLIFETIMEMAX, SliderGetValue(CMD_SYS_PARLIFETIMEMIN));
  87. state.ps->info.fParticleLifeMax=state.ps->info.fParticleLifeMin;
  88. }
  89. break;
  90. case CMD_SYS_PARLIFETIMEMIN:
  91. state.ps->info.fParticleLifeMin=SliderGetValue(CMD_SYS_PARLIFETIMEMIN);
  92. if(ButtonGetState(CMD_SYS_PARLIFETIMELOCK))
  93. {
  94. SliderSetValue(CMD_SYS_PARLIFETIMEMAX, state.ps->info.fParticleLifeMin);
  95. state.ps->info.fParticleLifeMax=state.ps->info.fParticleLifeMin;
  96. }
  97. break;
  98. case CMD_SYS_PARLIFETIMEMAX:
  99. state.ps->info.fParticleLifeMax=SliderGetValue(CMD_SYS_PARLIFETIMEMAX);
  100. if(ButtonGetState(CMD_SYS_PARLIFETIMELOCK))
  101. {
  102. SliderSetValue(CMD_SYS_PARLIFETIMEMIN, state.ps->info.fParticleLifeMax);
  103. state.ps->info.fParticleLifeMin=state.ps->info.fParticleLifeMax;
  104. }
  105. break;
  106. case CMD_SYS_TEXTURE: sprParticles->SetFrame(sprParticles->GetFrame()+1); break;
  107. case CMD_SYS_BLENDADDITIVE:
  108. ButtonSetState(CMD_SYS_BLENDADDITIVE, true);
  109. ButtonSetState(CMD_SYS_BLENDBLEND, false);
  110. state.ps->info.sprite->SetBlendMode(BLEND_COLORMUL | BLEND_ALPHAADD | BLEND_ZWRITE);
  111. break;
  112. case CMD_SYS_BLENDBLEND:
  113. ButtonSetState(CMD_SYS_BLENDADDITIVE, false);
  114. ButtonSetState(CMD_SYS_BLENDBLEND, true);
  115. state.ps->info.sprite->SetBlendMode(BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_ZWRITE);
  116. break;
  117. // Particle movement
  118. case CMD_PM_DIRECTION:
  119. state.ps->info.fDirection=SliderGetValue(CMD_PM_DIRECTION);
  120. GetTextCtrl(CMD_PM_TDIRECTION)->printf("%d",int(state.ps->info.fDirection*180/M_PI));
  121. break;
  122. case CMD_PM_RELATIVE:
  123. state.ps->info.bRelative=ButtonGetState(CMD_PM_RELATIVE);
  124. break;
  125. case CMD_PM_SPREAD:
  126. state.ps->info.fSpread=SliderGetValue(CMD_PM_SPREAD);
  127. GetTextCtrl(CMD_PM_TSPREAD)->printf("%d",int(state.ps->info.fSpread*180/M_PI));
  128. break;
  129. case CMD_PM_STARTSPEEDLOCK:
  130. if(ButtonGetState(CMD_PM_STARTSPEEDLOCK))
  131. {
  132. SliderSetValue(CMD_PM_STARTSPEEDMAX, SliderGetValue(CMD_PM_STARTSPEEDMIN));
  133. state.ps->info.fSpeedMax=state.ps->info.fSpeedMin;
  134. }
  135. break;
  136. case CMD_PM_STARTSPEEDMIN:
  137. state.ps->info.fSpeedMin=SliderGetValue(CMD_PM_STARTSPEEDMIN);
  138. if(ButtonGetState(CMD_PM_STARTSPEEDLOCK))
  139. {
  140. SliderSetValue(CMD_PM_STARTSPEEDMAX, state.ps->info.fSpeedMin);
  141. state.ps->info.fSpeedMax=state.ps->info.fSpeedMin;
  142. }
  143. break;
  144. case CMD_PM_STARTSPEEDMAX:
  145. state.ps->info.fSpeedMax=SliderGetValue(CMD_PM_STARTSPEEDMAX);
  146. if(ButtonGetState(CMD_PM_STARTSPEEDLOCK))
  147. {
  148. SliderSetValue(CMD_PM_STARTSPEEDMIN, state.ps->info.fSpeedMax);
  149. state.ps->info.fSpeedMin=state.ps->info.fSpeedMax;
  150. }
  151. break;
  152. case CMD_PM_GRAVITYLOCK:
  153. if(ButtonGetState(CMD_PM_GRAVITYLOCK))
  154. {
  155. SliderSetValue(CMD_PM_GRAVITYMAX, SliderGetValue(CMD_PM_GRAVITYMIN));
  156. state.ps->info.fGravityMax=state.ps->info.fGravityMin;
  157. }
  158. break;
  159. case CMD_PM_GRAVITYMIN:
  160. state.ps->info.fGravityMin=SliderGetValue(CMD_PM_GRAVITYMIN);
  161. if(ButtonGetState(CMD_PM_GRAVITYLOCK))
  162. {
  163. SliderSetValue(CMD_PM_GRAVITYMAX, state.ps->info.fGravityMin);
  164. state.ps->info.fGravityMax=state.ps->info.fGravityMin;
  165. }
  166. break;
  167. case CMD_PM_GRAVITYMAX:
  168. state.ps->info.fGravityMax=SliderGetValue(CMD_PM_GRAVITYMAX);
  169. if(ButtonGetState(CMD_PM_GRAVITYLOCK))
  170. {
  171. SliderSetValue(CMD_PM_GRAVITYMIN, state.ps->info.fGravityMax);
  172. state.ps->info.fGravityMin=state.ps->info.fGravityMax;
  173. }
  174. break;
  175. case CMD_PM_RADIALLOCK:
  176. if(ButtonGetState(CMD_PM_RADIALLOCK))
  177. {
  178. SliderSetValue(CMD_PM_RADIALMAX, SliderGetValue(CMD_PM_RADIALMIN));
  179. state.ps->info.fRadialAccelMax=state.ps->info.fRadialAccelMin;
  180. }
  181. break;
  182. case CMD_PM_RADIALMIN:
  183. state.ps->info.fRadialAccelMin=SliderGetValue(CMD_PM_RADIALMIN);
  184. if(ButtonGetState(CMD_PM_RADIALLOCK))
  185. {
  186. SliderSetValue(CMD_PM_RADIALMAX, state.ps->info.fRadialAccelMin);
  187. state.ps->info.fRadialAccelMax=state.ps->info.fRadialAccelMin;
  188. }
  189. break;
  190. case CMD_PM_RADIALMAX:
  191. state.ps->info.fRadialAccelMax=SliderGetValue(CMD_PM_RADIALMAX);
  192. if(ButtonGetState(CMD_PM_RADIALLOCK))
  193. {
  194. SliderSetValue(CMD_PM_RADIALMIN, state.ps->info.fRadialAccelMax);
  195. state.ps->info.fRadialAccelMin=state.ps->info.fRadialAccelMax;
  196. }
  197. break;
  198. case CMD_PM_TANGENTIALLOCK:
  199. if(ButtonGetState(CMD_PM_TANGENTIALLOCK))
  200. {
  201. SliderSetValue(CMD_PM_TANGENTIALMAX, SliderGetValue(CMD_PM_TANGENTIALMIN));
  202. state.ps->info.fTangentialAccelMax=state.ps->info.fTangentialAccelMin;
  203. }
  204. break;
  205. case CMD_PM_TANGENTIALMIN:
  206. state.ps->info.fTangentialAccelMin=SliderGetValue(CMD_PM_TANGENTIALMIN);
  207. if(ButtonGetState(CMD_PM_TANGENTIALLOCK))
  208. {
  209. SliderSetValue(CMD_PM_TANGENTIALMAX, state.ps->info.fTangentialAccelMin);
  210. state.ps->info.fTangentialAccelMax=state.ps->info.fTangentialAccelMin;
  211. }
  212. break;
  213. case CMD_PM_TANGENTIALMAX:
  214. state.ps->info.fTangentialAccelMax=SliderGetValue(CMD_PM_TANGENTIALMAX);
  215. if(ButtonGetState(CMD_PM_TANGENTIALLOCK))
  216. {
  217. SliderSetValue(CMD_PM_TANGENTIALMIN, state.ps->info.fTangentialAccelMax);
  218. state.ps->info.fTangentialAccelMin=state.ps->info.fTangentialAccelMax;
  219. }
  220. break;
  221. // Particle appearance
  222. case CMD_PA_SIZELOCK:
  223. if(ButtonGetState(CMD_PA_SIZELOCK))
  224. {
  225. SliderSetValue(CMD_PA_SIZEEND, SliderGetValue(CMD_PA_SIZESTART));
  226. state.ps->info.fSizeEnd=state.ps->info.fSizeStart;
  227. }
  228. break;
  229. case CMD_PA_SIZESTART:
  230. state.ps->info.fSizeStart=SliderGetValue(CMD_PA_SIZESTART)/PARTICLE_SIZE;
  231. if(ButtonGetState(CMD_PA_SIZELOCK))
  232. {
  233. SliderSetValue(CMD_PA_SIZEEND, state.ps->info.fSizeStart*PARTICLE_SIZE);
  234. state.ps->info.fSizeEnd=state.ps->info.fSizeStart;
  235. }
  236. break;
  237. case CMD_PA_SIZEEND:
  238. state.ps->info.fSizeEnd=SliderGetValue(CMD_PA_SIZEEND)/PARTICLE_SIZE;
  239. if(ButtonGetState(CMD_PA_SIZELOCK))
  240. {
  241. SliderSetValue(CMD_PA_SIZESTART, state.ps->info.fSizeEnd*PARTICLE_SIZE);
  242. state.ps->info.fSizeStart=state.ps->info.fSizeEnd;
  243. }
  244. break;
  245. case CMD_PA_SIZEVAR:
  246. state.ps->info.fSizeVar=SliderGetValue(CMD_PA_SIZEVAR);
  247. break;
  248. case CMD_PA_SPINLOCK:
  249. if(ButtonGetState(CMD_PA_SPINLOCK))
  250. {
  251. SliderSetValue(CMD_PA_SPINEND, SliderGetValue(CMD_PA_SPINSTART));
  252. state.ps->info.fSpinEnd=state.ps->info.fSpinStart;
  253. }
  254. break;
  255. case CMD_PA_SPINSTART:
  256. state.ps->info.fSpinStart=SliderGetValue(CMD_PA_SPINSTART);
  257. if(ButtonGetState(CMD_PA_SPINLOCK))
  258. {
  259. SliderSetValue(CMD_PA_SPINEND, state.ps->info.fSpinStart);
  260. state.ps->info.fSpinEnd=state.ps->info.fSpinStart;
  261. }
  262. break;
  263. case CMD_PA_SPINEND:
  264. state.ps->info.fSpinEnd=SliderGetValue(CMD_PA_SPINEND);
  265. if(ButtonGetState(CMD_PA_SPINLOCK))
  266. {
  267. SliderSetValue(CMD_PA_SPINSTART, state.ps->info.fSpinEnd);
  268. state.ps->info.fSpinStart=state.ps->info.fSpinEnd;
  269. }
  270. break;
  271. case CMD_PA_SPINVAR:
  272. state.ps->info.fSpinVar=SliderGetValue(CMD_PA_SPINVAR);
  273. break;
  274. case CMD_PA_ALPHALOCK:
  275. if(ButtonGetState(CMD_PA_ALPHALOCK))
  276. {
  277. SliderSetValue(CMD_PA_ALPHAEND, SliderGetValue(CMD_PA_ALPHASTART));
  278. state.ps->info.colColorEnd.a=state.ps->info.colColorStart.a;
  279. }
  280. break;
  281. case CMD_PA_ALPHASTART:
  282. state.ps->info.colColorStart.a=SliderGetValue(CMD_PA_ALPHASTART);
  283. if(ButtonGetState(CMD_PA_ALPHALOCK))
  284. {
  285. SliderSetValue(CMD_PA_ALPHAEND, state.ps->info.colColorStart.a);
  286. state.ps->info.colColorEnd.a=state.ps->info.colColorStart.a;
  287. }
  288. break;
  289. case CMD_PA_ALPHAEND:
  290. state.ps->info.colColorEnd.a=SliderGetValue(CMD_PA_ALPHAEND);
  291. if(ButtonGetState(CMD_PA_ALPHALOCK))
  292. {
  293. SliderSetValue(CMD_PA_ALPHASTART, state.ps->info.colColorEnd.a);
  294. state.ps->info.colColorStart.a=state.ps->info.colColorEnd.a;
  295. }
  296. break;
  297. case CMD_PA_ALPHAVAR:
  298. state.ps->info.fAlphaVar=SliderGetValue(CMD_PA_ALPHAVAR);
  299. break;
  300. case CMD_PA_RSTART:
  301. case CMD_PA_GSTART:
  302. case CMD_PA_BSTART:
  303. case CMD_PA_REND:
  304. case CMD_PA_GEND:
  305. case CMD_PA_BEND: cmdChangeColor(id); break;
  306. case CMD_PA_RGBVAR:
  307. state.ps->info.fColorVar=SliderGetValue(CMD_PA_RGBVAR);
  308. break;
  309. }
  310. return false;
  311. }
  312. void cmdChangePreset(int n)
  313. {
  314. state.ps->Stop();
  315. ButtonSetState(CMD_PRESET1+state.nPreset, false);
  316. ButtonSetState(CMD_PRESET1+n, true);
  317. cmdSavePreset(state.nPreset);
  318. cmdLoadPreset(n);
  319. state.nPreset=n;
  320. }
  321. void cmdSavePreset(int n)
  322. {
  323. HANDLE hF;
  324. DWORD size;
  325. char filename[_MAX_PATH];
  326. if(!state.ps) return;
  327. ZeroMemory(filename, _MAX_PATH);
  328. GetModuleFileName(GetModuleHandle(NULL), filename, _MAX_PATH);
  329. string s(filename);
  330. s=s.substr(0,s.rfind('\'))+"\"+"particle"+char('1'+n)+".psi";
  331. strcpy(filename, s.c_str());
  332. state.ps->info.sprite=(hgeSprite*)(sprParticles->GetFrame() | sprParticles->GetBlendMode()<<16);
  333. hF = CreateFile( filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
  334. if(hF == INVALID_HANDLE_VALUE) return;
  335. WriteFile(hF, &state.ps->info, sizeof(hgeParticleSystemInfo), &size, NULL );
  336.   CloseHandle(hF);
  337. state.ps->info.sprite=sprParticles;
  338. }
  339. void cmdLoadPreset(int n)
  340. {
  341. HANDLE hF;
  342. DWORD size, col1, col2;
  343. char filename[_MAX_PATH];
  344. if(!state.ps) return;
  345. ZeroMemory(filename, _MAX_PATH);
  346. GetModuleFileName(GetModuleHandle(NULL), filename, _MAX_PATH);
  347. string s(filename);
  348. s=s.substr(0,s.rfind('\'))+"\"+"particle"+char('1'+n)+".psi";
  349. strcpy(filename, s.c_str());
  350. hF = CreateFile( filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
  351. if(hF == INVALID_HANDLE_VALUE) return;
  352. ReadFile(hF, &state.ps->info, sizeof(hgeParticleSystemInfo), &size, NULL );
  353.   CloseHandle(hF);
  354. sprParticles->SetFrame((DWORD)state.ps->info.sprite & 0xFFFF);
  355. sprParticles->SetBlendMode((DWORD)state.ps->info.sprite >> 16);
  356. state.ps->info.sprite=sprParticles;
  357. // System parameters
  358. if(state.ps->info.fLifetime==-1.0f)
  359. {
  360. SliderSetValue(CMD_SYS_LIFETIME, 5.0f);
  361. ButtonSetState(CMD_SYS_LIFECONT, true);
  362. GetTextCtrl(CMD_SYS_TLIFETIME)->printf("%.1f", 5.0f);
  363. state.ps->Fire();
  364. }
  365. else
  366. {
  367. SliderSetValue(CMD_SYS_LIFETIME, state.ps->info.fLifetime);
  368. ButtonSetState(CMD_SYS_LIFECONT, false);
  369. GetTextCtrl(CMD_SYS_TLIFETIME)->printf("%.1f", state.ps->info.fLifetime);
  370. }
  371. SliderSetValue(CMD_SYS_EMISSION, (float)state.ps->info.nEmission);
  372. GetTextCtrl(CMD_SYS_TEMISSION)->printf("%d", state.ps->info.nEmission);
  373. SliderSetValue(CMD_SYS_PARLIFETIMEMIN, state.ps->info.fParticleLifeMin);
  374. SliderSetValue(CMD_SYS_PARLIFETIMEMAX, state.ps->info.fParticleLifeMax);
  375. ButtonSetState(CMD_SYS_PARLIFETIMELOCK, false);
  376. if(sprParticles->GetBlendMode() & BLEND_ALPHABLEND)
  377. {
  378. ButtonSetState(CMD_SYS_BLENDADDITIVE, false);
  379. ButtonSetState(CMD_SYS_BLENDBLEND, true);
  380. }
  381. else
  382. {
  383. ButtonSetState(CMD_SYS_BLENDADDITIVE, true);
  384. ButtonSetState(CMD_SYS_BLENDBLEND, false);
  385. }
  386. // Particle movement
  387. SliderSetValue(CMD_PM_DIRECTION, state.ps->info.fDirection);
  388. GetTextCtrl(CMD_PM_TDIRECTION)->printf("%d",int(state.ps->info.fDirection*180/M_PI));
  389. ButtonSetState(CMD_PM_RELATIVE, state.ps->info.bRelative);
  390. SliderSetValue(CMD_PM_SPREAD, state.ps->info.fSpread);
  391. GetTextCtrl(CMD_PM_TSPREAD)->printf("%d",int(state.ps->info.fSpread*180/M_PI));
  392. SliderSetValue(CMD_PM_STARTSPEEDMIN, state.ps->info.fSpeedMin);
  393. SliderSetValue(CMD_PM_STARTSPEEDMAX, state.ps->info.fSpeedMax);
  394. ButtonSetState(CMD_PM_STARTSPEEDLOCK, false);
  395. SliderSetValue(CMD_PM_GRAVITYMIN, state.ps->info.fGravityMin);
  396. SliderSetValue(CMD_PM_GRAVITYMAX, state.ps->info.fGravityMax);
  397. ButtonSetState(CMD_PM_GRAVITYLOCK, false);
  398. SliderSetValue(CMD_PM_RADIALMIN, state.ps->info.fRadialAccelMin);
  399. SliderSetValue(CMD_PM_RADIALMAX, state.ps->info.fRadialAccelMax);
  400. ButtonSetState(CMD_PM_RADIALLOCK, false);
  401. SliderSetValue(CMD_PM_TANGENTIALMIN, state.ps->info.fTangentialAccelMin);
  402. SliderSetValue(CMD_PM_TANGENTIALMAX, state.ps->info.fTangentialAccelMax);
  403. ButtonSetState(CMD_PM_TANGENTIALLOCK, false);
  404. // Particle appearance
  405. SliderSetValue(CMD_PA_SIZESTART, state.ps->info.fSizeStart*PARTICLE_SIZE);
  406. SliderSetValue(CMD_PA_SIZEEND, state.ps->info.fSizeEnd*PARTICLE_SIZE);
  407. SliderSetValue(CMD_PA_SIZEVAR, state.ps->info.fSizeVar);
  408. ButtonSetState(CMD_PA_SIZELOCK, false);
  409. SliderSetValue(CMD_PA_SPINSTART, state.ps->info.fSpinStart);
  410. SliderSetValue(CMD_PA_SPINEND, state.ps->info.fSpinEnd);
  411. SliderSetValue(CMD_PA_SPINVAR, state.ps->info.fSpinVar);
  412. ButtonSetState(CMD_PA_SPINLOCK, false);
  413. SliderSetValue(CMD_PA_ALPHASTART, state.ps->info.colColorStart.a);
  414. SliderSetValue(CMD_PA_ALPHAEND, state.ps->info.colColorEnd.a);
  415. SliderSetValue(CMD_PA_ALPHAVAR, state.ps->info.fAlphaVar);
  416. ButtonSetState(CMD_PA_ALPHALOCK, false);
  417. SliderSetValue(CMD_PA_RSTART, state.ps->info.colColorStart.r);
  418. SliderSetValue(CMD_PA_GSTART, state.ps->info.colColorStart.g);
  419. SliderSetValue(CMD_PA_BSTART, state.ps->info.colColorStart.b);
  420. SliderSetValue(CMD_PA_REND, state.ps->info.colColorEnd.r);
  421. SliderSetValue(CMD_PA_GEND, state.ps->info.colColorEnd.g);
  422. SliderSetValue(CMD_PA_BEND, state.ps->info.colColorEnd.b);
  423. SliderSetValue(CMD_PA_RGBVAR, state.ps->info.fColorVar);
  424. col1=state.ps->info.colColorStart.GetHWColor() | 0xFF000000;
  425. col2=state.ps->info.colColorEnd.GetHWColor() | 0xFF000000;
  426. sprColor->SetColor(col1,0); sprColor->SetColor(col1,1);
  427. sprColor->SetColor(col2,2); sprColor->SetColor(col2,3);
  428. }
  429. void cmdChangeColor(int id)
  430. {
  431. DWORD col1, col2;
  432. float val=SliderGetValue(id);
  433. switch(id)
  434. {
  435. case CMD_PA_RSTART: state.ps->info.colColorStart.r=val; break;
  436. case CMD_PA_GSTART: state.ps->info.colColorStart.g=val; break;
  437. case CMD_PA_BSTART: state.ps->info.colColorStart.b=val; break;
  438. case CMD_PA_REND: state.ps->info.colColorEnd.r=val; break;
  439. case CMD_PA_GEND: state.ps->info.colColorEnd.g=val; break;
  440. case CMD_PA_BEND:  state.ps->info.colColorEnd.b=val; break;
  441. }
  442. col1=state.ps->info.colColorStart.GetHWColor() | 0xFF000000;
  443. col2=state.ps->info.colColorEnd.GetHWColor() | 0xFF000000;
  444. sprColor->SetColor(col1,0); sprColor->SetColor(col1,1);
  445. sprColor->SetColor(col2,2); sprColor->SetColor(col2,3);
  446. }