---
name: "mouse_on_screen"
section: "3alleg4"
platform: "linux"
package: "allegro4-doc"
version: "2:4.4.3.1-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mouse_on_screen"
---

# mouse\_on\_screen(3alleg4)

Tells you whether the mouse pointer is currently on screen. Allegro game programming library.

## NAME

mouse\_on\_screen - Tells you whether the mouse pointer is currently on screen. Allegro game programming library.

## SYNOPSIS

**#include \<allegro.h\>**

**int mouse\_on\_screen();**

## DESCRIPTION

This function can be useful to prevent having two mouse pointers on the  screen at the same time when running your program in windowed mode and  drawing the mouse pointer yourself. Other possible uses include the  ability to pause your game when the mouse goes off of the window, or  only scrolling the view when the pointer is near the edge of the window, but not while off of the window.

Example :

```
   if (mouse_on_screen()) {draw_sprite(buffer , mouse_sprite , mouse_x , mouse_y);}
```

## RETURN VALUE

Returns 0 if the mouse pointer is off of the screen, or non-zero otherwise.
