device_options.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2012-2026 Daniele Bartolini et al.
  3. * SPDX-License-Identifier: MIT
  4. */
  5. #pragma once
  6. #include "core/option.h"
  7. #include "core/platform.h"
  8. #include "core/strings/dynamic_string.h"
  9. #include "core/types.h"
  10. namespace crown
  11. {
  12. /// Holds device options.
  13. ///
  14. /// @ingroup Device
  15. struct DeviceOptions
  16. {
  17. int _argc;
  18. const char **_argv;
  19. DynamicString _source_dir;
  20. const char *_map_source_dir_name;
  21. DynamicString _map_source_dir_prefix;
  22. DynamicString _data_dir;
  23. DynamicString _bundle_dir;
  24. const char *_boot_dir;
  25. const char *_platform;
  26. DynamicString _lua_string;
  27. bool _wait_console;
  28. bool _do_compile;
  29. bool _do_continue;
  30. bool _do_bundle;
  31. bool _server;
  32. bool _pumped;
  33. bool _hidden;
  34. u32 _parent_window;
  35. u16 _console_port;
  36. u16 _window_x;
  37. u16 _window_y;
  38. Option<u16> _window_width;
  39. Option<u16> _window_height;
  40. #if CROWN_PLATFORM_ANDROID
  41. void *_asset_manager;
  42. #endif
  43. ///
  44. DeviceOptions(Allocator &a, int argc, const char **argv);
  45. ///
  46. ~DeviceOptions();
  47. /// Parses the command line and returns
  48. /// EXIT_SUCCESS if no error is found.
  49. int parse(bool *quit);
  50. };
  51. } // namespace crown