$treeview $search $mathjax
Stratagus
2.2.6
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "stratagus.h"
#include "tileset.h"
#include "video.h"
#include "map.h"
#include "sound.h"
#include "unitsound.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "missile.h"
#include "commands.h"
#include "minimap.h"
#include "font.h"
#include "cursor.h"
#include "interface.h"
#include "menus.h"
#include "ui.h"
#include "network.h"
#include "spells.h"
#include "widgets.h"
mouse.cpp - The mouse handling. | |
#define | ICON_SIZE_X (UI.ButtonPanel.Buttons[0].Style->Width) |
#define | ICON_SIZE_Y (UI.ButtonPanel.Buttons[0].Style->Height) |
int | MouseButtons |
pressed mouse buttons (normal,double,dragged,long) | |
int | KeyModifiers |
Current pressed mouse buttons. | |
CUnitPtr | UnitUnderCursor |
Current keyboard modifiers. | |
int | ButtonAreaUnderCursor = -1 |
Unit under cursor. | |
int | ButtonUnderCursor = -1 |
Button area under cursor. | |
bool | GameMenuButtonClicked |
Button under cursor. | |
bool | GameDiplomacyButtonClicked |
Menu button was clicked. | |
bool | LeaveStops |
Diplomacy button was clicked. | |
enum _cursor_on_ | CursorOn = CursorOnUnknown |
Mouse leaves windows stops scroll. | |
static void | HandlePieMenuMouseSelection () |
Cursor on field. | |
void | CancelBuildingMode () |
Cancel the building input mode. | |
void | DoRightButton (int sx, int sy) |
Called if right mouse button is pressed. | |
static bool | OnButton (int x, int y, CUIButton *button) |
static void | HandleMouseOn (int x, int y) |
void | HandleMouseExit () |
Called if the mouse exits the game window (only for some videomodes). | |
void | RestrictCursorToViewport () |
Restrict mouse cursor to viewport. | |
void | RestrictCursorToMinimap () |
Restrict mouse cursor to minimap. | |
void | MouseScrollMap (int x, int y) |
Use the mouse to scroll the map. | |
void | UIHandleMouseMove (int x, int y) |
Called if the mouse is moved in Normal interface state. | |
static int | SendRepair (int sx, int sy) |
static int | SendMove (int sx, int sy) |
static int | SendAttack (int sx, int sy) |
static int | SendAttackGround (int sx, int sy) |
static int | SendPatrol (int sx, int sy) |
static int | SendResource (int sx, int sy) |
static int | SendUnload (int sx, int sy) |
static int | SendSpellCast (int sx, int sy) |
static void | SendCommand (int sx, int sy) |
static void | DoSelectionButtons (int num, unsigned) |
static void | UISelectStateButtonDown (unsigned) |
void | UIHandleButtonDown (unsigned button) |
Called if any mouse button is pressed down. | |
void | UIHandleButtonUp (unsigned button) |
Called if any mouse button is released up. | |
static int | GetPieUnderCursor () |
void | DrawPieMenu () |
Draw the Pie Menu. | |
Defines | |
#define | LongLeftButton (MouseButtons & ((LeftButton << MouseHoldShift))) |
#define | DoubleLeftButton (MouseButtons & (LeftButton << MouseDoubleShift)) |
#define DoubleLeftButton (MouseButtons & (LeftButton << MouseDoubleShift)) |
#define ICON_SIZE_X (UI.ButtonPanel.Buttons[0].Style->Width) |
#define ICON_SIZE_Y (UI.ButtonPanel.Buttons[0].Style->Height) |
#define LongLeftButton (MouseButtons & ((LeftButton << MouseHoldShift))) |
void CancelBuildingMode | ( | ) |
Cancel the building input mode.
Cancel building cursor mode.
void DoRightButton | ( | int | sx, | |
int | sy | |||
) |
Called if right mouse button is pressed.
Called when right button is pressed
sx | X map position in pixels. | |
sy | Y map position in pixels. |
static void DoSelectionButtons | ( | int | num, | |
unsigned | ||||
) | [static] |
Mouse button press on selection/group area.
num | Button number. | |
button | Mouse Button pressed. |
void DrawPieMenu | ( | ) |
Draw the Pie Menu.
Draw Pie Menu
static int GetPieUnderCursor | ( | ) | [static] |
Get pie menu under the cursor
void HandleMouseExit | ( | ) |
Called if the mouse exits the game window (only for some videomodes).
Handle cursor exits the game window (only for some videomodes)
static void HandleMouseOn | ( | int | x, | |
int | y | |||
) | [static] |
Set flag on which area is the cursor.
x | X coordinate. | |
y | Y coordinate. |
static void HandlePieMenuMouseSelection | ( | ) | [static] |
Cursor on field.
Handle pie menu mouse selection
void MouseScrollMap | ( | int | x, | |
int | y | |||
) |
Use the mouse to scroll the map.
Use the mouse to scroll the map
x | Screen X position. | |
y | Screen Y position. |
static bool OnButton | ( | int | x, | |
int | y, | |||
CUIButton * | button | |||
) | [inline, static] |
Check if the mouse is on a button
x | X coordinate. | |
y | Y coordinate. | |
button | Button to check. |
void RestrictCursorToMinimap | ( | ) |
Restrict mouse cursor to minimap.
Restrict mouse cursor to minimap
void RestrictCursorToViewport | ( | ) |
Restrict mouse cursor to viewport.
Restrict mouse cursor to viewport.
static int SendAttack | ( | int | sx, | |
int | sy | |||
) | [static] |
Send the current selected group attacking.
To empty field: Move to this field attacking all enemy units in reaction range.
To unit: Move to unit attacking and tracing the unit until dead.
sx | X screen map position. | |
sy | Y screen map position. |
static int SendAttackGround | ( | int | sx, | |
int | sy | |||
) | [static] |
Send the current selected group ground attacking.
sx | X screen map position. | |
sy | Y screen map position. |
static void SendCommand | ( | int | sx, | |
int | sy | |||
) | [static] |
Send a command to selected units.
sx | X screen map position | |
sy | Y screen map position |
static int SendMove | ( | int | sx, | |
int | sy | |||
) | [static] |
Send selected units to point.
sx | X screen tile position. | |
sy | Y screen tile position. |
static int SendPatrol | ( | int | sx, | |
int | sy | |||
) | [static] |
Let units patrol between current postion and the selected.
sx | X screen map position. | |
sy | Y screen map position. |
static int SendRepair | ( | int | sx, | |
int | sy | |||
) | [static] |
Send selected units to repair
sx | X screen map position. | |
sy | Y screen map position. |
static int SendResource | ( | int | sx, | |
int | sy | |||
) | [static] |
Let units harvest wood/mine gold/haul oil
sx | X screen map position | |
sy | Y screen map position |
static int SendSpellCast | ( | int | sx, | |
int | sy | |||
) | [static] |
Send the current selected group for spell cast.
To empty field: To unit: Spell cast on unit or on map spot.
sx | X screen map position. | |
sy | Y screen map position. |
static int SendUnload | ( | int | sx, | |
int | sy | |||
) | [static] |
Send selected units to unload passengers.
sx | X screen map position. | |
sy | Y screen map position. |
void UIHandleButtonDown | ( | unsigned | button | ) |
Called if any mouse button is pressed down.
Called if mouse button pressed down.
button | Button pressed down. |
Detect long left selection click
Detect double left click
void UIHandleButtonUp | ( | unsigned | button | ) |
Called if any mouse button is released up.
Called if mouse button released.
button | Button released. |
void UIHandleMouseMove | ( | int | x, | |
int | y | |||
) |
Called if the mouse is moved in Normal interface state.
Handle movement of the cursor.
x | Screen X position. | |
y | Screen Y position. |
static void UISelectStateButtonDown | ( | unsigned | ) | [static] |
Handle mouse button pressed in select state.
Select state is used for target of patrol, attack, move, ....
button | Button pressed down. |
int ButtonAreaUnderCursor = -1 |
Unit under cursor.
button area under the cursor
int ButtonUnderCursor = -1 |
Button area under cursor.
button number under the cursor
enum _cursor_on_ CursorOn = CursorOnUnknown |
Mouse leaves windows stops scroll.
current CursorOn field
Menu button was clicked.
diplomacy button was clicked down
Button under cursor.
menu button was clicked down
int KeyModifiers |
Current pressed mouse buttons.
current active modifiers
bool LeaveStops |
Diplomacy button was clicked.
Mouse leaves windows stops scroll.
int MouseButtons |
pressed mouse buttons (normal,double,dragged,long)
Current keyboard modifiers.
shared pointer to unit under the cursor