May 09, 2021, 10:58:11 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1]

Author Topic: Mouse follows map  (Read 1192 times)

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Mouse follows map
« on: May 01, 2013, 02:18:58 am »

Hold space to make the mouse follow the map. This is the most useless plugin I have ever created, holy shit.

Also it's really laggy.

Code: (mapFollow.gml) [Select]
object_event_add(PlayerControl, ev_create, 0, "
_window_is_focused = false;
_setmouse = false;
v_mx = view_xview;
v_my = view_yview;
");
//ev_step_normal ev_step_begin ev_step_end
object_event_add(PlayerControl, ev_step, ev_step_begin, "
if(keyboard_check_pressed(vk_space))
{
v_mx = view_xview;
v_my = view_yview;
}
if(keyboard_check(vk_space))
{
keyboard_key_release(vk_pause);
_window_is_focused = keyboard_check_released(vk_pause);

// GM has some really useless functions y'know
_widescreen_window = ((window_get_width()/window_get_height()) > (4/3));
if (_widescreen_window)
{
_scale = window_get_height()/600;
_gamewidth = (4/3)*window_get_height();
_sidebarwidth = (window_get_width()-_gamewidth)/2;
_topbarwidth = 0;
}
else
{
_scale = window_get_width()/800;
_gameheight = (4/3)*window_get_width();
_topbarwidth = (window_get_height()-_gameheight)/2;
_sidebarwidth = 0;
}

_setmouse = false;
if (global.myself.object != -1 and _window_is_focused)
{
v_mx = (view_xview-v_mx)*_scale;
v_my = (view_yview-v_my)*_scale;
window_mouse_set(min(max(window_mouse_get_x()-v_mx, _sidebarwidth), view_wview*_scale-1+_sidebarwidth),
min(max(window_mouse_get_y()-v_my, _topbarwidth ), view_hview*_scale-1+_topbarwidth ));
v_mx = view_xview;
v_my = view_yview;
_setmouse = true;
}
}
");
« Last Edit: May 01, 2013, 02:37:51 am by Phantom Brave »
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

[FR]YB

  • 2013 Haxxy Award Winner
  • *
  • Karma: 28
  • Offline Offline
  • Posts: 642
  • There are 11 people playing holy sh
Re: Mouse follows map
« Reply #1 on: May 01, 2013, 10:45:57 am »

This is the most useless plugin I have ever created, holy shit.

But it's not useless... Gotta check your other plugins then  :drool:

Still, maybe you could improve it, make the space bar toggle whether the plugin is activated or not, instead of having the user holding the key.
I don't like holding keys down for hours while playing :hehe:

How about renaming the topic to "Mouse stays in window" ? I didn't understand what this plugin does until I read the code.

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: Mouse follows map
« Reply #2 on: May 01, 2013, 04:58:30 pm »

Staying in window is only a side effect of being reasonable though. It has nothing to do with the intent.
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Nova

  • Seasoned Member
  • *****
  • Karma: 4
  • Offline Offline
  • Posts: 1740
  • Personal Text
Re: Mouse follows map
« Reply #3 on: May 04, 2013, 09:02:00 am »

Wait, what is the use of that plug-in?
Does it make the crosshair and cursor follow the ground like a character or what? I can't speak "code" so yes.
Logged

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: Mouse follows map
« Reply #4 on: May 04, 2013, 09:04:28 am »

yes
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters
Pages: [1]
 

Page created in 0.038 seconds with 37 queries.