www.gmindo.web.id/forum
Forum ini sudah tidak dipakai lagi. Silakan ke forum baru di www.gmindo.web.id/forum Very Happy

Terima kasih

[ASk] event draw

Topik sebelumnya Topik selanjutnya Go down

[ASk] event draw

Post by L.M Afrizal R on Sun 19 Jan 2014, 01:52

mau nanya nih, bedanya "draw" sama "draw GUI" di GMS itu apa ?
sama event "Resize" nya juga ya  Very Happy 
avatar
L.M Afrizal R
GM Beginner
GM Beginner

100%
Jumlah posting : 165
Points : 125
Join date : 15.07.13
Age : 18

Lihat profil user

Kembali Ke Atas Go down

Re: [ASk] event draw

Post by Kevin Blaze Coolerz on Sun 19 Jan 2014, 09:22

di GMS, tekan F1 gan Very Happy

Draw GUI:

This is a sub-event of the Draw Event and is specifically designed for drawing GUI (Graphical User Interface) elements that are not affected by the view scale or rotation. This means that you can have an instance draw all the elements for your HUD without having to base all the positioning on the position within the room of the instance and the position of the current view either.

When drawing in this event it is important that you understand that the draw coordinates do not change even when views are active and 0,0 is always the top left hand corner with the width and height of the display being your maximum drawing width and height. Depth ordering is still maintained between different instances (so an instance at a low depth will draw over one at a higher depth) and also within the event itself (the first things drawn will appear underneath the later things being drawn) and it can also be used in conjunction with the normal Draw Event (which will be affected by the view position, scale and rotation as normal). If you have no Draw Event but you do have Draw GUI Event, then GameMaker:Studio will still default draw the sprite for the instance (if it has one) as normal.

You may notice depth issues when using this event due to the fact that it is not dealt with the same was as the traditional draw event. What happens is that the normal draw event for all instances is resolved first and then the draw GUI event for all instances is resolved. So the depth order between instances with draw GUI events is always respected, as is the depth order between instances with normal draw events, but the draw GUI event will always draw over anything drawn in the normal draw event, even if the instance doing the drawing it is at a higher depth than other instances.

NOTE: This event will, by default, draw 1:1 with the background canvas size, which can make things a little complicated, and perhaps unexpected in places, on those target platforms that permit a fullscreen mode (HTML5, Windows, Ubuntu (Linux) and MacOS). For example on HTML5, going fullscreen the GUI draws pretty small when everything else gets bigger because the background surface is now the size of the screen. However, on Windows, Ubuntu (Linux) and MacOS when you go fullscreen it doesn't always change the size of the background canvas, meaning that whatever is drawn in this event can be scaled up like everything else, but you can get around this if you use the window_set_size to force it to be the same as the client area, then it will be small, just like the HTML5 one. You may also lock the GUI event to a specific size and this will then be scaled to fit the display dimensions automatically by using the function display_set_gui_size.

Resize Event:

This is a sub-event of the Draw Event and is specifically designed for reacting to the change in the Windows 8 canvas size when the game window is "snapped".

On the Windows 8 target platform it is important that you catch any resizing of the game canvas from the "snapping" of the game window (when the user drags the window to the side of the display, for example). This event will do just that and is triggered every time the canvas is changed, permitting you to add custom code here that will resize the view or reposition HUD elements as necessary. This function is provided as a convenient way to avoid having step event code that checks for these things all the time.

NOTE: You cannot draw in this event! It is triggered by resizing the canvas and is only for catching this change... any drawing that should be done still must be in one of the other two draw events.

secara garis besar:
-Draw GUI itu utk draw HUD, jdi posisi (x,y) nya otomatis mengikuti posisi view (bisa di lakukan di Draw event biasa juga, namun utk draw biasa, musti kasih view_xview+X,view_yview+Y ). juga depth ny rendah, memungkinkan HUD ny terlihat paling atas.

-Resize: lebih di tujukan ke windows 8. ya ak kurang tau bnyk soal ini, cz ak gk pke win8 Very Happy tpi dri kata2 di dalam spoiler, ini utk attach game kita di samping layar, dan hal ini membuat game kita ter-resize.

-kalo draw event biasa ya kyk biasa Very Happy


Terakhir diubah oleh Kevin Blaze Coolerz tanggal Mon 20 Jan 2014, 20:50, total 1 kali diubah (Reason for editing : ralat dikit)
avatar
Kevin Blaze Coolerz
Admin
Admin

100%
Jumlah posting : 3323
Points : 3795
Join date : 06.01.13
Age : 22
Lokasi : Palembang

Lihat profil user http://kevin-blaze-coolerz.blogspot.com/

Kembali Ke Atas Go down

Re: [ASk] event draw

Post by zebrakelabu on Mon 20 Jan 2014, 20:11

Kevin Blaze Coolerz wrote:di GMS, tekan F1 gan Very Happy

secara garis besar:
-Draw GUI itu utk draw HUD, jdi posisi (x,y) nya otomatis mengikuti posisi view (bisa di lakukan di Draw event biasa juga, namun utk draw gui, musti kasih view_xview+X,view_yview+Y ). juga depth ny rendah, memungkinkan HUD ny terlihat paling atas.


Elu yakin tu kev  Question 

DrawGUI itu sudah ga pakai view_xview atay view_yview, langsung aja 0,0 atau 5,5, Studio akan langsung menggambar di koordinat screen tanpa menghiraukan view ataupun port. Dan tidak terpengaruh pada depth, karena depth untuk draw diresolve dulu baru depth di DrawGUI di resolve, jadi walaupun depth nya besar tapi karena DrawGUI tetap digambar diatas draw. Coba deh cek
avatar
zebrakelabu
Admin
Admin

100%
Jumlah posting : 933
Points : 960
Join date : 06.01.13
Lokasi : Jakarta

Lihat profil user http://www.project25games.com

Kembali Ke Atas Go down

Re: [ASk] event draw

Post by Kevin Blaze Coolerz on Mon 20 Jan 2014, 20:49

^wah, salah ketik kyk ny lol! 
bukan "draw gui" tpi "draw biasa".
kan udh ak tulis di kalimat sebelum ny, "Draw GUI itu utk draw HUD, jdi posisi (x,y) nya otomatis mengikuti posisi view" Very Happy

utk depth ak tau ny sih draw gui itu rendah, tpi emg bner sih, yg nama ny GUI pasti selalu dibuat paling rendah Very Happy

thx utk ralat ny om Smile

avatar
Kevin Blaze Coolerz
Admin
Admin

100%
Jumlah posting : 3323
Points : 3795
Join date : 06.01.13
Age : 22
Lokasi : Palembang

Lihat profil user http://kevin-blaze-coolerz.blogspot.com/

Kembali Ke Atas Go down

Re: [ASk] event draw

Post by Sponsored content


Sponsored content


Kembali Ke Atas Go down

Topik sebelumnya Topik selanjutnya Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik