Skip to content

Commit ccbeb7f

Browse files
committed
input box
1 parent 615ad5e commit ccbeb7f

9 files changed

Lines changed: 99 additions & 16 deletions

File tree

HexCharter.yyp

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

objects/obj_chartcontroller/Step_0.gml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if livemode {
1717
}
1818
}
1919

20-
if keyboard_check_pressed(vk_space) {
20+
if keyboard_check_pressed(vk_space) and not instance_exists(obj_input) {
2121
if paused {
2222
paused = false
2323
curr_cam_targ = 2
@@ -50,20 +50,20 @@ else
5050

5151
var mx = floor(mouse_x/35)
5252
if paused {
53-
if (is_scrolling_down() or keyboard_check_pressed(vk_down)) and not ((mx > 5 and mx < 325) and (mouse_y > 675 and mouse_y < 715))
53+
if (is_scrolling_down() or keyboard_check_pressed(vk_down)) and not ((mx > 5 and mx < 325) and (mouse_y > 675 and mouse_y < 715)) and not instance_exists(obj_input)
5454
y-=s
5555

56-
if (is_scrolling_up() or keyboard_check_pressed(vk_up)) and not ((mx > 5 and mx < 325) and (mouse_y > 675 and mouse_y < 715))
56+
if (is_scrolling_up() or keyboard_check_pressed(vk_up)) and not ((mx > 5 and mx < 325) and (mouse_y > 675 and mouse_y < 715)) and not instance_exists(obj_input)
5757
y+=s
5858

59-
if keyboard_check_pressed(ord("D"))
59+
if keyboard_check_pressed(ord("D")) and not instance_exists(obj_input)
6060
y = (floor((y-1)/(s*16))) * (s*16)
6161

62-
if keyboard_check_pressed(ord("A"))
62+
if keyboard_check_pressed(ord("A")) and not instance_exists(obj_input)
6363
y = (ceil((y+1)/(s*16))) * (s*16)
6464
}
6565
else
66-
if (is_scrolling_down() or keyboard_check_pressed(vk_down) or is_scrolling_up() or keyboard_check_pressed(vk_up) or (keyboard_check_pressed(ord("A")) or keyboard_check_pressed(ord("D")) and not livemode) ) and not ((mx > 5 and mx < 320+5) and (mouse_y > 675 and mouse_y < 715))
66+
if (is_scrolling_down() or keyboard_check_pressed(vk_down) or is_scrolling_up() or keyboard_check_pressed(vk_up) or (keyboard_check_pressed(ord("A")) or keyboard_check_pressed(ord("D")) and not livemode) ) and not ((mx > 5 and mx < 320+5) and (mouse_y > 675 and mouse_y < 715)) and not instance_exists(obj_input)
6767
{
6868
audio_pause_sound(songplaying);
6969
paused = true;
@@ -184,7 +184,7 @@ else {
184184
var num
185185
for (num = 0; num <= 9; num++)
186186
{
187-
if (keyboard_check_pressed(ord(num))) {
187+
if (keyboard_check_pressed(ord(num))) and not instance_exists(obj_input) {
188188
audio_sound_set_track_position(songplaying, num * 0.1 * audio_sound_length(songplaying))
189189
if !paused
190190
y = -((audio_sound_get_track_position(songplaying) / 60) * bpm * 4) * 32
@@ -197,7 +197,6 @@ for (num = 0; num <= 9; num++)
197197

198198
y=min(y,0)
199199
receptor_y = round((-y+0.5)/32)
200-
print(receptor_y)
201200

202201
curb = floor(((mouse_y-y))/32)-3
203202

@@ -212,7 +211,7 @@ if not lockbb {
212211

213212
// charting COMMENCE
214213

215-
if !(curbb < 0 or curbb >= keys*2) and !(curb < 0 or curb > songlong) {
214+
if !(curbb < 0 or curbb >= keys*2) and !(curb < 0 or curb > songlong) and not instance_exists(obj_input) {
216215
if mouse_check_button_pressed(mb_left) {
217216
if curtype == -1
218217
notes[curbb,curb] = customtype

objects/obj_input/Create_0.gml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
keyboard_string = ""
2+
keywidth = 0

objects/obj_input/Draw_64.gml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
draw_set_halign(fa_center)
2+
draw_set_valign(fa_middle)
3+
draw_set_font(fnt_dropdown)
4+
draw_set_alpha(0.7)
5+
draw_set_color(obj_persistent.col_overlay)
6+
7+
// main box
8+
draw_rectangle(room_width/2-string_width(str),room_height/2-100,room_width/2+string_width(str),room_height/2+100,false)
9+
10+
draw_set_alpha(0.9)
11+
12+
// textbox
13+
draw_rectangle(room_width/2-keywidth,50+room_height/2-25,room_width/2+keywidth,50+room_height/2+25,false)
14+
15+
draw_set_alpha(1)
16+
draw_set_color(c_white)
17+
18+
draw_text(room_width/2,room_height/2-50,str)
19+
draw_text(room_width/2,50+room_height/2,keyboard_string)

objects/obj_input/KeyPress_13.gml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// do you think someone has made a game where the player is controlled using these events
2+
// i really hope not
3+
4+
func(keyboard_string)
5+
instance_destroy()

objects/obj_input/Step_0.gml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
keywidth = string_width(keyboard_string)/1.5
2+
keywidth = max(keywidth,string_width(str)/2)
3+
4+
obj_chartcontroller.paused = true

objects/obj_input/obj_input.yy

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

objects/obj_topbar/Step_0.gml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,24 @@ if inrange2 and mouse_check_button_pressed(mb_left) {
7676
print(cursection)
7777
switch(curopt) {
7878
case 0: // copy last section
79-
if cursection != 0 {
80-
for (var j = 0; j < obj_chartcontroller.keys*2; j++) {
81-
for (var i = 0; i < 16; i++) {
82-
obj_chartcontroller.notes[j, (cursection)*16+i] = obj_chartcontroller.notes[j, (cursection-1)*16+i]
79+
input("Section offset?",function(num) {
80+
try {
81+
num = round(real(num)) // juust incase you stink
82+
}
83+
catch(_ex) {
84+
alert_make("thats no number..")
85+
}
86+
var cursection = abs((floor((obj_chartcontroller.y-1)/(obj_chartcontroller.mscroll*16)))+1)
87+
if cursection != 0 {
88+
for (var j = 0; j < obj_chartcontroller.keys*2; j++) {
89+
for (var i = 0; i < 16; i++) {
90+
obj_chartcontroller.notes[j, (cursection)*16+i] = obj_chartcontroller.notes[j, (cursection-num)*16+i]
91+
}
8392
}
8493
}
85-
}
86-
menuopen = noone
87-
selected = -1
94+
menuopen = noone
95+
selected = -1
96+
})
8897
break
8998
case 1: // swap section
9099
var notecopy = []

scripts/scr_dumb/scr_dumb.gml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ function alert_make(str, play_sound = true, alert_time = 30) {
2020
obj.num = instance_number(obj_alert)-1
2121
}
2222

23+
function input(str,func) {
24+
var obj = instance_create_depth(0,0,0,obj_input)
25+
obj.str = str
26+
obj.func = func
27+
}
28+
2329
function is_scrolling_down() {
2430
if !keyboard_check(vk_control)
2531
return mouse_wheel_down()

0 commit comments

Comments
 (0)