Skip to content

Commit

Permalink
release 1.6: alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Grisgram committed Jul 1, 2024
1 parent fecda43 commit 02b5881
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 88 deletions.
2 changes: 1 addition & 1 deletion objects/highscoretablerenderer/CleanUp_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// @description free surface
/// @desc free surface
event_inherited();

__release_surface();
16 changes: 12 additions & 4 deletions objects/highscoretablerenderer/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/// @description call set_table to use this object!
/// @desc call set_table to use this object!
event_inherited();

__table = undefined;
__surface = undefined;

__startup_x = x;
__startup_y = y;
__align_h_multi = (screen_align_h == fa_left ? 0 : (screen_align_h == fa_center ? 0.5 : 1));
__align_v_multi = (screen_align_v == fa_top ? 0 : (screen_align_v == fa_middle ? 0.5 : 1));
surfw = 0;
surfh = 0;

__release_surface = function() {
if (__surface != undefined) surface_free(__surface);
__surface = undefined;
Expand All @@ -21,13 +28,14 @@ set_table = function(_highscoretable) {
var maxw_score = 0;
var maxw_time = 0;
var maxw_create = 0;

surfw = 0;
surfh = 0;

var tmp = __table.data.entries[@ 0];
var _render_score = (render_score && tmp != undefined && tmp.data.Score != undefined);
var _render_time = (render_time && tmp != undefined && tmp.data.Time != undefined);

var surfw = 0, surfh = 0;


var draw_from_rank = max(0, from_rank - 1);
var draw_to_rank = (to_rank < 0 ? __table.size() : to_rank);

Expand Down
4 changes: 2 additions & 2 deletions objects/highscoretablerenderer/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// @description do nothing if draw_on_gui
/// @desc do nothing if draw_on_gui
event_inherited();

if (!draw_on_gui && __ensure_surface_is_ready())
draw_surface(__surface,x,y);
draw_surface(__surface, x - surfw * __align_h_multi, y - surfh * __align_v_multi);
4 changes: 2 additions & 2 deletions objects/highscoretablerenderer/Draw_64.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// @description
/// @desc
event_inherited();

if (draw_on_gui && __ensure_surface_is_ready())
draw_surface(__surface,x,y);
draw_surface(__surface, x - surfw * __align_h_multi, y - surfh * __align_v_multi);
52 changes: 31 additions & 21 deletions objects/highscoretablerenderer/highscoretablerenderer.yy

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion objects/highscoretrophyrenderer/CleanUp_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// @description free surface
/// @desc free surface
event_inherited();

__release_surface();
12 changes: 10 additions & 2 deletions objects/highscoretrophyrenderer/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
/// @description call set_table to use this object!
/// @desc call set_table to use this object!
event_inherited();

__table = undefined;
__surface = undefined;

__startup_x = x;
__startup_y = y;
__align_h_multi = (screen_align_h == fa_left ? 0 : (screen_align_h == fa_center ? 0.5 : 1));
__align_v_multi = (screen_align_v == fa_top ? 0 : (screen_align_v == fa_middle ? 0.5 : 1));
surfw = 0;
surfh = 0;

__release_surface = function() {
if (__surface != undefined) surface_free(__surface);
__surface = undefined;
Expand Down Expand Up @@ -35,7 +42,8 @@ set_table = function(_highscoretable) {
if (_render_time) trophyrows++;
if (render_create_date) trophyrows++;

var surfw = 0, surfh = 2 * space_between_columns;
surfw = 0;
surfh = 2 * space_between_columns;

var draw_from_rank = max(0, from_rank - 1);
var draw_to_rank = (to_rank < 0 ? __table.size() : to_rank);
Expand Down
4 changes: 2 additions & 2 deletions objects/highscoretrophyrenderer/Draw_0.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// @description do nothing if draw_on_gui
/// @desc do nothing if draw_on_gui
event_inherited();

if (!draw_on_gui && __ensure_surface_is_ready())
draw_surface(__surface,x,y);
draw_surface(__surface, x - surfw * __align_h_multi, y - surfh * __align_v_multi);
4 changes: 2 additions & 2 deletions objects/highscoretrophyrenderer/Draw_64.gml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// @description
/// @desc
event_inherited();

if (draw_on_gui && __ensure_surface_is_ready())
draw_surface(__surface,x,y);
draw_surface(__surface, x - surfw * __align_h_multi, y - surfh * __align_v_multi);
Loading

0 comments on commit 02b5881

Please sign in to comment.