*/}}

ourpaint.c 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Our Paint: A light weight GPU powered painting program.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "ourpaint.h"
  19. extern LA MAIN;
  20. extern tnsMain* T;
  21. extern OurPaint *Our;
  22. #ifdef _WIN32
  23. __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
  24. __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
  25. #endif
  26. int main(int argc, char *argv[]){
  27. if(ourProcessInitArgs(argc,argv) < 0){ return 0; }
  28. laInitArguments ia={0}; laSetDefaultInitArguments(&ia);
  29. ia.GLMajor=4; ia.GLMinor=5;
  30. ia.UseColorManagement=1;
  31. ia.HasTextureInspector=1;
  32. ia.HasTerminal=1;
  33. ia.HasHistories=1;
  34. //MAIN.EnableGLDebug=1;
  35. //MAIN.GLDebugSync=1;
  36. laProcessInitArguments(argc, argv, &ia);
  37. laGetReadyWith(&ia);
  38. if(!ourInit()){ laShutoff(0); return -1; }
  39. laRefreshUDFRegistries();
  40. laEnsureUserPreferences();
  41. laLoadHyperResources("OURBRUSH");
  42. laLoadHyperResources("OURPALLETTE");
  43. int anyload=0;
  44. for(int i=1;i<argc;i++){
  45. char* file=argv[i]; int mode=LA_UDF_MODE_APPEND;
  46. char* ext=strGetLastSegment(file,'.'); strToLower(ext);
  47. if(strSame(ext,"ourpaint")){ mode=LA_UDF_MODE_OVERWRITE; }
  48. laManagedUDF* m; laUDF* udf = laOpenUDF(file, 1, 0, &m);
  49. if(udf){ laExtractUDF(udf,m,mode); laCloseUDF(udf); anyload=1; }
  50. }
  51. if(anyload){ laRecordEverythingAndPush(); }
  52. //laAddRootDBInst("our.tools");
  53. if(!MAIN.Windows.pFirst){
  54. laWindow* w = laDesignWindow(-1,-1,35*LA_RH,25*LA_RH);
  55. laLayout* l = laDesignLayout(w, "Our Paint");
  56. laBlock* b = l->FirstBlock;
  57. laSplitBlockHorizon(b,0.7);
  58. laCreatePanel(b->B1, "panel_canvas");
  59. laBlock* br=b->B2;
  60. laSplitBlockVertical(br,0.6);
  61. laCreatePanel(br->B1, "panel_color");
  62. laCreatePanel(br->B1, "panel_tools");
  63. laCreatePanel(br->B1, "panel_brushes");
  64. laCreatePanel(br->B2, "panel_notes");
  65. laCreatePanel(br->B2, "panel_layers");
  66. laStartWindow(w);
  67. }
  68. our_EnableSplashPanel();
  69. laMainLoop();
  70. }