This commit is contained in:
DepressedTWM 2026-08-15 21:54:59 +04:00
commit de008ddea2
9 changed files with 536 additions and 83 deletions

View file

@ -80,6 +80,7 @@ DEF_PROP_I(Viewport, OY)
DEF_PROP_F(Viewport, ScaleX)
DEF_PROP_F(Viewport, ScaleY)
DEF_PROP_F(Viewport, Rotation)
void viewportBindingInit(){
VALUE klass = rb_define_class("Viewport", rb_cObject);
@ -91,12 +92,13 @@ void viewportBindingInit(){
_rb_define_method(klass, "initialize", viewportInitialize);
INIT_PROP_BIND( Viewport, Rect, "rect" );
INIT_PROP_BIND( Viewport, OX, "ox" );
INIT_PROP_BIND( Viewport, OY, "oy" );
INIT_PROP_BIND( Viewport, ScaleX, "scale_x");
INIT_PROP_BIND( Viewport, ScaleY, "scale_y");
INIT_PROP_BIND( Viewport, Color, "color" );
INIT_PROP_BIND( Viewport, Tone, "tone" );
INIT_PROP_BIND( Viewport, Rect, "rect" );
INIT_PROP_BIND( Viewport, OX, "ox" );
INIT_PROP_BIND( Viewport, OY, "oy" );
INIT_PROP_BIND( Viewport, ScaleX, "scale_x" );
INIT_PROP_BIND( Viewport, ScaleY, "scale_y" );
INIT_PROP_BIND( Viewport, Rotation, "rotation");
INIT_PROP_BIND( Viewport, Color, "color" );
INIT_PROP_BIND( Viewport, Tone, "tone" );
}

View file

@ -45,6 +45,8 @@
// GNOME settings
static GSettings *bgsetting;
static std::string defPictureURI, defPictureOptions, defPrimaryColor, defColorShading;
static std::string defPictureURIDark;
static bool hasPictureURIDark = false;
// XFCE settings
static XfconfChannel* bgchannel;
static int defPictureStyle;
@ -70,6 +72,16 @@
#endif
#ifdef unix_like
static bool gsettingsHasKey(GSettings *settings, const char *key){
GSettingsSchema *schema = NULL;
g_object_get(settings, "settings-schema", &schema, NULL);
if (!schema)
return false;
bool has = g_settings_schema_has_key(schema, key);
g_settings_schema_unref(schema);
return has;
}
void desktopEnvironmentInit(){
printf("[desktopEnvironmentInit] desktopEnvironmentInit()\n");
if (desktop != "uninitialized")
@ -165,6 +177,9 @@
else if (desktop == "deepin") bgsetting = g_settings_new("com.deepin.wrap.gnome.desktop.background");
else bgsetting = g_settings_new("org.gnome.desktop.background");
defPictureURI = g_settings_get_string(bgsetting, "picture-uri");
hasPictureURIDark = gsettingsHasKey(bgsetting, "picture-uri-dark");
if (hasPictureURIDark)
defPictureURIDark = g_settings_get_string(bgsetting, "picture-uri-dark");
} else {
bgsetting = g_settings_new("org.mate.background");
defPictureURI = g_settings_get_string(bgsetting, "picture-filename");
@ -428,6 +443,8 @@ end:
g_settings_set_string(bgsetting, "color-shading-type", "solid");
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") {
g_settings_set_string(bgsetting, "picture-uri", ("file://" + gameDirStr + path).c_str());
if (hasPictureURIDark)
g_settings_set_string(bgsetting, "picture-uri-dark", ("file://" + gameDirStr + path).c_str());
} else {
g_settings_set_string(bgsetting, "picture-filename", (gameDirStr + path).c_str());
}
@ -596,6 +613,8 @@ RB_METHOD(wallpaperReset){
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "mate" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") {
if (desktop == "cinnamon" || desktop == "gnome" || desktop == "deepin" || desktop == "budgie" || desktop == "pantheon") {
g_settings_set_string(bgsetting, "picture-uri", defPictureURI.c_str());
if (hasPictureURIDark)
g_settings_set_string(bgsetting, "picture-uri-dark", defPictureURIDark.c_str());
} else {
g_settings_set_string(bgsetting, "picture-filename", defPictureURI.c_str());
}

View file

@ -63,3 +63,4 @@ Added Pantheon DE support
Added Badgi DE support
Added Wallpaper Manager Settings
Added X11 Window Managers support
GNOME support fixed

View file

@ -2,7 +2,7 @@ class Scene_OF
BPM = 100
BPM_TIME = 1.0 / (BPM / 60.0) * Graphics.frame_rate * 2
BUMP_SCALE = 1.07
BUMP_SCALE = 1.04
BUMP_RETURN_SPEED = 0.1
ICONS_BUMP_SCALE = 1.17
ICONS_BUMP_RETURN_SPEED = 0.2
@ -21,7 +21,7 @@ class Scene_OF
HP_WIDTH = 400
HP_HEIGHT = 16
MISS_TIME = 90
MISS_TIME = 60
SPRITES = {
:cat_base_arrow_left => Rect.new(0, 0, 32, 32), :cat_base_arrow_down => Rect.new(32, 0, 32, 32), :cat_base_arrow_up => Rect.new(64, 0, 32, 32), :cat_base_arrow_right => Rect.new(96, 0, 32, 32),
@ -91,9 +91,8 @@ class Scene_OF
@miss_sound = Audio.create_sound("Audio/SE/shatter")
@viewport_ui = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport_arrows = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport_ui.ox = @viewport_arrows.ox = -Graphics.width / 2
@viewport_ui.oy = @viewport_arrows.oy = -Graphics.height / 2
@viewport_ui.ox = -Graphics.width / 2
@viewport_ui.oy = -Graphics.height / 2
@spritesheet = RPG::Cache.misc(".cats")
@cat_flying_arrows = []
@ -104,6 +103,7 @@ class Scene_OF
@player_tails_end = []
@cat_arrows = []
@player_arrows = []
@events = []
for i in 0..3
cat_arrow = Sprite.new(@viewport_ui)
cat_arrow.bitmap = Bitmap.new(ARROW_SIZE, ARROW_SIZE)
@ -157,13 +157,17 @@ class Scene_OF
@hp_icons.y = Graphics.height / 2 - ARROWS_SIDES_MARGIN + HP_HEIGHT / 2 - 6
@hp_icons.z = @hp_white.z + 1
@rotate_power = 0
@reverse = false;
self.hp = 50
@bst_debug = Sprite.new(@viewport_ui)
@bst_debug.bitmap = Bitmap.new(300, 40)
@total_time = 0
@bump_timeout = 0
@bump_timeout = 999999
@bump_time = 999999
@icons_bump_timeout = 0
@miss_timeout = 0
@ -199,6 +203,13 @@ class Scene_OF
@miss_timeout -= 1
@voice_niko.volume = @miss_timeout <= 0 ? 1.0 : 0.0
@events.each do |event|
if @total_time * ARROWS_SPEED >= event[1]
instance_exec(&event[0])
@events.delete(event)
end
end
# fl studio b:s:t :3
beat = (@total_time / BPM_TIME / 2).to_i + 1
step = (@total_time / BPM_TIME * 15 / 2).to_i % 15 + 1
@ -210,17 +221,18 @@ class Scene_OF
@bump_timeout -= 1
@icons_bump_timeout -= 1
if @bump_timeout <= 0
@bump_timeout += BPM_TIME
@viewport_arrows.scale_y = @viewport_ui.scale_y =
@viewport_arrows.scale_x = @viewport_ui.scale_x = BUMP_SCALE
@bump_timeout += @bump_time
@viewport_ui.scale_y = @viewport_ui.scale_x = BUMP_SCALE
end
if @icons_bump_timeout <= 0
@icons_bump_timeout += BPM_TIME / 2.0
@hp_icons.zoom_x = @hp_icons.zoom_y = ICONS_BUMP_SCALE
@viewport_ui.rotation = @reverse ? -@rotate_power : @rotate_power
@reverse = !@reverse
end
@viewport_arrows.scale_x = @viewport_ui.scale_x =
@viewport_arrows.scale_y = @viewport_ui.scale_y = @viewport_ui.scale_x * (1.0 - BUMP_RETURN_SPEED) + BUMP_RETURN_SPEED
@viewport_ui.scale_x = @viewport_ui.scale_y = @viewport_ui.scale_x * (1.0 - BUMP_RETURN_SPEED) + BUMP_RETURN_SPEED
@hp_icons.zoom_x = @hp_icons.zoom_y = @hp_icons.zoom_x * (1.0 - ICONS_BUMP_RETURN_SPEED) + ICONS_BUMP_RETURN_SPEED
@viewport_ui.rotation = @viewport_ui.rotation * (1.0 - BUMP_RETURN_SPEED)
# Cat Arrows
i = 0
@ -273,10 +285,6 @@ class Scene_OF
arrow[0].dispose
@player_flying_arrows.delete(arrow)
i -= 1
#elsif arrow[0].y < ARROW_SIZE * ARROW_SCALE
# arrow[0].dispose
# @player_flying_arrows.delete(arrow)
# i -= 1
end
i += 1
end
@ -375,7 +383,7 @@ class Scene_OF
arrow[0].dispose
@player_flying_arrows.delete(arrow)
self.hp += 5
@miss_sound.stop
@miss_sound.fade_out(0.2)
@miss_timeout = 0
else
miss
@ -450,8 +458,7 @@ class Scene_OF
if line_data[0][dir] == '#'
arrow = make_arrow(dir, true)
arrow.x = cat_arrow_x
arrow.y = ARROWS_TOP_MARGIN - Graphics.height / 2 + bst2time(beat, step, tick) - 32
arrow.z += 1
arrow.y = ARROWS_TOP_MARGIN - Graphics.height / 2 + bst2time(beat, step, tick) - 16
@cat_flying_arrows << [arrow, dir]
@ -474,8 +481,7 @@ class Scene_OF
if line_data[0][dir + 5] == '#'
arrow = make_arrow(dir, false)
arrow.x = player_arrow_x
arrow.y = ARROWS_TOP_MARGIN - Graphics.height / 2 + bst2time(beat, step, tick) - 32
arrow.z += 1
arrow.y = ARROWS_TOP_MARGIN - Graphics.height / 2 + bst2time(beat, step, tick) - 16
@player_flying_arrows << [arrow, dir]
@ -496,6 +502,10 @@ class Scene_OF
end
end
if line_data[7] != nil
@events << [line_data[7], bst2time(beat, step, tick)]
end
i += 1
end
end
@ -505,26 +515,29 @@ class Scene_OF
end
def make_arrow(direction, meow)
arrow = Sprite.new(@viewport_arrows)
arrow = Sprite.new(@viewport_ui)
arrow.bitmap = Bitmap.new(ARROW_SIZE, ARROW_SIZE)
arrow.bitmap.stretch_blt(Rect.new(0, 0, ARROW_SIZE, ARROW_SIZE), @spritesheet, SPRITES[(meow ? CAT_ARROWS_SPRITES : PLAYER_ARROWS_SPRITES)[:target][direction]])
arrow.zoom_x = arrow.zoom_y = ARROW_SCALE
arrow.z = 20
arrow
end
def make_tail(direction, meow)
arrow = Sprite.new(@viewport_arrows)
arrow = Sprite.new(@viewport_ui)
arrow.bitmap = Bitmap.new(ARROW_SIZE, ARROW_SIZE / 2)
arrow.bitmap.stretch_blt(Rect.new(0, 0, ARROW_SIZE, ARROW_SIZE / 2), @spritesheet, SPRITES[(meow ? CAT_ARROWS_SPRITES : PLAYER_ARROWS_SPRITES)[:tail][direction]])
arrow.zoom_x = arrow.zoom_y = ARROW_SCALE
arrow.z = 18
arrow
end
def make_tail_end(direction, meow)
arrow = Sprite.new(@viewport_arrows)
arrow = Sprite.new(@viewport_ui)
arrow.bitmap = Bitmap.new(ARROW_SIZE, ARROW_SIZE / 2)
arrow.bitmap.stretch_blt(Rect.new(0, 0, ARROW_SIZE, ARROW_SIZE / 2), @spritesheet, SPRITES[(meow ? CAT_ARROWS_SPRITES : PLAYER_ARROWS_SPRITES)[:tail_end][direction]])
arrow.zoom_x = arrow.zoom_y = ARROW_SCALE
arrow.z = 19
arrow
end
@ -535,8 +548,8 @@ class Scene_OF
end
SONG_MAPPING = [ # Length
# arrows, B, S, T, | B, S, T
["# | ", 5, 1, 0, 0, 1, 0],
# arrows, B, S, T, | B, S, T | proc
["# | ", 5, 1, 0, 0, 1, 0, proc { @bump_time = BPM_TIME * 2; @bump_timeout = 0 }],
[" # | ", 5, 3, 0, 0, 1, 0],
[" # | ", 5, 5, 0, 0, 1, 0],
[" #| ", 5, 9, 0, 0, 1, 0],
@ -571,7 +584,7 @@ class Scene_OF
[" | # ", 11, 1, 0, 0, 1, 0],
[" | #", 11, 3, 0, 0, 1, 0],
[" | # ", 11, 5, 0, 0, 1, 0],
[" |# ", 11, 9, 0, 0, 1, 0],
[" |# ", 11, 9, 0, 0, 1, 0, proc { @bump_time = BPM_TIME / 2; @bump_timeout = 0 }],
[" |# ", 11, 13, 0, 0, 1, 0],
[" |# ", 12, 1, 0, 0, 1, 0],
[" | # ", 12, 3, 0, 0, 1, 0],
@ -579,17 +592,17 @@ class Scene_OF
[" | # ", 12, 6, 0],
[" | # ", 12, 7, 0],
[" | # ", 12, 8, 0],
[" | # ", 12, 9, 0],
[" | # ", 12, 9, 0, 0, 0, 0, proc { @bump_time = BPM_TIME / 4; @bump_timeout = 0 }],
[" | #", 12, 10, 0],
[" | # ", 12, 11, 0, 0, 1, 0],
[" |# ", 12, 13, 0],
[" |# ", 12, 13, 0, 0, 0, 0, proc { @bump_time = BPM_TIME / 8; @bump_timeout = 0 }],
[" |# ", 12, 15, 0],
#[" |# ", 12, 15, 12],
[" |# ", 12, 16, 0],
#[" |# ", 12, 16, 12],
#[" |# ", 13, 1, 0],
["# | ", 13, 1, 0],
["# | ", 13, 1, 0, 0, 0, 0, proc { @rotate_power = 1; @bump_time = BPM_TIME / 2; @bump_timeout = 0 }],
[" # | ", 13, 2, 0],
[" # | ", 13, 3, 0],
[" # | ", 13, 4, 0],
@ -694,7 +707,7 @@ class Scene_OF
[" | # ", 20, 12, 0],
[" | #", 20, 13, 0, 0, 1, 0],
[" # | ", 21, 1, 0],
[" # | ", 21, 1, 0, 0, 0, 0, proc { @rotate_power = 0; @bump_time = BPM_TIME; @bump_timeout = 0 }],
[" # | ", 21, 2, 0],
["# | ", 21, 3, 0],
["# # | ", 21, 5, 0],
@ -762,7 +775,7 @@ class Scene_OF
[" |# #", 28, 11, 0],
[" | ## ", 28, 13, 0],
["# | ", 29, 1, 0, 0, 1, 0],
["# | ", 29, 1, 0, 0, 1, 0, proc { @rotate_power = 0; @bump_time = 999999; @bump_timeout = 999999}],
[" # | ", 29, 3, 0, 0, 1, 0],
[" # | ", 29, 5, 0, 0, 1, 0],
[" #| ", 29, 9, 0, 0, 1, 0],
@ -807,6 +820,321 @@ class Scene_OF
[" ##| ", 36, 9, 0, 0, 1, 0],
[" | # ", 36, 11, 0, 0, 1, 0],
["# #| #", 36, 13, 0, 0, 1, 0],
[" #| #", 37, 1, 0, 0, 0, 0, proc { @rotate_power = 1; @bump_time = BPM_TIME / 2; @bump_timeout = 0}],
[" # | # ", 37, 2, 0],
["# |# ", 37, 3, 0],
[" # | # ", 37, 4, 0],
[" #| #", 37, 6, 0],
[" # | # ", 37, 7, 0],
[" # | # ", 37, 8, 0],
[" # | # ", 37, 9, 0],
[" #| #", 37, 10, 0],
[" # | # ", 37, 11, 0],
[" # | # ", 37, 12, 0],
[" #| #", 37, 13, 0, 0, 1, 0],
[" # | # ", 37, 15, 0],
[" #| #", 38, 1, 0],
["# |# ", 38, 2, 0],
[" #| #", 38, 3, 0],
[" # | # ", 38, 4, 0],
["# |# ", 38, 6, 0],
[" # | # ", 38, 7, 0],
[" #| #", 38, 8, 0],
[" # | # ", 38, 9, 0],
["# |# ", 38, 10, 0],
[" # | # ", 38, 11, 0],
[" # | # ", 38, 12, 0],
[" #| #", 38, 13, 0, 0, 1, 0],
[" # | # ", 38, 15, 0],
["# |# ", 39, 1, 0],
[" # | # ", 39, 2, 0],
[" # | # ", 39, 3, 0],
[" #| #", 39, 4, 0],
[" # | # ", 39, 6, 0],
["# |# ", 39, 7, 0],
[" #| #", 39, 8, 0],
[" # | # ", 39, 9, 0],
["# |# ", 39, 10, 0],
[" #| #", 39, 11, 0],
[" # | # ", 39, 12, 0],
["# |# ", 39, 13, 0, 0, 1, 0],
[" # | # ", 39, 15, 0],
["# |# ", 40, 1, 0],
[" # | # ", 40, 2, 0],
[" #| #", 40, 3, 0],
["# |# ", 40, 4, 0],
[" #| #", 40, 6, 0],
[" # | # ", 40, 7, 0],
[" #| #", 40, 8, 0],
[" # | # ", 40, 9, 0],
[" # | # ", 40, 10, 0],
["# |# ", 40, 11, 0],
[" # | # ", 40, 12, 0],
["# |# ", 40, 13, 0, 0, 1, 0],
[" #| #", 40, 15, 0],
[" #| #", 41, 1, 0],
[" # | # ", 41, 2, 0],
[" # | # ", 41, 3, 0],
["# |# ", 41, 4, 0],
["# |# ", 41, 6, 0],
[" # | # ", 41, 7, 0],
[" # | # ", 41, 8, 0],
[" #| #", 41, 9, 0, 0, 1, 0],
[" # | # ", 41, 11, 0, 0, 1, 0],
[" #| #", 41, 13, 0, 0, 1, 0],
[" # | # ", 41, 15, 0, 0, 1, 0],
[" #| #", 42, 1, 0],
[" # | # ", 42, 2, 0],
[" # | # ", 42, 3, 0],
["# |# ", 42, 4, 0],
[" #| #", 42, 6, 0],
[" # | # ", 42, 7, 0],
[" # | # ", 42, 8, 0],
[" # | # ", 42, 9, 0, 0, 1, 0],
["# |# ", 42, 11, 0, 0, 1, 0],
[" # | # ", 42, 13, 0, 0, 1, 0],
["# |# ", 42, 15, 0, 0, 1, 0],
[" # | # ", 43, 1, 0],
["# |# ", 43, 2, 0],
[" #| #", 43, 3, 0],
[" # | # ", 43, 4, 0],
[" # | # ", 43, 6, 0],
[" # | # ", 43, 7, 0],
[" #| #", 43, 8, 0],
[" # | # ", 43, 9, 0, 0, 1, 0],
[" # | # ", 43, 11, 0, 0, 1, 0],
[" # | # ", 43, 13, 0, 0, 1, 0],
[" # | # ", 43, 15, 0, 0, 1, 0],
["# |# ", 44, 1, 0],
[" # | # ", 44, 2, 0],
[" # | # ", 44, 3, 0],
[" #| #", 44, 4, 0],
[" # | # ", 44, 6, 0],
[" # | # ", 44, 7, 0],
[" # | # ", 44, 8, 0],
[" #| #", 44, 9, 0, 0, 1, 0],
["# |# ", 44, 11, 0, 0, 1, 0],
[" #| #", 44, 13, 0, 0, 1, 0],
["# |# ", 44, 15, 0, 0, 1, 0],
[" #| #", 45, 1, 0, 0, 0, 0, proc { @rotate_power = 0; @bump_time = 9999999 }],
[" | # ", 45, 3, 0],
[" | # ", 45, 5, 0],
["# |# ", 45, 9, 0],
[" | # ", 45, 11, 0],
[" # | # ", 45, 13, 0],
[" #| #", 46, 1, 0],
[" |# ", 46, 3, 0],
[" | # ", 46, 5, 0],
[" #| #", 46, 9, 0],
[" | # ", 46, 11, 0],
[" # | # ", 46, 13, 0],
[" # | # ", 47, 1, 0],
[" | # ", 47, 3, 0],
[" |# ", 47, 5, 0],
[" #| #", 47, 9, 0],
[" | # ", 47, 11, 0],
[" # | # ", 47, 13, 0],
[" # | # ", 48, 1, 0],
[" |# ", 48, 3, 0],
[" | # ", 48, 5, 0],
[" #| #", 48, 9, 0],
[" | # ", 48, 11, 0],
["# |# ", 48, 13, 0],
[" #| ", 49, 1, 0, 0, 0, 0, proc { @rotate_power = 0; @bump_time = BPM_TIME; @bump_timeout = 0 }],
[" # | ", 49, 3, 0],
["# | ", 49, 5, 0],
[" # | ", 49, 7, 0],
["# | ", 49, 9, 0],
[" # | ", 49, 11, 0],
["# | ", 49, 13, 0],
[" #| ", 50, 1, 0],
[" # | ", 50, 3, 0],
[" # | ", 50, 5, 0],
[" #| ", 50, 7, 0],
[" # | ", 50, 9, 0],
["# | ", 50, 11, 0],
[" # | ", 50, 13, 0],
["# | ", 51, 1, 0],
[" # | ", 51, 3, 0],
[" # | ", 51, 5, 0],
[" #| ", 51, 7, 0],
[" # | ", 51, 9, 0],
[" #| ", 51, 11, 0],
["# | ", 51, 13, 0],
[" #| ", 52, 1, 0],
["# | ", 52, 3, 0],
[" # | ", 52, 5, 0],
["# | ", 52, 7, 0],
[" # | ", 52, 9, 0],
[" # | ", 52, 11, 0],
["# | ", 52, 13, 0],
[" | #", 53, 1, 0],
[" | # ", 53, 3, 0],
[" |# ", 53, 5, 0],
[" | # ", 53, 7, 0],
[" |# ", 53, 9, 0],
[" | # ", 53, 11, 0],
[" |# ", 53, 13, 0],
[" | #", 54, 1, 0],
[" | # ", 54, 3, 0],
[" | # ", 54, 5, 0],
[" | #", 54, 7, 0],
[" | # ", 54, 9, 0],
[" |# ", 54, 11, 0],
[" | # ", 54, 13, 0],
[" |# ", 55, 1, 0],
[" | # ", 55, 3, 0],
[" | # ", 55, 5, 0],
[" | #", 55, 7, 0],
[" | # ", 55, 9, 0],
[" | #", 55, 11, 0],
[" |# ", 55, 13, 0],
[" | #", 56, 1, 0],
[" |# ", 56, 3, 0],
[" | # ", 56, 5, 0],
[" |# ", 56, 7, 0],
[" ## | ## ", 56, 9, 0, 0, 2, 0, proc {@bump_time = BPM_TIME / 8; @bump_timeout = 0 }],
["# #|# #", 56, 13, 0, 0, 2, 0, proc {@bump_time = BPM_TIME / 4; @bump_timeout = 0 }],
["# | ", 57, 1, 0, 0, 0, 0, proc { @rotate_power = 1; @bump_time = BPM_TIME / 2; @bump_timeout = 0 }],
[" # | ", 57, 2, 0],
[" # | ", 57, 3, 0],
[" # | ", 57, 4, 0],
["# | ", 57, 5, 0, 0, 1, 0],
[" #| ", 57, 7, 0],
["# | ", 57, 8, 0],
[" # | ", 57, 9, 0],
["# | ", 57, 10, 0],
[" # | ", 57, 11, 0],
[" #| ", 57, 12, 0],
[" # | ", 57, 13, 0, 0, 1, 0],
[" # | ", 57, 15, 0],
[" #| ", 58, 1, 0],
[" # | ", 58, 2, 0],
["# | ", 58, 3, 0],
[" # | ", 58, 4, 0],
["# | ", 58, 5, 0, 0, 1, 0],
[" # | ", 58, 7, 0],
["# | ", 58, 8, 0],
[" # | ", 58, 9, 0],
[" #| ", 58, 10, 0],
[" # | ", 58, 11, 0],
[" #| ", 58, 12, 0],
[" # | ", 58, 13, 0, 0, 1, 0],
["# | ", 58, 15, 0],
[" # | ", 59, 1, 0],
[" #| ", 59, 2, 0],
[" # | ", 59, 3, 0],
["# | ", 59, 4, 0],
["# | ", 59, 5, 0, 0, 1, 0],
[" # | ", 59, 7, 0],
[" #| ", 59, 8, 0],
[" # | ", 59, 9, 0],
[" # | ", 59, 10, 0],
[" # | ", 59, 11, 0],
[" # | ", 59, 12, 0],
[" #| ", 59, 13, 0, 0, 1, 0],
["# | ", 59, 15, 0, 0, 1, 0],
[" #| ", 60, 1, 0],
[" # | ", 60, 2, 0],
[" # | ", 60, 3, 0],
["# | ", 60, 4, 0],
[" # | ", 60, 5, 0],
[" # | ", 60, 7, 0],
[" # | ", 60, 8, 0],
["# | ", 60, 9, 0],
[" #| ", 60, 10, 0],
[" # | ", 60, 11, 0],
[" # | ", 60, 12, 0],
[" #| ", 60, 13, 0, 0, 1, 0],
[" #| ", 60, 15, 0, 0, 1, 0],
[" |# ", 61, 1, 0],
[" | # ", 61, 2, 0],
[" | # ", 61, 3, 0],
[" | # ", 61, 4, 0],
[" |# ", 61, 5, 0, 0, 1, 0],
[" | #", 61, 7, 0],
[" |# ", 61, 8, 0],
[" | # ", 61, 9, 0],
[" |# ", 61, 10, 0],
[" | # ", 61, 11, 0],
[" | #", 61, 12, 0],
[" | # ", 61, 13, 0, 0, 1, 0],
[" | # ", 61, 15, 0],
[" | #", 62, 1, 0],
[" | # ", 62, 2, 0],
[" |# ", 62, 3, 0],
[" | # ", 62, 4, 0],
[" |# ", 62, 5, 0, 0, 1, 0],
[" | # ", 62, 7, 0],
[" |# ", 62, 8, 0],
[" | # ", 62, 9, 0],
[" | #", 62, 10, 0],
[" | # ", 62, 11, 0],
[" | #", 62, 12, 0],
[" | # ", 62, 13, 0, 0, 1, 0],
[" |# ", 62, 15, 0],
[" | # ", 63, 1, 0],
[" | #", 63, 2, 0],
[" | # ", 63, 3, 0],
[" |# ", 63, 4, 0],
[" |# ", 63, 5, 0, 0, 1, 0],
[" | # ", 63, 7, 0],
[" | #", 63, 8, 0],
[" | # ", 63, 9, 0],
[" | # ", 63, 10, 0],
[" | # ", 63, 11, 0],
[" | # ", 63, 12, 0],
[" | #", 63, 13, 0, 0, 1, 0],
[" |# ", 63, 15, 0, 0, 1, 0],
[" | #", 64, 1, 0],
[" | # ", 64, 2, 0],
[" | # ", 64, 3, 0],
[" |# ", 64, 4, 0],
[" | # ", 64, 5, 0, 0, 1, 0],
[" | # ", 64, 7, 0],
[" | # ", 64, 8, 0],
[" |# ", 64, 9, 0],
[" | #", 64, 10, 0],
[" | # ", 64, 11, 0],
[" | # ", 64, 12, 0],
[" | #", 64, 13, 0, 0, 1, 0],
[" | #", 64, 15, 0, 0, 1, 0],
[" # | # ", 65, 1, 0, 0, 1, 0, proc { @rotate_power = 0; @bump_time = 9999999; @bump_timeout = 9999999 }],
[" #| #", 65, 3, 0],
[" # | # ", 65, 6, 0],
[" # | # ", 65, 7, 0, 0, 1, 0],
[" #| #", 65, 9, 0, 0, 1, 0],
["# |# ", 65, 11, 0, 0, 1, 0],
[" #| #", 65, 13, 0, 0, 1, 0],
[" #| #", 66, 1, 0, 0, 1, 0],
[" # | # ", 66, 3, 0],
[" # | # ", 66, 5, 0],
["# |# ", 66, 6, 0, 0, 1, 0],
[" #| #", 66, 8, 0, 0, 1, 0],
[" # | # ", 66, 11, 0, 0, 1, 0],
[" # | # ", 66, 13, 0, 0, 1, 0],
[" # | # ", 67, 1, 0, 0, 1, 0],
[" #| #", 67, 3, 0],
[" # | # ", 67, 6, 0],
[" # | # ", 67, 7, 0, 0, 1, 0],
[" #| #", 67, 9, 0, 0, 1, 0],
["# |# ", 67, 11, 0, 0, 1, 0],
[" #| #", 67, 13, 0, 0, 1, 0],
["# |# ", 68, 1, 0, 0, 1, 0],
[" #| #", 68, 3, 0],
["# |# ", 68, 5, 0],
[" # | # ", 68, 6, 0, 0, 1, 0],
[" #| #", 68, 8, 0, 0, 1, 0],
[" #| #", 68, 11, 0, 0, 1, 0],
["# |# ", 68, 13, 0, 0, 1, 0],
]
end

View file

@ -10,14 +10,58 @@
#include <seccomp.h>
//Yes its not best way, anyway better than nothing.
scmp_filter_ctx ctx;
int seccomplist[] = {SCMP_SYS(bpf), SCMP_SYS(set_mempolicy), SCMP_SYS(set_mempolicy_home_node), SCMP_SYS(vhangup), SCMP_SYS(settimeofday), SCMP_SYS(stime), SCMP_SYS(clock_settime),
SCMP_SYS(clock_settime64), SCMP_SYS(iopl), SCMP_SYS(ioperm), SCMP_SYS(ptrace), SCMP_SYS(process_vm_writev), SCMP_SYS(process_vm_readv), SCMP_SYS(process_madvise),
SCMP_SYS(pidfd_getfd), SCMP_SYS(kcmp), SCMP_SYS(delete_module), SCMP_SYS(init_module), SCMP_SYS(init_module), SCMP_SYS(chroot), SCMP_SYS(reboot), SCMP_SYS(unshare),
SCMP_SYS(umount2), SCMP_SYS(umount), SCMP_SYS(setns), SCMP_SYS(sethostname), SCMP_SYS(setdomainname), SCMP_SYS(bpf), SCMP_SYS(quotactl_fd), SCMP_SYS(quotactl),
SCMP_SYS(move_mount), SCMP_SYS(mount_setattr), SCMP_SYS(mount),
SCMP_SYS(process_vm_readv), SCMP_SYS(process_vm_writev), SCMP_SYS(ptrace), SCMP_SYS(swapon), SCMP_SYS(swapoff), SCMP_SYS(settimeofday),
SCMP_SYS(sethostname), SCMP_SYS(umount), SCMP_SYS(umount2), SCMP_SYS(vm86old), SCMP_SYS(vm86), SCMP_SYS(setgroups), SCMP_SYS(setgid), SCMP_SYS(setfsuid),
SCMP_SYS(setfsgid), SCMP_SYS(setdomainname), SCMP_SYS(setns), SCMP_SYS(setpgid), SCMP_SYS(pciconfig_write)};
const int seccomplist[] = {SCMP_SYS(bpf),
SCMP_SYS(set_mempolicy),
SCMP_SYS(set_mempolicy_home_node),
SCMP_SYS(vhangup),
SCMP_SYS(settimeofday),
SCMP_SYS(stime),
SCMP_SYS(clock_settime),
SCMP_SYS(clock_settime64),
SCMP_SYS(iopl),
SCMP_SYS(ioperm),
SCMP_SYS(ptrace),
SCMP_SYS(process_vm_writev),
SCMP_SYS(process_vm_readv),
SCMP_SYS(process_madvise),
SCMP_SYS(pidfd_getfd),
SCMP_SYS(kcmp),
SCMP_SYS(delete_module),
SCMP_SYS(init_module),
SCMP_SYS(init_module),
SCMP_SYS(chroot),
SCMP_SYS(reboot),
SCMP_SYS(unshare),
SCMP_SYS(umount2),
SCMP_SYS(umount),
SCMP_SYS(setns),
SCMP_SYS(sethostname),
SCMP_SYS(setdomainname),
SCMP_SYS(bpf),
SCMP_SYS(quotactl_fd),
SCMP_SYS(quotactl),
SCMP_SYS(move_mount),
SCMP_SYS(mount_setattr),
SCMP_SYS(mount),
SCMP_SYS(process_vm_readv),
SCMP_SYS(process_vm_writev),
SCMP_SYS(ptrace),
SCMP_SYS(swapon),
SCMP_SYS(swapoff),
SCMP_SYS(settimeofday),
SCMP_SYS(sethostname),
SCMP_SYS(umount),
SCMP_SYS(umount2),
SCMP_SYS(vm86old),
SCMP_SYS(vm86),
SCMP_SYS(setgroups),
SCMP_SYS(setgid),
SCMP_SYS(setfsuid),
SCMP_SYS(setfsgid),
SCMP_SYS(setdomainname),
SCMP_SYS(setns),
SCMP_SYS(setpgid),
SCMP_SYS(pciconfig_write)};
#endif
void SecurityManagerInit(){

View file

@ -623,10 +623,14 @@ void Sprite::onGeometryChange(const Scene::Geometry &geo){
* relative to screen origin */
p->trans.setGlobalOffset(geo.offset());
Viewport* viewport = ViewportElement::getViewport();
if (viewport)
if (viewport) {
p->trans.setGlobalScale(Vec2(viewport->getScaleX(), viewport->getScaleY()));
else
p->trans.setGlobalRotation(viewport->getRotation());
}
else {
p->trans.setGlobalScale(Vec2(1.0, 1.0));
p->trans.setGlobalRotation(0);
}
p->sceneRect.setSize(geo.rect.size());
p->sceneOrig = geo.orig;

View file

@ -43,15 +43,17 @@
//
////////////////////////////////////////////////////////////
// added global rotation and global scale, modified updateMatrix(), using SDL funcs instead of math.h
#ifndef TRANSFORM_H
#define TRANSFORM_H
#include "etc-internal.h"
#include <math.h>
#include <SDL3/SDL_stdinc.h>
constexpr float PI = 3.14159265358979323846f;
class Transform{
public:
Transform()
@ -65,10 +67,12 @@ public:
matrix[15] = 1;
}
Vec2 &getPosition() { return position; }
Vec2 &getOrigin() { return origin; }
Vec2 &getScale() { return scale; }
float getRotation() { return rotation; }
Vec2 &getPosition() { return position; }
Vec2 &getOrigin() { return origin; }
Vec2 &getScale() { return scale; }
Vec2 &getGlobalScale() { return globalScale; }
float getRotation() { return rotation; }
float getGlobalRotation() { return globalRotation; }
Vec2i getPositionI() const{
return Vec2i(position.x, position.y);
@ -98,6 +102,11 @@ public:
dirty = true;
}
void setGlobalRotation(float value){
globalRotation = value;
dirty = true;
}
void setGlobalOffset(const Vec2i &value){
offset = value;
dirty = true;
@ -119,33 +128,65 @@ public:
private:
void updateMatrix(){
if (rotation >= 360 || rotation < -360)
rotation = (float) SDL_fmod(rotation, 360);
if (rotation < 0)
rotation += 360;
float angle = rotation * 3.141592654f / 180.0f;
float cosine = (float) SDL_cos(angle);
float sine = (float) SDL_sin(angle);
float sxc = scale.x * cosine;
float syc = scale.y * cosine;
float sxs = scale.x * sine;
float sys = scale.y * sine;
float tx = (-origin.x * sxc - origin.y * sys + position.x) * globalScale.x + offset.x;
float ty = ( origin.x * sxs - origin.y * syc + position.y) * globalScale.y + offset.y;
matrix[0] = sxc * globalScale.x;
matrix[1] = -sxs * globalScale.y;
matrix[4] = sys * globalScale.x;
matrix[5] = syc * globalScale.y;
matrix[12] = tx;
matrix[13] = ty;
if (rotation >= 360 || rotation < -360)
rotation = (float)SDL_fmod(rotation, 360);
if (globalRotation >= 360 || globalRotation < -360)
globalRotation = (float)SDL_fmod(globalRotation, 360);
// object rotation cos and sin
float angle = rotation * PI / 180.0f;
float cosine = SDL_cos(angle);
float sine = SDL_sin(angle);
float sxc = scale.x * cosine;
float syc = scale.y * cosine;
float sxs = scale.x * sine;
float sys = scale.y * sine;
// object matrix
float a = sxc * globalScale.x;
float b = -sxs * globalScale.y;
float c = sys * globalScale.x;
float d = syc * globalScale.y;
float tx = (-origin.x * sxc - origin.y * sys + position.x)
* globalScale.x;
float ty = ( origin.x * sxs - origin.y * syc + position.y)
* globalScale.y;
// viewport rotation cos and sin
float globalAngle = globalRotation * PI / 180.0f;
float gc = SDL_cos(globalAngle);
float gs = SDL_sin(globalAngle);
// basis rotation
float na = a * gc - b * gs;
float nb = a * gs + b * gc;
float nc = c * gc - d * gs;
float nd = c * gs + d * gc;
float dx = tx;
float dy = ty;
// appling global rotation
tx = dx * gc - dy * gs + offset.x;
ty = dx * gs + dy * gc + offset.y;
matrix[0] = na;
matrix[1] = nb;
matrix[4] = nc;
matrix[5] = nd;
matrix[12] = tx;
matrix[13] = ty;
}
Vec2 position;
Vec2 origin;
Vec2 scale;
float rotation;
float globalRotation;
/* Silently added to position */
Vec2i offset;

View file

@ -46,6 +46,7 @@ struct ViewportPrivate{
double scaleX;
double scaleY;
double rotation;
EtcTemps tmp;
@ -56,6 +57,7 @@ struct ViewportPrivate{
tone(&tmp.tone),
scaleX(1.0),
scaleY(1.0),
rotation(0.0),
isOnScreen(false)
{
rect->set(x, y, width, height);
@ -139,8 +141,9 @@ void Viewport::update(){
DEF_ATTR_RD_SIMPLE(Viewport, OX, int, geometry.orig.x)
DEF_ATTR_RD_SIMPLE(Viewport, OY, int, geometry.orig.y)
DEF_ATTR_RD_SIMPLE(Viewport, ScaleX, double, p->scaleX)
DEF_ATTR_RD_SIMPLE(Viewport, ScaleY, double, p->scaleY)
DEF_ATTR_RD_SIMPLE(Viewport, ScaleX, double, p->scaleX)
DEF_ATTR_RD_SIMPLE(Viewport, ScaleY, double, p->scaleY)
DEF_ATTR_RD_SIMPLE(Viewport, Rotation, double, p->rotation)
DEF_ATTR_SIMPLE(Viewport, Rect, Rect&, *p->rect)
DEF_ATTR_SIMPLE(Viewport, Color, Color&, *p->color)
@ -186,6 +189,16 @@ void Viewport::setScaleY(double value){
notifyGeometryChange();
}
void Viewport::setRotation(double value){
guardDisposed();
if (p->rotation == value)
return;
p->rotation = value;
notifyGeometryChange();
}
void Viewport::initDynAttribs(){
p->rect = new Rect(*p->rect);
p->color = new Color;

View file

@ -38,13 +38,14 @@ public:
void update();
DECL_ATTR( Rect, Rect& )
DECL_ATTR( OX, int )
DECL_ATTR( OY, int )
DECL_ATTR( ScaleX, double )
DECL_ATTR( ScaleY, double )
DECL_ATTR( Color, Color& )
DECL_ATTR( Tone, Tone& )
DECL_ATTR( Rect, Rect& )
DECL_ATTR( OX, int )
DECL_ATTR( OY, int )
DECL_ATTR( ScaleX, double )
DECL_ATTR( ScaleY, double )
DECL_ATTR( Rotation, double )
DECL_ATTR( Color, Color& )
DECL_ATTR( Tone, Tone& )
void initDynAttribs();