• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML draw_GUI is not based on camera coordinates(Resorved!)

U

uni00

Guest
Hello. I want to make a scope bar that displays the items that a character has below. Therefore, I would like to make a click decision within the range of the inventory frame. However, even if the click range is set in draw_GUI, it will be based on the room coordinates. what should I do? MOD EDIT: Hello. I want to make an inventory bar that displays the items that a character has below. Therefore, I would like to make a click judgment within the range of the inventory frame. However, even if the click range is set in draw_GUI, the room coordinates will be the reference. what should I do?スクリーンショット (93).pngスクリーンショット (96).pngスクリーンショット (94).png



[CODE = gml] if(mouse_check_button(mb_left))
{
var camx = camera_get_view_x(0);
var camy = camera_get_view_y(0);

var xx、yy;
xx = window_view_mouse_get_x(0);
yy = window_view_mouse_get_y(0);

if(xx> camx + 530-96 +(64)&& xx <camx + 530-96 +(64 * 2)&& yy> camy + 670 && yy <camy + 700)
{
global.a_press = true;
}
}[/コード]
 
Last edited by a moderator:
No, it is not. Draw GUI uses separate coordinates unrelated to your camera. This is to allow you to scale and position UI elements separately from "gameplay" elements.
 
U

uni00

Guest
ありがとうございました。つまり、カメラではなく、ウィンドウで見ることができる限りです。
それでは、在庫にどのように触れますか?.. ..


MOD EDIT:
Thank you very much. That is, as long as you can see it in the window, not the camera.
So how do you approach inventory?
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Please post in English on the forum, as it makes it easier if we all use the same language. If you don't know English, then please use Google Translate or some other tool. I've edited your posts to include translation... Thanks!

フォーラムに英語で投稿してください。全員が同じ言語を使用する方が簡単です。英語がわからない場合は、Google翻訳などのツールを使用してください。翻訳を含めるようにあなたの投稿を編集しました...ありがとう!
 
The way to approach clickable GUI components is to use device_mouse_x_to_gui(0) and device_mouse_y_to_gui(0). These will translate the room position of the mouse into GUI coordinates (more accurately, they reflect the position of the cursor within the game window, with GUI scaling applied).
 

woods

Member
google translate:
Hello. I want to make an inventory bar that displays the items that a character has below. Therefore, I would like to make a click judgment within the range of the inventory frame. However, even if the click range is set in draw_GUI, it will be based on the room coordinates. what should I do


click on the object in the game world to pick the item up.. and when it goes to the inventory-backpack-hotbar, draw the sprite for the item on the GUI layer?
from here you can reference equiped item slot..
something like keyboard_check (ord("1") ) for the 1st slot
 
U

uni00

Guest
Please post in English on the forum, as it makes it easier if we all use the same language. If you don't know English, then please use Google Translate or some other tool. I've edited your posts to include translation... Thanks!

フォーラムに英語で投稿してください。全員が同じ言語を使用する方が簡単です。英語がわからない場合は、Google翻訳などのツールを使用してください。翻訳を含めるようにあなたの投稿を編集しました...ありがとう!
Wow! I am sorry
 
U

uni00

Guest
みんなありがとう。そのおかげで、制作が一週間も続かなかった原因を取り除くことができました。あなたは私の救世主です。同じ理由で精神的に衰弱している方→device_mouse_x_to_gui(0)に変更することで解決しました。どうもありがとうございました。
thank you everyone. Thanks to that, I was able to eliminate the cause of the production not continuing for a week. You are my savior. For those who are mentally deteriorated for the same reason → I was resolved by changing to device_mouse_x_to_gui (0). Thank you very much.
 
Top