_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <deque>
#include "stratagus.h"
#include "editor.h"
#include "commands.h"
#include "font.h"
#include "game.h"
#include "guichan.h"
#include "interface.h"
#include "iocompat.h"
#include "iolib.h"
#include "map.h"
#include "menus.h"
#include "minimap.h"
#include "network.h"
#include "parameters.h"
#include "replay.h"
#include "script.h"
#include "settings.h"
#include "sound.h"
#include "sound_server.h"
#include "tileset.h"
#include "translate.h"
#include "ui.h"
#include "unit_find.h"
#include "unittype.h"
#include "video.h"
#include "widgets.h"
Classes | |
struct | EditorAction |
class | EditorUnitSliderListener |
class | EditorSliderListener |
editloop.cpp - The editor main loop. | |
#define | UNIT_ICON_X (IconWidth + 7) |
#define | UNIT_ICON_Y (0) |
#define | TILE_ICON_X (IconWidth * 2 + 16) |
#define | TILE_ICON_Y (2) |
#define | START_ICON_X (IconWidth * 3 + 16) |
#define | START_ICON_Y (2) |
enum | _mode_buttons_ { SelectButton = 201, UnitButton, TileButton, StartButton } |
enum | EditorActionType { EditorActionTypePlaceUnit, EditorActionTypeRemoveUnit } |
static int | IconWidth |
static int | IconHeight |
Icon width in panels. More... | |
static int | ButtonPanelWidth |
Icon height in panels. More... | |
static int | ButtonPanelHeight |
char | TileToolRandom |
static char | TileToolDecoration |
Tile tool draws random. More... | |
static int | TileCursorSize |
Tile tool draws with decorations. More... | |
static bool | UnitPlacedThisPress = false |
Tile cursor size 1x1 2x2 ... 4x4. More... | |
static bool | UpdateMinimap = false |
Only allow one unit per press. More... | |
static int | MirrorEdit = 0 |
Update units on the minimap. More... | |
static int | VisibleUnitIcons |
Mirror editing enabled. More... | |
static int | VisibleTileIcons |
Number of icons that are visible at a time. More... | |
static std::deque< EditorAction > | EditorUndoActions |
static std::deque< EditorAction > | EditorRedoActions |
gcn::Gui * | Gui |
static gcn::Container * | editorContainer |
static gcn::Slider * | editorUnitSlider |
static gcn::Slider * | editorSlider |
static EditorUnitSliderListener * | editorUnitSliderListener |
static EditorSliderListener * | editorSliderListener |
void | DoScrollArea (int state, bool fast, bool isKeyboard) |
Editor callbacks. More... | |
void | DrawGuichanWidgets () |
void | CleanGame () |
static void | EditorUndoAction () |
static void | EditorRedoAction () |
static void | EditorAddUndoAction (EditorAction action) |
static void | EditTile (const Vec2i &pos, int tile) |
static void | EditTilesInternal (const Vec2i &pos, int tile, int size) |
static void | EditTiles (const Vec2i &pos, int tile, int size) |
static void | EditorActionPlaceUnit (const Vec2i &pos, const CUnitType &type, CPlayer *player) |
static void | EditorPlaceUnit (const Vec2i &pos, CUnitType &type, CPlayer *player) |
static void | EditorActionRemoveUnit (CUnit &unit) |
static void | EditorRemoveUnit (CUnit &unit) |
static int | CalculateVisibleIcons (bool tiles=false) |
static void | CalculateMaxIconSize () |
static void | RecalculateShownUnits () |
static void | DrawPlayers () |
static void | DrawUnitIcons () |
static void | DrawTileIcon (unsigned tilenum, unsigned x, unsigned y, unsigned flags) |
static void | DrawTileIcons () |
static void | DrawEditorPanel_SelectIcon () |
static void | DrawEditorPanel_UnitsIcon () |
static void | DrawEditorPanel_StartIcon () |
static void | DrawEditorPanel () |
static void | DrawMapCursor () |
static void | DrawCross (const PixelPos &topleft_pos, const PixelSize &size, Uint32 color) |
static void | DrawStartLocations () |
static void | DrawEditorInfo () |
static void | ShowUnitInfo (const CUnit &unit) |
void | EditorUpdateDisplay () |
Update editor display. More... | |
static void | EditorCallbackButtonUp (unsigned button) |
static void | EditorCallbackButtonDown (unsigned button) |
static void | EditorCallbackKeyDown (unsigned key, unsigned keychar) |
static void | EditorCallbackKeyUp (unsigned key, unsigned keychar) |
static void | EditorCallbackKeyRepeated (unsigned key, unsigned) |
static bool | EditorCallbackMouse_EditUnitArea (const PixelPos &screenPos) |
static bool | EditorCallbackMouse_EditTileArea (const PixelPos &screenPos) |
static void | EditorCallbackMouse (const PixelPos &pos) |
static void | EditorCallbackExit () |
int | EditorSaveMap (const std::string &file) |
Save a map from editor. More... | |
void | EditorMainLoop () |
Editor main event loop. More... | |
void | StartEditor (const char *filename) |
Start the editor. More... | |
#define START_ICON_X (IconWidth * 3 + 16) |
#define START_ICON_Y (2) |
#define TILE_ICON_X (IconWidth * 2 + 16) |
#define TILE_ICON_Y (2) |
#define UNIT_ICON_X (IconWidth + 7) |
#define UNIT_ICON_Y (0) |
enum _mode_buttons_ |
enum EditorActionType |
|
static |
Calculate the max height and the max width of icons, and assign them to IconHeight and IconWidth
|
static |
Calculate the number of icons that can be displayed
void CleanGame | ( | ) |
Cleanup game.
Call each module to clean up. Contrary to CleanModules, maps can be restarted without reloading all lua files.
void DoScrollArea | ( | int | state, |
bool | fast, | ||
bool | isKeyboard | ||
) |
Editor callbacks.
Handle scrolling area.
state | Scroll direction/state. |
fast | Flag scroll faster. |
Support dynamic acceleration of scroll speed.
If the scroll key is longer pressed the area is scrolled faster.
|
static |
Draw editor info.
If cursor is on map or minimap show information about the current tile.
|
static |
Draw the editor panels.
|
static |
|
static |
|
static |
void DrawGuichanWidgets | ( | ) |
|
static |
Draw special cursor on map.
|
static |
Draw a table with the players
|
static |
Draw the start locations of all active players on the map
|
static |
Draw a tile icon
tilenum | Tile number to display |
x | X display position |
y | Y display position |
flags | State of the icon (IconActive,IconClicked,...) |
|
static |
Draw tile icons.
|
static |
Draw unit icons.
|
static |
Remove a unit
|
static |
|
static |
Called if mouse button pressed down.
button | Mouse button number (0 left, 1 middle, 2 right) |
|
static |
Callback for input.
|
static |
Callback for exit.
|
static |
Handle key down.
key | Key scancode. |
keychar | Character code. |
|
static |
Callback for input.
|
static |
Handle key up.
key | Key scancode. |
keychar | Character code. |
|
static |
Callback for input movement of the cursor.
pos | Screen position. |
|
static |
|
static |
void EditorMainLoop | ( | ) |
Editor main event loop.
Editor main event loop.
Edit unit.
pos | map tile coordinate. |
type | Unit type to edit. |
player | Player owning the unit. |
|
static |
|
static |
Remove a unit
int EditorSaveMap | ( | const std::string & | file | ) |
Save a map from editor.
Save a map from editor.
file | Save the level to this file. |
|
static |
void EditorUpdateDisplay | ( | ) |
Update editor display.
Update editor display.
|
static |
Edit tile.
pos | map tile coordinate. |
tile | Tile type to edit. |
|
static |
Edit tiles
pos | map tile coordinate. |
tile | Tile type to edit. |
size | Size of rectangle |
|
static |
Edit tiles (internal, used by EditTiles()).
pos | map tile coordinate. |
tile | Tile type to edit. |
size | Size of rectangle |
|
static |
Recalculate the shown units.
|
static |
Show info about unit.
unit | Unit pointer. |
void StartEditor | ( | const char * | filename | ) |
Start the editor.
Start the editor
filename | Map to load, NULL to create a new map |
|
static |
|
static |
Icon height in panels.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
gcn::Gui* Gui |
|
static |
Icon width in panels.
|
static |
|
static |
Update units on the minimap.
|
static |
Tile tool draws with decorations.
|
static |
Tile tool draws random.
char TileToolRandom |
|
static |
Tile cursor size 1x1 2x2 ... 4x4.
|
static |
Only allow one unit per press.
|
static |
Number of icons that are visible at a time.
|
static |
Mirror editing enabled.