Skip to content

Commit 4f8a622

Browse files
- Removing anything related to the gui. I gonna make the console adapt itself to the situation of the room. Still didn't figured out how I will bring the red shape with the cross...
- Removed dynamic positions from the time being. - You can now do every type of click you want on the instance followers. - Optimized a bit the drawing steps. -
1 parent 453680e commit 4f8a622

5 files changed

Lines changed: 134 additions & 88 deletions

File tree

Project_debuger.project.gmx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<script>scripts\__spse_data_type_to_color.gml</script>
3030
<script>scripts\__spse_string_to_color.gml</script>
3131
<script>scripts\__spse_watch_add.gml</script>
32+
<script>scripts\__spse_view_update.gml</script>
3233
</scripts>
3334
<script>scripts\__spse_commands_history_update.gml</script>
3435
<script>scripts\__spse_logs_update.gml</script>

extensions/Develpper_Console.extension.gmx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>Develpper_Console</name>
44
<version>1.2.6</version>
55
<packageID></packageID>
6-
<ProductID>ACBD3CFF4E539AD869A0E8E3B4B022DD</ProductID>
6+
<ProductID></ProductID>
77
<date>14/02/20</date>
88
<license>Free to use, also for commercial games.</license>
99
<description></description>

objects/object_instance_follower.object.gmx

Lines changed: 66 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ VariablesName[0] = "";
4242
VariablesValue[0] = "";
4343

4444
//Dynamic position system:
45+
/*
4546
yy = (instance_number(object_instance_follower)*8) mod display_get_gui_height();
4647
xx = 35 + ((instance_number(object_instance_follower)*8) div display_get_gui_height())*70;
47-
48+
*/
4849

4950
//Serves to mesure the distance between the instance and the center of the mouse when the instance is focused.
5051
mx = 0;
@@ -89,33 +90,37 @@ box_bottom = 0;
8990
<string>///Update variobles, position and bounding boxes
9091

