Class: ScriptLoader::PSDKConfig

Inherits:
Object
  • Object
show all
Defined in:
scripts/00000 PSDK_CONFIG.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#running_in_full_screenBoolean (readonly)

Returns if the game runs in fullscreen.

Returns:

  • (Boolean)

    if the game runs in fullscreen



7
8
9
# File 'scripts/00000 PSDK_CONFIG.rb', line 7

def running_in_full_screen
  @running_in_full_screen
end

#viewport_offset_xInteger (readonly)

Returns OffsetX of all the viewports.

Returns:

  • (Integer)

    OffsetX of all the viewports



11
12
13
# File 'scripts/00000 PSDK_CONFIG.rb', line 11

def viewport_offset_x
  @viewport_offset_x
end

#viewport_offset_yInteger (readonly)

Returns OffsetY of all the viewports.

Returns:

  • (Integer)

    OffsetY of all the viewports



13
14
15
# File 'scripts/00000 PSDK_CONFIG.rb', line 13

def viewport_offset_y
  @viewport_offset_y
end

#vsync_enabledBoolean (readonly)

Returns if the game runs in VSYNC.

Returns:

  • (Boolean)

    if the game runs in VSYNC



9
10
11
# File 'scripts/00000 PSDK_CONFIG.rb', line 9

def vsync_enabled
  @vsync_enabled
end

#window_scaleInteger (readonly)

Returns the window scale.

Returns:



5
6
7
# File 'scripts/00000 PSDK_CONFIG.rb', line 5

def window_scale
  @window_scale
end

Instance Method Details

#choose_best_resolutionArray<Integer>

Function that choose the best resolution

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'scripts/00000 PSDK_CONFIG.rb', line 31

def choose_best_resolution
  @window_scale = Configs.display.window_scale
  @vsync_enabled = Configs.graphic.vsync_enabled
  @running_in_full_screen = Configs.display.is_fullscreen
  fix_scale
  fix_vsync
  fix_full_screen
  return editors_resolution if running_editor?

  native = [Configs.display.game_resolution.x, Configs.display.game_resolution.y]
  @viewport_offset_x = 0
  @viewport_offset_y = 0
  if @running_in_full_screen
    desired = [native.first * @window_scale, native.last * @window_scale].map(&:round)
    all_res = LiteRGSS::DisplayWindow.list_resolutions
    return native if all_res.include?(desired)

    if all_res.include?(native)
      @window_scale = 1
      return native
    end
    return find_best_matching_resolution(native, desired, all_res)
  else
    return native
  end
end

#debug?Boolean

Tell if the game is in Debug mode

Returns:

  • (Boolean)


24
25
26
27
# File 'scripts/00000 PSDK_CONFIG.rb', line 24

def debug?
  @debug = !release? && ARGV.include?('debug') if @debug.nil?
  return @debug
end

#release?Boolean

Tell if the game is in Release mode

Returns:

  • (Boolean)


17
18
19
20
# File 'scripts/00000 PSDK_CONFIG.rb', line 17

def release?
  @release = File.exist?('Data/Scripts.dat') if @release.nil?
  return @release
end