-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from jack27121/struct_based_rewrite
struct based rewrite
- Loading branch information
Showing
76 changed files
with
2,307 additions
and
1,627 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// @description gets created by stanncam init, maintains all cameras | ||
resolution_w = 0; | ||
resolution_h = 0; | ||
number_of_cams = 0; | ||
keep_aspect_ratio = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// @description | ||
for (var i = 0; i < array_length(global.stanncams); ++i) { | ||
if (global.stanncams[i] == -1) continue; | ||
global.stanncams[i].__predraw(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// @description | ||
view_enabled = true; | ||
for (var i = 0; i < array_length(global.stanncams); ++i) { | ||
if (global.stanncams[i] == -1) continue; | ||
global.stanncams[i].__check_viewports(); | ||
} | ||
__stanncam_update_resolution(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// @description | ||
for (var i = 0; i < array_length(global.stanncams); ++i) { | ||
if (global.stanncams[i] == -1) continue; | ||
global.stanncams[i].__step(); | ||
} |
50 changes: 25 additions & 25 deletions
50
objects/obj_stanncam/obj_stanncam.yy → ...tanncam_manager/__obj_stanncam_manager.yy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
{ | ||
"resourceType": "GMObject", | ||
"resourceVersion": "1.0", | ||
"name": "obj_stanncam", | ||
"spriteId": null, | ||
"solid": false, | ||
"visible": true, | ||
"managed": true, | ||
"spriteMaskId": null, | ||
"persistent": true, | ||
"parentObjectId": null, | ||
"physicsObject": false, | ||
"physicsSensor": false, | ||
"physicsShape": 1, | ||
"physicsGroup": 1, | ||
"physicsDensity": 0.5, | ||
"physicsRestitution": 0.1, | ||
"physicsLinearDamping": 0.1, | ||
"physicsAngularDamping": 0.1, | ||
"physicsFriction": 0.2, | ||
"physicsStartAwake": true, | ||
"physicsKinematic": false, | ||
"physicsShapePoints": [], | ||
"name": "__obj_stanncam_manager", | ||
"eventList": [ | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":0,"collisionObjectId":null,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":2,"eventType":3,"collisionObjectId":null,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":4,"eventType":7,"collisionObjectId":null,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":77,"eventType":8,"collisionObjectId":null,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":2,"eventType":3,"isDnD":false,}, | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":76,"eventType":8,"isDnD":false,}, | ||
], | ||
"properties": [], | ||
"managed": true, | ||
"overriddenProperties": [], | ||
"parent": { | ||
"name": "Objects", | ||
"path": "folders/Objects.yy", | ||
}, | ||
"parentObjectId": null, | ||
"persistent": true, | ||
"physicsAngularDamping": 0.1, | ||
"physicsDensity": 0.5, | ||
"physicsFriction": 0.2, | ||
"physicsGroup": 1, | ||
"physicsKinematic": false, | ||
"physicsLinearDamping": 0.1, | ||
"physicsObject": false, | ||
"physicsRestitution": 0.1, | ||
"physicsSensor": false, | ||
"physicsShape": 1, | ||
"physicsShapePoints": [], | ||
"physicsStartAwake": true, | ||
"properties": [], | ||
"solid": false, | ||
"spriteId": null, | ||
"spriteMaskId": null, | ||
"visible": true, | ||
} |
File renamed without changes.
48 changes: 24 additions & 24 deletions
48
objects/obj_ball/obj_ball.yy → objects/demo_obj_ball/demo_obj_ball.yy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
{ | ||
"resourceType": "GMObject", | ||
"resourceVersion": "1.0", | ||
"name": "obj_ball", | ||
"spriteId": { | ||
"name": "spr_ball", | ||
"path": "sprites/spr_ball/spr_ball.yy", | ||
}, | ||
"solid": false, | ||
"visible": true, | ||
"name": "demo_obj_ball", | ||
"eventList": [ | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,}, | ||
], | ||
"managed": true, | ||
"spriteMaskId": null, | ||
"persistent": false, | ||
"overriddenProperties": [], | ||
"parent": { | ||
"name": "demonstration", | ||
"path": "folders/demonstration.yy", | ||
}, | ||
"parentObjectId": null, | ||
"physicsObject": false, | ||
"physicsSensor": false, | ||
"physicsShape": 1, | ||
"physicsGroup": 1, | ||
"physicsDensity": 0.5, | ||
"physicsRestitution": 0.1, | ||
"physicsLinearDamping": 0.1, | ||
"persistent": false, | ||
"physicsAngularDamping": 0.1, | ||
"physicsDensity": 0.5, | ||
"physicsFriction": 0.2, | ||
"physicsStartAwake": true, | ||
"physicsGroup": 1, | ||
"physicsKinematic": false, | ||
"physicsLinearDamping": 0.1, | ||
"physicsObject": false, | ||
"physicsRestitution": 0.1, | ||
"physicsSensor": false, | ||
"physicsShape": 1, | ||
"physicsShapePoints": [], | ||
"eventList": [ | ||
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","isDnD":false,"eventNum":0,"eventType":3,"collisionObjectId":null,}, | ||
], | ||
"physicsStartAwake": true, | ||
"properties": [], | ||
"overriddenProperties": [], | ||
"parent": { | ||
"name": "demonstration", | ||
"path": "folders/demonstration.yy", | ||
"solid": false, | ||
"spriteId": { | ||
"name": "spr_ball", | ||
"path": "sprites/spr_ball/spr_ball.yy", | ||
}, | ||
"spriteMaskId": null, | ||
"visible": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// @description | ||
pointer = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/// @description | ||
//camera | ||
stanncam_init(320,240,1920,1080); | ||
cam1 = new stanncam(demo_obj_player.x,demo_obj_player.y,global.game_w,global.game_h); | ||
cam1.follow = demo_obj_player; | ||
|
||
cam2 = -1; | ||
|
||
split_screen = false; | ||
|
||
//pointer | ||
pointer = false; | ||
pointer_x = 0; | ||
pointer_y = 0; | ||
|
||
zoom_mode = 0; | ||
zoom_text = "no zooming" | ||
|
||
speed_mode = 1; | ||
|
||
game_res = 2; | ||
gui_hires = false; | ||
gui_res = 0; | ||
|
||
resolutions = [ | ||
{ w:400 , h:400 }, //1:1 | ||
{ w:500 , h:250 }, //2:1 | ||
{ w:320 , h:180 }, //16:9 | ||
{ w:640 , h:360 }, | ||
{ w:1280 , h:720 }, | ||
{ w:1920 , h:1080 }, | ||
{ w:2560 , h:1440 } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/// @description | ||
//chooses pixel font or hires font | ||
if(gui_hires){ | ||
draw_set_font(demo_f_hires); | ||
var offset = 45; | ||
var outline_width = 4; | ||
var precision = 16; | ||
draw_set_color(c_white) | ||
|
||
} else { | ||
draw_set_font(demo_f_pixel); | ||
var offset = 8; | ||
var outline_width = 1; | ||
var precision = 8; | ||
draw_set_color(c_white) | ||
|
||
} | ||
|
||
//draws helper text | ||
draw_set_halign(fa_left); | ||
draw_set_valign(fa_top); | ||
draw_text_outline(1,1,"[arrow keys] move character",outline_width,precision); | ||
var following = (cam1.follow != undefined) ? "following" : "not following" | ||
draw_text_outline(1,offset,"[space] " + following,outline_width,precision); | ||
draw_text_outline(1,offset*2,"[ALT] toggle hi-res GUI",outline_width,precision); | ||
draw_text_outline(1,offset*3,"[LMB] move cam to pos (when not following)",outline_width,precision); | ||
draw_text_outline(1,offset*4,"[RMB] "+ zoom_text,outline_width,precision); | ||
var constrained = (cam1.room_constrain) ? "camera constrained to room" : "camera not constrained to room"; | ||
draw_text_outline(1,offset*5,"[CTRL] "+ constrained,outline_width,precision); | ||
draw_text_outline(1,offset*6,"[F] camera shake",outline_width,precision); | ||
draw_text_outline(1,offset*7,"[Tab] camera speed "+ string(cam1.spd),outline_width,precision); | ||
|
||
//draw current resolution text | ||
draw_set_halign(fa_right) | ||
draw_text_outline(global.gui_w-1,1,"game resolution: "+string(__obj_stanncam_manager.display_res_w)+" x "+string(__obj_stanncam_manager.display_res_h)+" [F1]",outline_width,precision); | ||
draw_text_outline(global.gui_w-1,offset,"GUI resolution: "+string(global.gui_w)+" x "+string(global.gui_h)+" [F2]",outline_width,precision); | ||
draw_text_outline(global.gui_w-1,offset*2,"Keep aspect ratio: "+string(stanncam_get_keep_aspect_ratio())+" [F3]",outline_width,precision); | ||
draw_text_outline(global.gui_w-1,offset*3,"fullscreen: "+string(window_get_fullscreen())+" [F4]",outline_width,precision); | ||
draw_text_outline(global.gui_w-1,offset*4,"split-screen: "+string(split_screen)+" [F5]",outline_width,precision); | ||
|
||
//point at player, when it's outside camera bounds | ||
if(cam1.out_of_bounds(demo_obj_player.x,demo_obj_player.y,8)){ | ||
var _x = cam1.room_to_gui_x(demo_obj_player.x); | ||
var _y = cam1.room_to_gui_y(demo_obj_player.y); | ||
|
||
var margin = (gui_hires) ? 50 : 20; | ||
|
||
var gui_scale_x = stanncam_get_gui_scale_x(); | ||
var gui_scale_y = stanncam_get_gui_scale_y(); | ||
|
||
_x = clamp(_x,margin,cam1.width * gui_scale_x -margin); | ||
_y = clamp(_y,margin,cam1.height * gui_scale_y -margin); | ||
|
||
var dir = point_direction(_x,_y,cam1.room_to_gui_x(demo_obj_player.x),cam1.room_to_gui_y(demo_obj_player.y)); | ||
|
||
if(gui_hires){ | ||
draw_sprite_ext(spr_arrow,0,_x,_y,1,1,dir-90,-1,1); | ||
}else{ | ||
draw_sprite_ext(spr_arrow_small,0,_x,_y,1,1,dir-90,-1,1); | ||
} | ||
} else { | ||
//draws pointer over players head | ||
var arrow_x = cam1.room_to_gui_x(demo_obj_player.x); | ||
var arrow_y = cam1.room_to_gui_y(demo_obj_player.y); | ||
if(gui_hires){ | ||
draw_sprite_ext(spr_arrow,1,arrow_x,arrow_y-64,0.5,0.5,180,-1,1); | ||
} else { | ||
draw_sprite_ext(spr_arrow_small,1,arrow_x,arrow_y-12,1,1,180,-1,1); | ||
} | ||
} | ||
|
||
//draw pointer on mouse location | ||
if(pointer){ | ||
var arrow_x = cam1.room_to_gui_x( pointer_x ); | ||
var arrow_y = cam1.room_to_gui_y( pointer_y ); | ||
if(gui_hires){ | ||
draw_sprite_ext(spr_arrow,0,arrow_x,arrow_y,1,1,180,-1,1); | ||
} else { | ||
draw_sprite_ext(spr_arrow_small,0,arrow_x,arrow_y,1,1,180,-1,1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// @description | ||
if(split_screen){ | ||
cam1.draw(0,0); | ||
cam2.draw(global.game_w/2,0); | ||
}else{ | ||
cam1.draw(0,0); | ||
} |
Oops, something went wrong.