Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

There's a demo project (GMZ) included.

Usually you do

if (window_has_focus()) {
    display_mouse_lock(window_get_x(), window_get_y(), window_get_width(), window_get_height());
} else display_mouse_unlock();

to lock the mouse to window rectangle (and unlock when the game doesn't have focus) and that's it really