Patcher for 16:9
This commit is contained in:
parent
e2f497e66d
commit
aa65d1783b
|
|
@ -209,7 +209,6 @@ void graphicsBindingInit(){
|
||||||
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
|
INIT_GRA_PROP_BIND( FrameRate, "frame_rate" );
|
||||||
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
|
INIT_GRA_PROP_BIND( FrameCount, "frame_count" );
|
||||||
|
|
||||||
if (rgssVer >= 2){
|
|
||||||
_rb_define_module_function(module, "width", graphicsWidth);
|
_rb_define_module_function(module, "width", graphicsWidth);
|
||||||
_rb_define_module_function(module, "height", graphicsHeight);
|
_rb_define_module_function(module, "height", graphicsHeight);
|
||||||
_rb_define_module_function(module, "wait", graphicsWait);
|
_rb_define_module_function(module, "wait", graphicsWait);
|
||||||
|
|
@ -219,7 +218,6 @@ void graphicsBindingInit(){
|
||||||
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen);
|
_rb_define_module_function(module, "resize_screen", graphicsResizeScreen);
|
||||||
|
|
||||||
INIT_GRA_PROP_BIND( Brightness, "brightness" );
|
INIT_GRA_PROP_BIND( Brightness, "brightness" );
|
||||||
}
|
|
||||||
|
|
||||||
if (rgssVer >= 3){
|
if (rgssVer >= 3){
|
||||||
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
|
_rb_define_module_function(module, "play_movie", graphicsPlayMovie);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ void SunshineBindingInit(){
|
||||||
rb_const_set(module, rb_intern("SDLVersion_major"), INT2NUM(SDL_MAJOR_VERSION));
|
rb_const_set(module, rb_intern("SDLVersion_major"), INT2NUM(SDL_MAJOR_VERSION));
|
||||||
rb_const_set(module, rb_intern("SDLVersion_minor"), INT2NUM(SDL_MINOR_VERSION));
|
rb_const_set(module, rb_intern("SDLVersion_minor"), INT2NUM(SDL_MINOR_VERSION));
|
||||||
rb_const_set(module, rb_intern("SDLVersion_micro"), INT2NUM(SDL_MICRO_VERSION));
|
rb_const_set(module, rb_intern("SDLVersion_micro"), INT2NUM(SDL_MICRO_VERSION));
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("[SunshineBindingInit] SDL version: %i.%i.%i\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
|
printf("[SunshineBindingInit] SDL version: %i.%i.%i\n", SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_MICRO_VERSION);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@
|
||||||
#
|
#
|
||||||
# fixedAspectRatio=true
|
# fixedAspectRatio=true
|
||||||
|
|
||||||
|
# 16:9 support
|
||||||
|
# EXPEREMENTAL!
|
||||||
|
# EnableSixteenByNine=false
|
||||||
|
|
||||||
# Apply linear interpolation when game screen
|
# Apply linear interpolation when game screen
|
||||||
# is upscaled
|
# is upscaled
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@ class Credits_Message
|
||||||
def initialize
|
def initialize
|
||||||
@timer = 0
|
@timer = 0
|
||||||
|
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@sprite_bg = Sprite.new(@viewport)
|
@sprite_bg = Sprite.new(@viewport)
|
||||||
@sprite_bg.bitmap = Bitmap.new(640, 480)
|
@sprite_bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
if $game_switches[104]
|
if $game_switches[104]
|
||||||
@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))
|
@sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255))
|
||||||
else
|
else
|
||||||
@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(255, 255, 255, 255))
|
@sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(255, 255, 255, 255))
|
||||||
end
|
end
|
||||||
@sprite_text = Sprite.new(@viewport)
|
@sprite_text = Sprite.new(@viewport)
|
||||||
@contents = Bitmap.new(320, 240)
|
@contents = Bitmap.new(320, 240)
|
||||||
|
|
@ -61,9 +61,9 @@ class Credits_Message
|
||||||
def refresh
|
def refresh
|
||||||
|
|
||||||
if $game_switches[104]
|
if $game_switches[104]
|
||||||
@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 255))
|
@sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 255))
|
||||||
else
|
else
|
||||||
@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(255, 255, 255, 255))
|
@sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(255, 255, 255, 255))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Initialize
|
# Initialize
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,15 @@ class Desktop_Message
|
||||||
# * Object Initialization
|
# * Object Initialization
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def initialize
|
def initialize
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@sprite_bg = Sprite.new(@viewport)
|
@sprite_bg = Sprite.new(@viewport)
|
||||||
@sprite_bg.bitmap = RPG::Cache.picture('cg_desktop_messagebox') #Bitmap.new(640, 480)
|
@sprite_bg.bitmap = RPG::Cache.picture('cg_desktop_messagebox') #Bitmap.new(640, 480)
|
||||||
@sprite_bg.zoom_x = @sprite_bg.zoom_y = 2
|
@sprite_bg.zoom_x = @sprite_bg.zoom_y = 2
|
||||||
@sprite_text = Sprite.new(@viewport)
|
@sprite_text = Sprite.new(@viewport)
|
||||||
@contents = Bitmap.new(640, HEIGHT)
|
@contents = Bitmap.new(Graphics.width, HEIGHT)
|
||||||
Language.register_text_sprite(self.class.name + "_contents", @contents)
|
Language.register_text_sprite(self.class.name + "_contents", @contents)
|
||||||
@sprite_text.bitmap = @contents
|
@sprite_text.bitmap = @contents
|
||||||
@sprite_text.y = (480 - HEIGHT) / 2
|
@sprite_text.y = (Graphics.height - HEIGHT) / 2
|
||||||
@sprite_bg.z = 0
|
@sprite_bg.z = 0
|
||||||
@sprite_text.z = 1
|
@sprite_text.z = 1
|
||||||
@sprite_text.zoom_x = @sprite_text.zoom_y = 1
|
@sprite_text.zoom_x = @sprite_text.zoom_y = 1
|
||||||
|
|
@ -119,7 +119,7 @@ class Desktop_Message
|
||||||
@contents.clear
|
@contents.clear
|
||||||
@contents.font.color = Color.new(44, 37, 54, 255)
|
@contents.font.color = Color.new(44, 37, 54, 255)
|
||||||
y_top = (HEIGHT - widths.length * 24) / 2
|
y_top = (HEIGHT - widths.length * 24) / 2
|
||||||
x = (640 - widths[0]) / 2
|
x = (Graphics.width - widths[0]) / 2
|
||||||
y = 0
|
y = 0
|
||||||
|
|
||||||
# Get 1 text character in c (loop until unable to get text)
|
# Get 1 text character in c (loop until unable to get text)
|
||||||
|
|
@ -127,7 +127,7 @@ class Desktop_Message
|
||||||
# \n
|
# \n
|
||||||
if c == "\n"
|
if c == "\n"
|
||||||
y += 1
|
y += 1
|
||||||
x = (640 - widths[y]) / 2
|
x = (Graphics.width - widths[y]) / 2
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
# \c[n]
|
# \c[n]
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class Doc_Message
|
||||||
# * Object Initialization
|
# * Object Initialization
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def initialize
|
def initialize
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@sprite_bg = Sprite.new(@viewport)
|
@sprite_bg = Sprite.new(@viewport)
|
||||||
@sprite_scroll_up = Sprite.new(@viewport)
|
@sprite_scroll_up = Sprite.new(@viewport)
|
||||||
@sprite_scroll_down = Sprite.new(@viewport)
|
@sprite_scroll_down = Sprite.new(@viewport)
|
||||||
|
|
|
||||||
|
|
@ -5,15 +5,15 @@ class Ed_Message
|
||||||
# * Object Initialization
|
# * Object Initialization
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def initialize
|
def initialize
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@sprite_bg = Sprite.new(@viewport)
|
@sprite_bg = Sprite.new(@viewport)
|
||||||
@sprite_bg.bitmap = Bitmap.new(640, 480)
|
@sprite_bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@sprite_bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 128))
|
@sprite_bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 128))
|
||||||
@sprite_text = Sprite.new(@viewport)
|
@sprite_text = Sprite.new(@viewport)
|
||||||
@contents = Bitmap.new(640, HEIGHT)
|
@contents = Bitmap.new(Graphics.width, HEIGHT)
|
||||||
Language.register_text_sprite(self.class.name + "_contents", @contents)
|
Language.register_text_sprite(self.class.name + "_contents", @contents)
|
||||||
@sprite_text.bitmap = @contents
|
@sprite_text.bitmap = @contents
|
||||||
@sprite_text.y = (480 - HEIGHT) / 2
|
@sprite_text.y = (Graphics.height - HEIGHT) / 2
|
||||||
@sprite_bg.z = 0
|
@sprite_bg.z = 0
|
||||||
@sprite_text.z = 1
|
@sprite_text.z = 1
|
||||||
@viewport.z = 9999
|
@viewport.z = 9999
|
||||||
|
|
@ -123,7 +123,7 @@ class Ed_Message
|
||||||
@contents.clear
|
@contents.clear
|
||||||
@contents.font.color = Color.new(255, 255, 255, 255)
|
@contents.font.color = Color.new(255, 255, 255, 255)
|
||||||
y_top = (HEIGHT - widths.length * 24) / 2
|
y_top = (HEIGHT - widths.length * 24) / 2
|
||||||
x = (640 - widths[0]) / 2
|
x = (Graphics.width - widths[0]) / 2
|
||||||
y = 0
|
y = 0
|
||||||
|
|
||||||
# Get 1 text character in c (loop until unable to get text)
|
# Get 1 text character in c (loop until unable to get text)
|
||||||
|
|
@ -131,7 +131,7 @@ class Ed_Message
|
||||||
# \n
|
# \n
|
||||||
if c == "\n"
|
if c == "\n"
|
||||||
y += 1
|
y += 1
|
||||||
x = (640 - widths[y]) / 2
|
x = (Graphics.width - widths[y]) / 2
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
# \c[n]
|
# \c[n]
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ class FastTravel
|
||||||
ACTIVE_MARGIN = MARGIN * 2 + 20
|
ACTIVE_MARGIN = MARGIN * 2 + 20
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@bg = Sprite.new(@viewport)
|
@bg = Sprite.new(@viewport)
|
||||||
@bg.bitmap = Bitmap.new(640, 480)
|
@bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 128))
|
@bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 128))
|
||||||
@title = Sprite.new(@viewport)
|
@title = Sprite.new(@viewport)
|
||||||
Language.register_text_sprite(self.class.name + "_title", @title)
|
Language.register_text_sprite(self.class.name + "_title", @title)
|
||||||
@title.bitmap = Bitmap.new(320, TITLE_MARGIN)
|
@title.bitmap = Bitmap.new(320, TITLE_MARGIN)
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,13 @@ class Game_Player < Game_Character
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# * Invariables
|
# * Invariables
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
|
if Graphics.width == 1280
|
||||||
|
CENTER_X = 2560 - 16 # Center screen x-coordinate * 2
|
||||||
|
CENTER_Y = 2880 - 16 # Center screen y-coordinate * 2
|
||||||
|
else
|
||||||
CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4
|
CENTER_X = (320 - 16) * 4 # Center screen x-coordinate * 4
|
||||||
CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4
|
CENTER_Y = (240 - 16) * 4 # Center screen y-coordinate * 4
|
||||||
|
end
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# * Passable Determinants
|
# * Passable Determinants
|
||||||
# x : x-coordinate
|
# x : x-coordinate
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ class Particle
|
||||||
@sprite.bitmap = bitmap
|
@sprite.bitmap = bitmap
|
||||||
@sprite.ox = bitmap.width / 2
|
@sprite.ox = bitmap.width / 2
|
||||||
@sprite.oy = bitmap.height / 2
|
@sprite.oy = bitmap.height / 2
|
||||||
self.x = rand(640)
|
self.x = rand(Graphics.width)
|
||||||
self.y = rand(480)
|
self.y = rand(Graphics.height)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Link various things to the sprite
|
# Link various things to the sprite
|
||||||
|
|
@ -17,8 +17,8 @@ class Particle
|
||||||
@x = val
|
@x = val
|
||||||
width = @sprite.bitmap.width * @sprite.zoom_x
|
width = @sprite.bitmap.width * @sprite.zoom_x
|
||||||
if @x < -width
|
if @x < -width
|
||||||
@x = 640 + width
|
@x = Graphics.width + width
|
||||||
elsif @x > 640 + width
|
elsif @x > Graphics.width + width
|
||||||
@x = -width
|
@x = -width
|
||||||
end
|
end
|
||||||
@sprite.x = @x
|
@sprite.x = @x
|
||||||
|
|
@ -30,8 +30,8 @@ class Particle
|
||||||
@y = val
|
@y = val
|
||||||
height = @sprite.bitmap.height * @sprite.zoom_y
|
height = @sprite.bitmap.height * @sprite.zoom_y
|
||||||
if @y < -height
|
if @y < -height
|
||||||
@y = 480 + height
|
@y = Graphics.height + height
|
||||||
elsif @y > 480 + height
|
elsif @y > Graphics.height + height
|
||||||
@y = -height
|
@y = -height
|
||||||
end
|
end
|
||||||
@sprite.y = @y
|
@sprite.y = @y
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,16 @@ class Scene_Map
|
||||||
@item_menu_refresh = false
|
@item_menu_refresh = false
|
||||||
# Make item icon
|
# Make item icon
|
||||||
@item_icon = Sprite.new
|
@item_icon = Sprite.new
|
||||||
@item_icon.x = 640 - 64
|
@item_icon.x = Graphics.width - 64
|
||||||
@item_icon.y = 480 - 64
|
@item_icon.y = Graphics.height - 64
|
||||||
@item_icon.z = 9000
|
@item_icon.z = 9000
|
||||||
@item_icon.zoom_x = 2.0
|
@item_icon.zoom_x = 2.0
|
||||||
@item_icon.zoom_y = 2.0
|
@item_icon.zoom_y = 2.0
|
||||||
@item_id = 0
|
@item_id = 0
|
||||||
# Make item flash (for clover)
|
# Make item flash (for clover)
|
||||||
@item_icon_flash = Sprite.new
|
@item_icon_flash = Sprite.new
|
||||||
@item_icon_flash.x = 640 - 64
|
@item_icon_flash.x = Graphics.width - 64
|
||||||
@item_icon_flash.y = 480 - 64
|
@item_icon_flash.y = Graphics.height - 64
|
||||||
@item_icon_flash.z = 10000
|
@item_icon_flash.z = 10000
|
||||||
@item_icon_flash.zoom_x = 2.0
|
@item_icon_flash.zoom_x = 2.0
|
||||||
@item_icon_flash.zoom_y = 2.0
|
@item_icon_flash.zoom_y = 2.0
|
||||||
|
|
@ -53,8 +53,8 @@ class Scene_Map
|
||||||
@window_settings = Window_Settings.new
|
@window_settings = Window_Settings.new
|
||||||
# Fade to black transition
|
# Fade to black transition
|
||||||
@blackfade = Sprite.new
|
@blackfade = Sprite.new
|
||||||
@blackfade.bitmap = Bitmap.new(640, 480)
|
@blackfade.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@blackfade.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0))
|
@blackfade.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0))
|
||||||
@blackfade.visible = false
|
@blackfade.visible = false
|
||||||
@blackfade.z = 9999
|
@blackfade.z = 9999
|
||||||
# Transition run
|
# Transition run
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
||||||
class Scene_Title
|
class Scene_Title
|
||||||
MENU_X = 640 - 150
|
MENU_X = Graphics.width - 150
|
||||||
MENU_Y = 480 - 100
|
MENU_Y = Graphics.height - 100
|
||||||
SDLVer = "#{Sunshine::SDLVersion_major}.#{Sunshine::SDLVersion_minor}.#{Sunshine::SDLVersion_micro}"
|
SDLVer = "#{Sunshine::SDLVersion_major}.#{Sunshine::SDLVersion_minor}.#{Sunshine::SDLVersion_micro}"
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# * Main Processing
|
# * Main Processing
|
||||||
|
|
@ -47,11 +47,19 @@ class Scene_Title
|
||||||
@sprite.bitmap = RPG::Cache.title(translation_name)
|
@sprite.bitmap = RPG::Cache.title(translation_name)
|
||||||
else
|
else
|
||||||
if File.exist?("badend.lock")
|
if File.exist?("badend.lock")
|
||||||
|
if Graphics.width == 1280
|
||||||
|
@sprite.bitmap = RPG::Cache.title("badend_16")
|
||||||
|
else
|
||||||
@sprite.bitmap = RPG::Cache.title("badend")
|
@sprite.bitmap = RPG::Cache.title("badend")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if Graphics.width == 1280
|
||||||
|
@sprite.bitmap = RPG::Cache.title("normal_16")
|
||||||
else
|
else
|
||||||
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
|
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
# check for debug file to add debug items
|
# check for debug file to add debug items
|
||||||
if Window_Settings.DebugIsEnabled
|
if Window_Settings.DebugIsEnabled
|
||||||
# debug save
|
# debug save
|
||||||
|
|
@ -67,7 +75,7 @@ class Scene_Title
|
||||||
# Create/render menu options
|
# Create/render menu options
|
||||||
@menu = Sprite.new
|
@menu = Sprite.new
|
||||||
@menu.z += 1
|
@menu.z += 1
|
||||||
@menu.bitmap = Bitmap.new(640, 480)
|
@menu.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y, 150, 24, tr("Start"))
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y + 25, 150, 24, tr("Settings"))
|
||||||
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
|
@menu.bitmap.draw_text(MENU_X, MENU_Y + 50, 150, 24, tr("Exit"))
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ class Spriteset_Map
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def initialize(spriteset = nil)
|
def initialize(spriteset = nil)
|
||||||
# Make viewports
|
# Make viewports
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport_bg = Viewport.new(0, 0, 640, 480)
|
@viewport_bg = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport_pics = Viewport.new(0, 0, 640, 480)
|
@viewport_pics = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport_particles = Viewport.new(0, 0, 640, 480)
|
@viewport_particles = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport_lights = Viewport.new(0, 0, 640, 480)
|
@viewport_lights = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@viewport_flash = Viewport.new(0, 0, 640, 480)
|
@viewport_flash = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
|
|
||||||
@viewport_bg.z = -500
|
@viewport_bg.z = -500
|
||||||
@viewport_lights.z = 200
|
@viewport_lights.z = 200
|
||||||
|
|
@ -80,7 +80,11 @@ class Spriteset_Map
|
||||||
# Make lightbulb sprite
|
# Make lightbulb sprite
|
||||||
@bulb = Sprite.new(@viewport_lights)
|
@bulb = Sprite.new(@viewport_lights)
|
||||||
@bulb.x = -80
|
@bulb.x = -80
|
||||||
|
if Graphics.width == 1280
|
||||||
|
@bulb.bitmap = RPG::Cache.light('bulb_16')
|
||||||
|
else
|
||||||
@bulb.bitmap = RPG::Cache.light('bulb')
|
@bulb.bitmap = RPG::Cache.light('bulb')
|
||||||
|
end
|
||||||
@bulb.opacity = has_lightbulb? ? 255 : 0
|
@bulb.opacity = has_lightbulb? ? 255 : 0
|
||||||
# Panorama animation timer
|
# Panorama animation timer
|
||||||
@pan_animate_timer = 0
|
@pan_animate_timer = 0
|
||||||
|
|
@ -178,6 +182,7 @@ class Spriteset_Map
|
||||||
end
|
end
|
||||||
@panorama.bitmap = RPG::Cache.panorama(@panorama_name + (1 + @pan_frame_index).to_s, @panorama_hue)
|
@panorama.bitmap = RPG::Cache.panorama(@panorama_name + (1 + @pan_frame_index).to_s, @panorama_hue)
|
||||||
@panorama2.bitmap = RPG::Cache.panorama(@panorama_name + (1 + @pan_frame_index).to_s, @panorama_hue)
|
@panorama2.bitmap = RPG::Cache.panorama(@panorama_name + (1 + @pan_frame_index).to_s, @panorama_hue)
|
||||||
|
|
||||||
else
|
else
|
||||||
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
|
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
|
||||||
end
|
end
|
||||||
|
|
@ -247,13 +252,13 @@ class Spriteset_Map
|
||||||
$game_map.pan_move_offset += 1
|
$game_map.pan_move_offset += 1
|
||||||
end
|
end
|
||||||
if $game_map.clamped_x
|
if $game_map.clamped_x
|
||||||
x = ($game_player.real_x.to_f / (($game_map.width - 1) * 128)) * (@panorama.bitmap.width * $game_map.pan_zoom - 640)
|
x = ($game_player.real_x.to_f / (($game_map.width - 1) * 128)) * (@panorama.bitmap.width * $game_map.pan_zoom - Graphics.width)
|
||||||
@panorama.ox = x < 0.0 ? 0.0 : x
|
@panorama.ox = x < 0.0 ? 0.0 : x
|
||||||
else
|
else
|
||||||
@panorama.ox = $game_map.display_x / ($game_map.pan_onetoone ? 4 : 8)
|
@panorama.ox = $game_map.display_x / ($game_map.pan_onetoone ? 4 : 8)
|
||||||
end
|
end
|
||||||
if $game_map.clamped_y
|
if $game_map.clamped_y
|
||||||
y = ($game_player.real_y.to_f / (($game_map.height - 1) * 128)) * (@panorama.bitmap.height * $game_map.pan_zoom - 480)
|
y = ($game_player.real_y.to_f / (($game_map.height - 1) * 128)) * (@panorama.bitmap.height * $game_map.pan_zoom - Graphics.height)
|
||||||
@panorama.oy = y < 0.0 ? 0.0 : y
|
@panorama.oy = y < 0.0 ? 0.0 : y
|
||||||
else
|
else
|
||||||
@panorama.oy = $game_map.pan_offset_y + $game_map.display_y / ($game_map.pan_onetoone ? 4 : 8)
|
@panorama.oy = $game_map.pan_offset_y + $game_map.display_y / ($game_map.pan_onetoone ? 4 : 8)
|
||||||
|
|
@ -304,10 +309,10 @@ class Spriteset_Map
|
||||||
# no point in updating the sprite if offscreen
|
# no point in updating the sprite if offscreen
|
||||||
# this greatly increases performance on larger maps
|
# this greatly increases performance on larger maps
|
||||||
|
|
||||||
((sprite.character.real_x + (sprite.ox*4) > $game_map.display_x - 128) &&
|
((sprite.character.real_x + (sprite.ox*4) > Graphics.width - 128) &&
|
||||||
(sprite.character.real_x - (sprite.ox*4) < $game_map.display_x + (21 * 128)) &&
|
(sprite.character.real_x - (sprite.ox*4) < Graphics.width + (21 * 128)) &&
|
||||||
(sprite.character.real_y + (sprite.oy*4) > ($game_map.display_y) - 128) &&
|
(sprite.character.real_y + (sprite.oy*4) > (Graphics.height) - 128) &&
|
||||||
(sprite.character.real_y - (sprite.oy*4) < ($game_map.display_y) + (17 * 128)))
|
(sprite.character.real_y - (sprite.oy*4) < (Graphics.height) + (17 * 128)))
|
||||||
sprite.update
|
sprite.update
|
||||||
else
|
else
|
||||||
sprite.update_fast
|
sprite.update_fast
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,10 @@ class Window_Settings
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def initialize
|
def initialize
|
||||||
@viewport = Viewport.new(0, 0, 640, 480)
|
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||||
@bg = Sprite.new(@viewport)
|
@bg = Sprite.new(@viewport)
|
||||||
@bg.bitmap = Bitmap.new(640, 480)
|
@bg.bitmap = Bitmap.new(Graphics.width, Graphics.height)
|
||||||
@bg.bitmap.fill_rect(0, 0, 640, 480, Color.new(0, 0, 0, 128))
|
@bg.bitmap.fill_rect(0, 0, Graphics.width, Graphics.height, Color.new(0, 0, 0, 128))
|
||||||
@title = Sprite.new(@viewport)
|
@title = Sprite.new(@viewport)
|
||||||
@title.bitmap = Bitmap.new(320, TITLE_MARGIN)
|
@title.bitmap = Bitmap.new(320, TITLE_MARGIN)
|
||||||
@title.bitmap.font.size = 40
|
@title.bitmap.font.size = 40
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Window_Status < Window_Base
|
||||||
# actor : actor
|
# actor : actor
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
def initialize(actor)
|
def initialize(actor)
|
||||||
super(0, 0, 640, 480)
|
super(0, 0, Graphics.width, Graphics.height)
|
||||||
self.contents = Bitmap.new(width - 32, height - 32)
|
self.contents = Bitmap.new(width - 32, height - 32)
|
||||||
@actor = actor
|
@actor = actor
|
||||||
refresh
|
refresh
|
||||||
|
|
|
||||||
|
|
@ -55,18 +55,15 @@
|
||||||
|
|
||||||
/* Normalize (= ensure width and
|
/* Normalize (= ensure width and
|
||||||
* height are positive) */
|
* height are positive) */
|
||||||
static IntRect normalizedRect(const IntRect &rect)
|
static IntRect normalizedRect(const IntRect &rect){
|
||||||
{
|
|
||||||
IntRect norm = rect;
|
IntRect norm = rect;
|
||||||
|
|
||||||
if (norm.w < 0)
|
if (norm.w < 0){
|
||||||
{
|
|
||||||
norm.w = -norm.w;
|
norm.w = -norm.w;
|
||||||
norm.x -= norm.w;
|
norm.x -= norm.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (norm.h < 0)
|
if (norm.h < 0){
|
||||||
{
|
|
||||||
norm.h = -norm.h;
|
norm.h = -norm.h;
|
||||||
norm.y -= norm.h;
|
norm.y -= norm.h;
|
||||||
}
|
}
|
||||||
|
|
@ -74,8 +71,7 @@ static IntRect normalizedRect(const IntRect &rect)
|
||||||
return norm;
|
return norm;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BitmapPrivate
|
struct BitmapPrivate{
|
||||||
{
|
|
||||||
Bitmap *self;
|
Bitmap *self;
|
||||||
|
|
||||||
TEXFBO gl;
|
TEXFBO gl;
|
||||||
|
|
@ -981,8 +977,7 @@ static void applyShadow(SDL_Surface *&in, const SDL_PixelFormatDetails* fm, cons
|
||||||
in = out;
|
in = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
void Bitmap::drawText(const IntRect &rect, const char *str, int align){
|
||||||
{
|
|
||||||
guardDisposed();
|
guardDisposed();
|
||||||
|
|
||||||
GUARD_MEGA;
|
GUARD_MEGA;
|
||||||
|
|
@ -1021,8 +1016,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
|
|
||||||
/* outline using TTF_Outline and blending it together with SDL_BlitSurface
|
/* outline using TTF_Outline and blending it together with SDL_BlitSurface
|
||||||
* FIXME: outline is forced to have the same opacity as the font color */
|
* FIXME: outline is forced to have the same opacity as the font color */
|
||||||
if (p->font->getOutline())
|
if (p->font->getOutline()){
|
||||||
{
|
|
||||||
SDL_Color co = outColor.toSDLColor();
|
SDL_Color co = outColor.toSDLColor();
|
||||||
co.a = 255;
|
co.a = 255;
|
||||||
SDL_Surface *outline;
|
SDL_Surface *outline;
|
||||||
|
|
@ -1046,8 +1040,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
|
|
||||||
int alignX = rect.x;
|
int alignX = rect.x;
|
||||||
|
|
||||||
switch (align)
|
switch (align){
|
||||||
{
|
|
||||||
default:
|
default:
|
||||||
case Left :
|
case Left :
|
||||||
break;
|
break;
|
||||||
|
|
@ -1078,10 +1071,8 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
|
|
||||||
bool fastBlit = false; //!p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
|
bool fastBlit = false; //!p->touchesTaintedArea(posRect) && txtAlpha == 1.0f;
|
||||||
|
|
||||||
if (fastBlit)
|
if (fastBlit){
|
||||||
{
|
if (squeeze == 1.0f && !shState->config().subImageFix){
|
||||||
if (squeeze == 1.0f && !shState->config().subImageFix)
|
|
||||||
{
|
|
||||||
/* Even faster: upload directly to bitmap texture.
|
/* Even faster: upload directly to bitmap texture.
|
||||||
* We have to make sure the posRect lies within the texture
|
* We have to make sure the posRect lies within the texture
|
||||||
* boundaries or texSubImage will generate errors.
|
* boundaries or texSubImage will generate errors.
|
||||||
|
|
@ -1102,13 +1093,11 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
|
|
||||||
/* If we have no intersection at all,
|
/* If we have no intersection at all,
|
||||||
* there's nothing to upload to begin with */
|
* there's nothing to upload to begin with */
|
||||||
if (SDL_GetRectIntersection(&btmRect, &txtRect, &inters))
|
if (SDL_GetRectIntersection(&btmRect, &txtRect, &inters)){
|
||||||
{
|
|
||||||
bool subImage = false;
|
bool subImage = false;
|
||||||
int subSrcX = 0, subSrcY = 0;
|
int subSrcX = 0, subSrcY = 0;
|
||||||
|
|
||||||
if (inters.w != txtRect.w || inters.h != txtRect.h)
|
if (inters.w != txtRect.w || inters.h != txtRect.h){
|
||||||
{
|
|
||||||
/* Clip the text surface */
|
/* Clip the text surface */
|
||||||
subSrcX = inters.x - txtRect.x;
|
subSrcX = inters.x - txtRect.x;
|
||||||
subSrcY = inters.y - txtRect.y;
|
subSrcY = inters.y - txtRect.y;
|
||||||
|
|
@ -1122,14 +1111,12 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
|
|
||||||
TEX::bind(p->gl.tex);
|
TEX::bind(p->gl.tex);
|
||||||
|
|
||||||
if (!subImage)
|
if (!subImage){
|
||||||
{
|
|
||||||
TEX::uploadSubImage(posRect.x, posRect.y,
|
TEX::uploadSubImage(posRect.x, posRect.y,
|
||||||
posRect.w, posRect.h,
|
posRect.w, posRect.h,
|
||||||
txtSurf->pixels, GL_RGBA);
|
txtSurf->pixels, GL_RGBA);
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
GLMeta::subRectImageUpload(txtSurf->w, subSrcX, subSrcY,
|
GLMeta::subRectImageUpload(txtSurf->w, subSrcX, subSrcY,
|
||||||
posRect.x, posRect.y,
|
posRect.x, posRect.y,
|
||||||
posRect.w, posRect.h,
|
posRect.w, posRect.h,
|
||||||
|
|
@ -1138,8 +1125,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
/* Squeezing involved: need to use intermediary TexFBO */
|
/* Squeezing involved: need to use intermediary TexFBO */
|
||||||
TEXFBO &gpTF = shState->gpTexFBO(txtSurf->w, txtSurf->h);
|
TEXFBO &gpTF = shState->gpTexFBO(txtSurf->w, txtSurf->h);
|
||||||
|
|
||||||
|
|
@ -1153,8 +1139,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
GLMeta::blitEnd();
|
GLMeta::blitEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
{
|
|
||||||
/* Aquire a partial copy of the destination
|
/* Aquire a partial copy of the destination
|
||||||
* buffer we're about to render to */
|
* buffer we're about to render to */
|
||||||
TEXFBO &gpTex2 = shState->gpTexFBO(posRect.w, posRect.h);
|
TEXFBO &gpTex2 = shState->gpTexFBO(posRect.w, posRect.h);
|
||||||
|
|
@ -1199,9 +1184,7 @@ void Bitmap::drawText(const IntRect &rect, const char *str, int align)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* http://www.lemoda.net/c/utf8-to-ucs2/index.html */
|
/* http://www.lemoda.net/c/utf8-to-ucs2/index.html */
|
||||||
static uint16_t utf8_to_ucs2(const char *_input,
|
static uint16_t utf8_to_ucs2(const char *_input, const char **end_ptr){
|
||||||
const char **end_ptr)
|
|
||||||
{
|
|
||||||
const unsigned char *input =
|
const unsigned char *input =
|
||||||
reinterpret_cast<const unsigned char*>(_input);
|
reinterpret_cast<const unsigned char*>(_input);
|
||||||
*end_ptr = _input;
|
*end_ptr = _input;
|
||||||
|
|
@ -1209,15 +1192,13 @@ static uint16_t utf8_to_ucs2(const char *_input,
|
||||||
if (input[0] == 0)
|
if (input[0] == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (input[0] < 0x80)
|
if (input[0] < 0x80){
|
||||||
{
|
|
||||||
*end_ptr = _input + 1;
|
*end_ptr = _input + 1;
|
||||||
|
|
||||||
return input[0];
|
return input[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((input[0] & 0xE0) == 0xE0)
|
if ((input[0] & 0xE0) == 0xE0){
|
||||||
{
|
|
||||||
if (input[1] == 0 || input[2] == 0)
|
if (input[1] == 0 || input[2] == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -1228,8 +1209,7 @@ static uint16_t utf8_to_ucs2(const char *_input,
|
||||||
(input[2] & 0x3F);
|
(input[2] & 0x3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((input[0] & 0xC0) == 0xC0)
|
if ((input[0] & 0xC0) == 0xC0){
|
||||||
{
|
|
||||||
if (input[1] == 0)
|
if (input[1] == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -1242,8 +1222,7 @@ static uint16_t utf8_to_ucs2(const char *_input,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntRect Bitmap::textSize(const char *str)
|
IntRect Bitmap::textSize(const char *str){
|
||||||
{
|
|
||||||
guardDisposed();
|
guardDisposed();
|
||||||
|
|
||||||
GUARD_MEGA;
|
GUARD_MEGA;
|
||||||
|
|
@ -1275,46 +1254,38 @@ IntRect Bitmap::textSize(const char *str)
|
||||||
|
|
||||||
DEF_ATTR_RD_SIMPLE(Bitmap, Font, Font&, *p->font)
|
DEF_ATTR_RD_SIMPLE(Bitmap, Font, Font&, *p->font)
|
||||||
|
|
||||||
void Bitmap::setFont(Font &value)
|
void Bitmap::setFont(Font &value){
|
||||||
{
|
|
||||||
*p->font = value;
|
*p->font = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::setInitFont(Font *value)
|
void Bitmap::setInitFont(Font *value){
|
||||||
{
|
|
||||||
p->font = value;
|
p->font = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEXFBO &Bitmap::getGLTypes()
|
TEXFBO &Bitmap::getGLTypes(){
|
||||||
{
|
|
||||||
return p->gl;
|
return p->gl;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *Bitmap::megaSurface() const
|
SDL_Surface *Bitmap::megaSurface() const{
|
||||||
{
|
|
||||||
return p->megaSurface;
|
return p->megaSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::ensureNonMega() const
|
void Bitmap::ensureNonMega() const{
|
||||||
{
|
|
||||||
if (isDisposed())
|
if (isDisposed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GUARD_MEGA;
|
GUARD_MEGA;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::bindTex(ShaderBase &shader)
|
void Bitmap::bindTex(ShaderBase &shader){
|
||||||
{
|
|
||||||
p->bindTexture(shader);
|
p->bindTexture(shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::taintArea(const IntRect &rect)
|
void Bitmap::taintArea(const IntRect &rect){
|
||||||
{
|
|
||||||
p->addTaintedArea(rect);
|
p->addTaintedArea(rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bitmap::releaseResources()
|
void Bitmap::releaseResources(){
|
||||||
{
|
|
||||||
if (p->megaSurface)
|
if (p->megaSurface)
|
||||||
SDL_DestroySurface(p->megaSurface);
|
SDL_DestroySurface(p->megaSurface);
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ void Config::read(int argc, char *argv[]){
|
||||||
PO_DESC(debugMode, bool, false) \
|
PO_DESC(debugMode, bool, false) \
|
||||||
PO_DESC(screenMode, bool, false) \
|
PO_DESC(screenMode, bool, false) \
|
||||||
PO_DESC(printFPS, bool, false) \
|
PO_DESC(printFPS, bool, false) \
|
||||||
|
PO_DESC(EnableSixteenByNine, bool, false) \
|
||||||
PO_DESC(fullscreen, bool, false) \
|
PO_DESC(fullscreen, bool, false) \
|
||||||
PO_DESC(fixedAspectRatio, bool, true) \
|
PO_DESC(fixedAspectRatio, bool, true) \
|
||||||
PO_DESC(smoothScaling, bool, true) \
|
PO_DESC(smoothScaling, bool, true) \
|
||||||
|
|
@ -170,8 +171,14 @@ void Config::read(int argc, char *argv[]){
|
||||||
rgssVersion = 1;
|
rgssVersion = 1;
|
||||||
game.title = "OneShot: Sunshine";
|
game.title = "OneShot: Sunshine";
|
||||||
game.scripts = "Data/xScripts.rxdata";
|
game.scripts = "Data/xScripts.rxdata";
|
||||||
|
|
||||||
|
if (EnableSixteenByNine){
|
||||||
|
defScreenW = 1280;
|
||||||
|
defScreenH = 720;
|
||||||
|
}else{
|
||||||
defScreenW = 640;
|
defScreenW = 640;
|
||||||
defScreenH = 480;
|
defScreenH = 480;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef STEAM
|
#ifdef STEAM
|
||||||
/* Override fullscreen config if Big Picture */
|
/* Override fullscreen config if Big Picture */
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ struct Config{
|
||||||
bool fixedAspectRatio;
|
bool fixedAspectRatio;
|
||||||
bool smoothScaling;
|
bool smoothScaling;
|
||||||
bool vsync;
|
bool vsync;
|
||||||
|
bool EnableSixteenByNine;
|
||||||
int defScreenW;
|
int defScreenW;
|
||||||
int defScreenH;
|
int defScreenH;
|
||||||
std::string windowTitle;
|
std::string windowTitle;
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,7 @@
|
||||||
|
|
||||||
#include <SDL3/SDL_surface.h>
|
#include <SDL3/SDL_surface.h>
|
||||||
|
|
||||||
namespace GLMeta
|
namespace GLMeta{
|
||||||
{
|
|
||||||
|
|
||||||
/* EXT_unpack_subimage */
|
/* EXT_unpack_subimage */
|
||||||
void subRectImageUpload(GLint srcW, GLint srcX, GLint srcY,
|
void subRectImageUpload(GLint srcW, GLint srcX, GLint srcY,
|
||||||
|
|
@ -38,8 +37,7 @@ void subRectImageUpload(GLint srcW, GLint srcX, GLint srcY,
|
||||||
void subRectImageEnd();
|
void subRectImageEnd();
|
||||||
|
|
||||||
/* ARB_vertex_array_object */
|
/* ARB_vertex_array_object */
|
||||||
struct VAO
|
struct VAO{
|
||||||
{
|
|
||||||
/* Set manually, then call vaoInit() */
|
/* Set manually, then call vaoInit() */
|
||||||
const VertexAttribute *attr;
|
const VertexAttribute *attr;
|
||||||
size_t attrCount;
|
size_t attrCount;
|
||||||
|
|
@ -52,8 +50,7 @@ struct VAO
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class VertexType>
|
template<class VertexType>
|
||||||
inline void vaoFillInVertexData(VAO &vao)
|
inline void vaoFillInVertexData(VAO &vao){
|
||||||
{
|
|
||||||
vao.attr = VertexTraits<VertexType>::attr;
|
vao.attr = VertexTraits<VertexType>::attr;
|
||||||
vao.attrCount = VertexTraits<VertexType>::attrCount;
|
vao.attrCount = VertexTraits<VertexType>::attrCount;
|
||||||
vao.vertSize = sizeof(VertexType);
|
vao.vertSize = sizeof(VertexType);
|
||||||
|
|
|
||||||
|
|
@ -27,23 +27,19 @@
|
||||||
|
|
||||||
#include <SDL3/SDL_rect.h>
|
#include <SDL3/SDL_rect.h>
|
||||||
|
|
||||||
static void applyBool(GLenum state, bool mode)
|
static void applyBool(GLenum state, bool mode){
|
||||||
{
|
|
||||||
mode ? gl.Enable(state) : gl.Disable(state);
|
mode ? gl.Enable(state) : gl.Disable(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLClearColor::apply(const Vec4 &value)
|
void GLClearColor::apply(const Vec4 &value){
|
||||||
{
|
|
||||||
gl.ClearColor(value.x, value.y, value.z, value.w);
|
gl.ClearColor(value.x, value.y, value.z, value.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScissorBox::apply(const IntRect &value)
|
void GLScissorBox::apply(const IntRect &value){
|
||||||
{
|
|
||||||
gl.Scissor(value.x, value.y, value.w, value.h);
|
gl.Scissor(value.x, value.y, value.w, value.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScissorBox::setIntersect(const IntRect &value)
|
void GLScissorBox::setIntersect(const IntRect &value){
|
||||||
{
|
|
||||||
const IntRect ¤t = get();
|
const IntRect ¤t = get();
|
||||||
|
|
||||||
SDL_Rect r1 = { current.x, current.y, current.w, current.h };
|
SDL_Rect r1 = { current.x, current.y, current.w, current.h };
|
||||||
|
|
@ -56,13 +52,11 @@ void GLScissorBox::setIntersect(const IntRect &value)
|
||||||
set(IntRect(result.x, result.y, result.w, result.h));
|
set(IntRect(result.x, result.y, result.w, result.h));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLScissorTest::apply(const bool &value)
|
void GLScissorTest::apply(const bool &value){
|
||||||
{
|
|
||||||
applyBool(GL_SCISSOR_TEST, value);
|
applyBool(GL_SCISSOR_TEST, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBlendMode::apply(const BlendType &value)
|
void GLBlendMode::apply(const BlendType &value){
|
||||||
{
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case BlendKeepDestAlpha :
|
case BlendKeepDestAlpha :
|
||||||
|
|
@ -92,28 +86,23 @@ void GLBlendMode::apply(const BlendType &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBlend::apply(const bool &value)
|
void GLBlend::apply(const bool &value){
|
||||||
{
|
|
||||||
applyBool(GL_BLEND, value);
|
applyBool(GL_BLEND, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLViewport::apply(const IntRect &value)
|
void GLViewport::apply(const IntRect &value){
|
||||||
{
|
|
||||||
gl.Viewport(value.x, value.y, value.w, value.h);
|
gl.Viewport(value.x, value.y, value.w, value.h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLProgram::apply(const unsigned int &value)
|
void GLProgram::apply(const unsigned int &value){
|
||||||
{
|
|
||||||
gl.UseProgram(value);
|
gl.UseProgram(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLState::Caps::Caps()
|
GLState::Caps::Caps(){
|
||||||
{
|
|
||||||
gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
|
gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTexSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLState::GLState(const Config &conf)
|
GLState::GLState(const Config &conf){
|
||||||
{
|
|
||||||
gl.Disable(GL_DEPTH_TEST);
|
gl.Disable(GL_DEPTH_TEST);
|
||||||
|
|
||||||
clearColor.init(Vec4(0, 0, 0, 1));
|
clearColor.init(Vec4(0, 0, 0, 1));
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define DEF_SCREEN_W (rgssVer == 1 ? 640 : 544)
|
#define DEF_SCREEN_W (EnableSixteenByNine == 1 ? 640 : 544)
|
||||||
#define DEF_SCREEN_H (rgssVer == 1 ? 480 : 416)
|
#define DEF_SCREEN_H (EnableSixteenByNine == 1 ? 480 : 416)
|
||||||
#define DEF_FRAMERATE (rgssVer == 1 ? 40 : 60)
|
#define DEF_FRAMERATE (60)
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
#define OS_W32
|
#define OS_W32
|
||||||
|
|
@ -129,8 +129,7 @@ private:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScreenScene : public Scene
|
class ScreenScene : public Scene{
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
ScreenScene(int width, int height)
|
ScreenScene(int width, int height)
|
||||||
: pp(width, height)
|
: pp(width, height)
|
||||||
|
|
@ -459,7 +458,7 @@ struct GraphicsPrivate{
|
||||||
TEX::ID obscuredTex;
|
TEX::ID obscuredTex;
|
||||||
|
|
||||||
GraphicsPrivate(RGSSThreadData *rtData)
|
GraphicsPrivate(RGSSThreadData *rtData)
|
||||||
: scRes(DEF_SCREEN_W, DEF_SCREEN_H),
|
: scRes(rtData->config.defScreenW, rtData->config.defScreenH),
|
||||||
scSize(scRes),
|
scSize(scRes),
|
||||||
winSize(rtData->config.defScreenW, rtData->config.defScreenH),
|
winSize(rtData->config.defScreenW, rtData->config.defScreenH),
|
||||||
screen(scRes.x, scRes.y),
|
screen(scRes.x, scRes.y),
|
||||||
|
|
@ -487,7 +486,7 @@ struct GraphicsPrivate{
|
||||||
TEX::bind(obscuredTex);
|
TEX::bind(obscuredTex);
|
||||||
TEX::setRepeat(false);
|
TEX::setRepeat(false);
|
||||||
TEX::setSmooth(false);
|
TEX::setSmooth(false);
|
||||||
gl.TexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, 640, 480, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0);
|
gl.TexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE8, scRes.x, scRes.y, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~GraphicsPrivate(){
|
~GraphicsPrivate(){
|
||||||
|
|
@ -575,7 +574,7 @@ struct GraphicsPrivate{
|
||||||
void redrawScreen(){
|
void redrawScreen(){
|
||||||
if (shState->oneshot().obscuredDirty){
|
if (shState->oneshot().obscuredDirty){
|
||||||
TEX::bind(obscuredTex);
|
TEX::bind(obscuredTex);
|
||||||
TEX::uploadSubImage(0, 0, 640, 480, shState->oneshot().obscuredMap().data(), GL_LUMINANCE);
|
TEX::uploadSubImage(0, 0, scRes.x, scRes.y, shState->oneshot().obscuredMap().data(), GL_LUMINANCE);
|
||||||
shState->oneshot().obscuredDirty = false;
|
shState->oneshot().obscuredDirty = false;
|
||||||
}
|
}
|
||||||
screen.composite();
|
screen.composite();
|
||||||
|
|
@ -875,8 +874,8 @@ int Graphics::height() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::resizeScreen(int width, int height){
|
void Graphics::resizeScreen(int width, int height){
|
||||||
width = clamp(width, 1, 640);
|
width = clamp(width, 1, p->scRes.x);
|
||||||
height = clamp(height, 1, 480);
|
height = clamp(height, 1, p->scRes.y);
|
||||||
|
|
||||||
Vec2i size(width, height);
|
Vec2i size(width, height);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,6 @@ int main(int argc, char *argv[]){
|
||||||
// winFlags |= SDL_WINDOW_RESIZABLE;
|
// winFlags |= SDL_WINDOW_RESIZABLE;
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags);
|
win = SDL_CreateWindow(conf.windowTitle.c_str(), conf.defScreenW, conf.defScreenH, winFlags);
|
||||||
if (conf.fullscreen)
|
if (conf.fullscreen)
|
||||||
SDL_SetWindowFullscreen(win, true);
|
SDL_SetWindowFullscreen(win, true);
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,13 @@
|
||||||
#include "debugwriter.h"
|
#include "debugwriter.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
#include <SDL3_image/SDL_image.h>
|
#include <SDL3_image/SDL_image.h>
|
||||||
#include <SDL3_ttf/SDL_ttf.h>
|
#include <SDL3_ttf/SDL_ttf.h>
|
||||||
|
|
||||||
|
|
||||||
// OS-Specific code
|
// OS-Specific code
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
#define OS_W32
|
#define OS_W32
|
||||||
|
|
@ -41,6 +43,7 @@
|
||||||
#error "Operating system not detected or unsupported."
|
#error "Operating system not detected or unsupported."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define DEF_SCREEN_W 640
|
#define DEF_SCREEN_W 640
|
||||||
#define DEF_SCREEN_H 480
|
#define DEF_SCREEN_H 480
|
||||||
|
|
||||||
|
|
@ -130,6 +133,9 @@ static int linux_dialog(void *rawData){
|
||||||
gtk_main_quit();
|
gtk_main_quit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined OS_W32
|
#elif defined OS_W32
|
||||||
/* Convert WCHAR pointer to std::string */
|
/* Convert WCHAR pointer to std::string */
|
||||||
static std::string w32_fromWide(const WCHAR *ustr){
|
static std::string w32_fromWide(const WCHAR *ustr){
|
||||||
|
|
@ -167,7 +173,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
p = new OneshotPrivate();
|
p = new OneshotPrivate();
|
||||||
p->window = threadData.window;
|
p->window = threadData.window;
|
||||||
p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1);
|
p->savePath = threadData.config.commonDataPath.substr(0, threadData.config.commonDataPath.size() - 1);
|
||||||
p->obscuredMap.resize(640 * 480, 255);
|
p->obscuredMap.resize(threadData.config.defScreenW * threadData.config.defScreenH, 255);
|
||||||
obscuredDirty = true;
|
obscuredDirty = true;
|
||||||
p->winX = 0;
|
p->winX = 0;
|
||||||
p->winY = 0;
|
p->winY = 0;
|
||||||
|
|
@ -459,7 +465,7 @@ bool Oneshot::msgbox(int type, const char *body, const char *title){
|
||||||
title = "";
|
title = "";
|
||||||
#ifdef OS_LINUX
|
#ifdef OS_LINUX
|
||||||
linux_DialogData data = {type, body, title, 0};
|
linux_DialogData data = {type, body, title, 0};
|
||||||
gdk_threads_add_idle(linux_dialog, &data);
|
g_idle_add(linux_dialog, &data);
|
||||||
gtk_main();
|
gtk_main();
|
||||||
return data.result;
|
return data.result;
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue