Class GLFWRenderModuleConfig

java.lang.Object
io.codetoil.curved_spacetime.render.glfw.GLFWRenderModuleConfig
All Implemented Interfaces:
ModuleConfig

public class GLFWRenderModuleConfig extends Object implements ModuleConfig
The GLFW render module's settings, read from config/glfw-render-module.config.

One key, vsync, which decides whether presentation waits for the display's refresh. The Vulkan render module reads it when choosing a swap chain present mode.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a configuration that reports load problems to the given logger.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether presentation should wait for the display's refresh.
    boolean
    Returns whether this configuration differs from what is on disk.
    Reads this configuration from disk, substituting defaults for anything missing or invalid.
    void
    Writes this configuration to disk, creating config/ if it does not exist.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GLFWRenderModuleConfig

      public GLFWRenderModuleConfig(Logger logger)
      Creates a configuration that reports load problems to the given logger.
      Parameters:
      logger - the logger to warn through when a key is missing or invalid
  • Method Details

    • hasVSync

      public boolean hasVSync()
      Returns whether presentation should wait for the display's refresh.
      Returns:
      true if vertical sync is enabled
    • load

      public GLFWRenderModuleConfig load() throws IOException
      Description copied from interface: ModuleConfig
      Reads this configuration from disk, substituting defaults for anything missing or invalid.

      An absent file is not an error. For each key that is missing or fails to parse, an implementation logs a warning identifying the key and the accepted range, substitutes the documented default, and sets the dirty flag.

      Specified by:
      load in interface ModuleConfig
      Returns:
      this configuration, so that construction and loading compose
      Throws:
      IOException - if the file exists but cannot be read
    • save

      public void save() throws IOException
      Description copied from interface: ModuleConfig
      Writes this configuration to disk, creating config/ if it does not exist.

      Every known key is written, not only those that changed, so that a user who deletes the file gets a complete one back on the next run. The dirty flag is cleared on success.

      Specified by:
      save in interface ModuleConfig
      Throws:
      IOException - if the directory cannot be created or the file cannot be written
    • isDirty

      public boolean isDirty()
      Description copied from interface: ModuleConfig
      Returns whether this configuration differs from what is on disk.

      Set whenever the in-memory state diverges from the file. ModuleConfig.load() substituting a default for a missing or unparseable key is the usual cause, but any later change to a value counts equally. ModuleConfig.save() clears it, since writing the file makes the two agree again.

      Specified by:
      isDirty in interface ModuleConfig
      Returns:
      true if the file does not match this configuration and should be rewritten