9192
//Mouse sync:
92-
if object_main_console.x_mouse &gt; box_left &amp;&amp; object_main_console.x_mouse &lt; box_right &amp;&amp; object_main_console.y_mouse &gt; box_top &amp;&amp; object_main_console.y_mouse &lt; box_bottom{
93+
if point_in_rectangle(mouse_x,mouse_y,box_left,box_top,box_right,box_bottom){
9394
hover = true;
94-
if device_mouse_check_button_pressed(0,mb_left){
95+
if device_mouse_check_button_pressed(0,mb_any){
9596
focus = true;
96-
mx = object_main_console.x_mouse - xx;
97-
my = object_main_console.y_mouse - yy;
97+
mx = mouse_x - xx;
98+
my = mouse_y - yy;
9899
xfocus = xx;
99100
yfocus = yy;
100101
}
101102
}
102103
else{
103-
if object_main_console.x_mouse &gt; Instance_to_track.bbox_left &amp;&amp; object_main_console.x_mouse &lt; Instance_to_track.bbox_right &amp;&amp; object_main_console.y_mouse &gt; Instance_to_track.bbox_top &amp;&amp; object_main_console.y_mouse &lt; Instance_to_track.bbox_bottom{
104+
if point_in_rectangle(mouse_x,mouse_y,Instance_to_track.bbox_left,Instance_to_track.bbox_top,Instance_to_track.bbox_right,Instance_to_track.bbox_bottom){
104105
hover = true;
105106
}
106107
else{
107108
hover = false;
108109
}
109110
}
110111

112+
113+
111114
//Follows the mouse cursor
112115
if (focus){
113116
hover = true;
114-
xx = -mx + object_main_console.x_mouse;
115-
yy = -my + object_main_console.y_mouse;
116-
//Clamp the values to the border of the screen.
117-
xx = clamp(xx,((__spse_string_size(Instance_name)/2)+2),display_get_gui_width()-((__spse_string_size(Instance_name)/2)+2));
118-
yy = clamp(yy,7,display_get_gui_height()-7);
117+
xx = -mx + mouse_x;
118+
yy = -my + mouse_y;
119+
if object_main_console.View != -1{
120+
//Clamp the values to the border of the screen.
121+
xx = clamp(xx,((__spse_string_size(Instance_name)/2)+2),view_wview[object_main_console.View]-((__spse_string_size(Instance_name)/2)+2));
122+
yy = clamp(yy,7,view_hview[object_main_console.View]-7);
123+
}
119124
}
120125

121126

@@ -280,13 +285,14 @@ if focus{
280285
//It means we want to switch the extende state:
281286
__spse_switch_extended_state();
282287
}
283-
288+
/*
284289
if object_main_console.x_mouse &gt; (display_get_gui_width()/2) - 15 &amp;&amp; object_main_console.x_mouse &lt; (display_get_gui_width()/2) + 15 &amp;&amp; object_main_console.y_mouse &gt; display_get_gui_height() - 45 &amp;&amp; object_main_console.y_mouse &lt; display_get_gui_height() - 15{
285290
//The mouse is within the range of the suppressor:
286291
__spse_tracked_instance_flush(Instance_to_track);
287292
instance_destroy();
288293

289294
}
295+
*/
290296

291297
}
292298
</string>
@@ -325,7 +331,7 @@ if object_main_console.Force_all_instances_visible{
325331
</arguments>
326332
</action>
327333
</event>
328-
<event eventtype="8" enumb="75">
334+
<event eventtype="8" enumb="73">
329335
<action>
330336
<libid>1</libid>
331337
<id>603</id>
@@ -346,6 +352,53 @@ if object_main_console.Force_all_instances_visible{
346352
draw_color = draw_get_colour();
347353
draw_alpha = draw_get_alpha();
348354
draw_shader = shader_current();
355+
</string>
356+
</argument>
357+
</arguments>
358+
</action>
359+
<action>
360+
<libid>1</libid>
361+
<id>603</id>
362+
<kind>7</kind>
363+
<userelative>0</userelative>
364+
<isquestion>0</isquestion>
365+
<useapplyto>-1</useapplyto>
366+
<exetype>2</exetype>
367+
<functionname></functionname>
368+
<codestring></codestring>
369+
<whoName>self</whoName>
370+
<relative>0</relative>
371+
<isnot>0</isnot>
372+
<arguments>
373+
<argument>
374+
<kind>1</kind>
375+
<string>///Draw the overlay if the option is set to true
376+
377+
378+
379+
draw_set_alpha(0.3);
380+
shader_reset();
381+
if (hover){
382+
draw_set_color(c_lime);
383+
}
384+
else{
385+
draw_set_color(c_white);
386+
}
387+
388+
389+
if instance_exists(Instance_to_track){
390+
if (object_main_console.Overlay_drawing){
391+
draw_rectangle(
392+
Instance_to_track.bbox_left,
393+
Instance_to_track.bbox_top,
394+
Instance_to_track.bbox_right,
395+
Instance_to_track.bbox_bottom,
396+
false
397+
);
398+
}
399+
}
400+
401+
349402
</string>
350403
</argument>
351404
</arguments>
@@ -488,64 +541,6 @@ if Extended{
488541
draw_set_color(draw_color);
489542
shader_set(draw_shader);
490543
draw_set_alpha(draw_alpha);
491-
</string>
492-
</argument>
493-
</arguments>
494-
</action>
495-
</event>
496-
<event eventtype="8" enumb="73">
497-
<action>
498-
<libid>1</libid>
499-
<id>603</id>
500-
<kind>7</kind>
501-
<userelative>0</userelative>
502-
<isquestion>0</isquestion>
503-
<useapplyto>-1</useapplyto>
504-
<exetype>2</exetype>
505-
<functionname></functionname>
506-
<codestring></codestring>
507-
<whoName>self</whoName>
508-
<relative>0</relative>
509-
<isnot>0</isnot>
510-
<arguments>
511-
<argument>
512-
<kind>1</kind>
513-
<string>///Draw the overlay if the option is set to true
514-
515-
//Backup drawing settings to restore them.
516-
draw_color = draw_get_colour();
517-
draw_alpha = draw_get_alpha();
518-
draw_shader = shader_current();
519-
520-
521-
draw_set_alpha(0.3);
522-
shader_reset();
523-
if (hover){
524-
draw_set_color(c_lime);
525-
}
526-
else{
527-
draw_set_color(c_white);
528-
}
529-
530-
531-
if instance_exists(Instance_to_track){
532-
if (object_main_console.Overlay_drawing){
533-
draw_rectangle(
534-
Instance_to_track.bbox_left,
535-
Instance_to_track.bbox_top,
536-
Instance_to_track.bbox_right,
537-
Instance_to_track.bbox_bottom,
538-
false
539-
);
540-
}
541-
}
542-
543-
544-
545-
//Reset to the usual state:
546-
draw_set_color(draw_color);
547-
shader_set(draw_shader);
548-
draw_set_alpha(draw_alpha);
549544
</string>
550545
</argument>
551546
</arguments>

objects/object_main_console.object.gmx

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727
<kind>1</kind>
2828
<string>///Initialize many things;
2929
Interact = false;
30-
Console_width = display_get_gui_width()-2;
31-
Console_height = max(display_get_gui_height()/2,min(240,display_get_gui_height()));
32-
display_set_gui_maximise();
30+
View = -1;
31+
32+
__spse_view_update();
3333

34-
x_mouse = device_mouse_x_to_gui(0);
35-
y_mouse = device_mouse_y_to_gui(0);
3634

3735
Body_color = c_black; //make_colour_rgb(30,30,30) Dark grey;
3836
Body_color_light = c_black; //make_color_rgb(50,50,50); Light grey;
@@ -108,6 +106,30 @@ for(i=1;i&lt;=string_length(Available_keys);i++){
108106
<string>///Switch the blink status
109107
blink = !blink;
110108
alarm[11] = blink_speed;
109+
</string>
110+
</argument>
111+
</arguments>
112+
</action>
113+
</event>
114+
<event eventtype="2" enumb="10">
115+
<action>
116+
<libid>1</libid>
117+
<id>603</id>
118+
<kind>7</kind>
119+
<userelative>0</userelative>
120+
<isquestion>0</isquestion>
121+
<useapplyto>-1</useapplyto>
122+
<exetype>2</exetype>
123+
<functionname></functionname>
124+
<codestring></codestring>
125+
<whoName>self</whoName>
126+
<relative>0</relative>
127+
<isnot>0</isnot>
128+
<arguments>
129+
<argument>
130+
<kind>1</kind>
131+
<string>///Update size if needed:
132+
__spse_view_update();
111133
</string>
112134
</argument>
113135
</arguments>
@@ -130,14 +152,12 @@ alarm[11] = blink_speed;
130152
<arguments>
131153
<argument>
132154
<kind>1</kind>
133-
<string>///Update the gui size, check if there are dead instances and get the mouse positions:
134-
Console_width = display_get_gui_width()-2;
135-
Console_height = min(floor(display_get_gui_height()/2),min(240,display_get_gui_height()));
136-
//display_set_gui_maximise();
155+
<string>///Check if there are dead instances and update positions:
137156

138-
//update mouse position
139-
x_mouse = device_mouse_x_to_gui(0);
140-
y_mouse = device_mouse_y_to_gui(0);
157+
if View != -1{
158+
x = view_xview[View];
159+
y = view_yview[View];
160+
}
141161

142162
//Check dead instances.
143163
for(i=0;i&lt;array_length_1d(Tracked_instances);i+=1){
@@ -226,7 +246,7 @@ if (mouse_collision != noone){
226246
</arguments>
227247
</action>
228248
</event>
229-
<event eventtype="8" enumb="75">
249+
<event eventtype="8" enumb="73">
230250
<action>
231251
<libid>1</libid>
232252
<id>603</id>
@@ -263,17 +283,17 @@ if(Interact){ //It means we have to draw the gui
263283
var tmp_counter = 0;
264284
var tmp_position = Console_height-8;
265285
repeat(min(floor((Console_height-8)/16),array_height_2d(Logs))){
266-
__spse_draw_text_sprite_font_colored(16,tmp_position,ConvertedLogs[tmp_counter],Logs[tmp_counter,1]);
286+
__spse_draw_text_sprite_font_colored(x+16,y+tmp_position,ConvertedLogs[tmp_counter],Logs[tmp_counter,1]);
267287
tmp_position-=16;
268288
tmp_counter+=1;
269289
}
270290

271291

272292
draw_set_color(c_white);
273293
//Draw the command text section.
274-
__spse_draw_text_sprite_font(32,16, Displayed_text);
294+
__spse_draw_text_sprite_font(x+32,y+16, Displayed_text);
275295
if (blink){
276-
draw_line(((blink_position-1)*8)+28,11,((blink_position-1)*8)+28,19);
296+
draw_line(x+((blink_position-1)*8)+28,y+11,x+((blink_position-1)*8)+28,y+19);
277297
}
278298

279299

scripts/__spse_view_update.gml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
///__spse_view_update();
2+
//This script will just tell to the console if a view is present, and if there is one, wil take the first visible view;
3+
//It will then reconfigure the console visual parameters to better fit the actual situation.
4+
//We have to figure out how to size the console since we can't rely on the gui size.
5+
//MUST BE USED ONLY WITH THE MAIN CONSOLE !
6+
var __tpm;
7+
8+
View = -1;
9+
__tmp = 0;
10+
if view_enabled{
11+
repeat(8){
12+
if view_visible[__tmp]{
13+
View = __tmp;
14+
exit;
15+
}
16+
__tmp +=1;
17+
}
18+
}
19+
20+
if View = -1{
21+
//No view, amarite;
22+
Console_width = room_width-2;
23+
Console_height = max(room_height/2,min(240,room_height));
24+
}
25+
else{
26+
Console_width = view_wview[View]-2;
27+
Console_height = max(view_hview[View]/2,min(240,view_hview[View]));
28+
}
29+
30+
alarm[10] = room_speed; //Update the size every second.

0 commit comments

Comments
 (0)