hoa_editor::Grid Class Reference

#include <grid.h>

Inheritance diagram for hoa_editor::Grid:

Inheritance graph
[legend]
Collaboration diagram for hoa_editor::Grid:

Collaboration graph
[legend]
List of all members.

Public Member Functions

bool GetChanged () const
 Returns the map's modified status.
QString GetFileName () const
int GetHeight () const
std::vector< int32 > & GetLayer (LAYER_TYPE layer)
const QString & GetMusic () const
 Gets the map's background music file name.
int GetWidth () const
 Grid (QWidget *parent=0, const QString &name=QString("Untitled"), int width=0, int height=0)
void LoadMap ()
 Loads a map from a config (lua) file when the user selects Open Map... from the File menu.
void SaveMap ()
 Saves the map to a config (lua) file when the user selects Save, Save as..., or Quit from the File menu.
void SetChanged (bool value)
 Sets the map's modified status;.
void SetFileName (QString filename)
void SetGridOn (bool value)
void SetHeight (int height)
void SetLLOn (bool value)
void SetMLOn (bool value)
void SetMusic (const QString &music_file)
 Sets the map's background music. Currently the map can only support one music file.
void SetULOn (bool value)
void SetWidth (int width)
 ~Grid ()

Public Attributes

QStringList tileset_names
 List of the tileset names being used.
std::vector< Tileset * > tilesets
 A vector which contains a pointer to each tileset and the tiles it has loaded via LoadMultiImage.

Protected Member Functions

void initializeGL ()
 Sets up the rendering context of the OpenGL portion of the editor.
void paintGL ()
 Paints the entire map with the Allacrost video engine.
void resizeGL (int w, int h)
 Performs a resize operation of the OpenGL widget when appropriate.

Private Attributes

bool _changed
 When TRUE the map has been modified.
QString _file_name
 The map's file name.
bool _grid_on
 When TRUE the grid between tiles is displayed.
int _height
 The height of the map in tiles.
bool _ll_on
 When TRUE the lower layer of tiles is displayed.
std::vector< int32_lower_layer
 A vector of tiles in the lower layer.
std::vector< int32_middle_layer
 A vector of tiles in the middle layer.
bool _ml_on
 When TRUE the middle layer of tiles is displayed.
QString _music_file
 Stores the background music file.
bool _ul_on
 When TRUE the upper layer of tiles is displayed.
std::vector< int32_upper_layer
 A vector of tiles in the upper layer.
int _width
 The width of the map in tiles.

Detailed Description

Definition at line 46 of file grid.h.


Constructor & Destructor Documentation

Grid::Grid ( QWidget *  parent = 0,
const QString &  name = QString("Untitled"),
int  width = 0,
int  height = 0 
)

Definition at line 34 of file grid.cpp.

References _changed, _file_name, _grid_on, _height, _ll_on, _lower_layer, _middle_layer, _ml_on, _ul_on, _upper_layer, _width, hoa_editor::TILE_HEIGHT, hoa_editor::TILE_WIDTH, and hoa_video::VideoManager.

Grid::~Grid (  ) 

Definition at line 64 of file grid.cpp.


Member Function Documentation

bool hoa_editor::Grid::GetChanged (  )  const [inline]

Returns the map's modified status.

Definition at line 56 of file grid.h.

References _changed.

Referenced by hoa_editor::Editor::_EraseOK(), and hoa_editor::Editor::_FileMenuSetup().

QString hoa_editor::Grid::GetFileName (  )  const [inline]

Definition at line 59 of file grid.h.

References _file_name.

Referenced by hoa_editor::Editor::_FileOpen(), and hoa_editor::Editor::_FileSave().

int hoa_editor::Grid::GetHeight (  )  const [inline]

Definition at line 61 of file grid.h.

References _height.

Referenced by hoa_editor::Editor::_FileOpen(), hoa_editor::EditorScrollView::contentsMouseMoveEvent(), and hoa_editor::EditorScrollView::contentsMousePressEvent().

std::vector< int32 > & Grid::GetLayer ( LAYER_TYPE  layer  ) 

Definition at line 121 of file grid.cpp.

References _lower_layer, _middle_layer, _upper_layer, hoa_editor::INVALID_LAYER, hoa_editor::LOWER_LAYER, hoa_editor::MIDDLE_LAYER, hoa_editor::TOTAL_LAYER, and hoa_editor::UPPER_LAYER.

Referenced by hoa_editor::EditorScrollView::GetCurrentLayer().

const QString & Grid::GetMusic (  )  const

Gets the map's background music file name.

Returns:
A QString of the music's file name.

Definition at line 144 of file grid.cpp.

References _music_file.

Referenced by hoa_editor::Editor::_MapSelectMusic().

int hoa_editor::Grid::GetWidth (  )  const [inline]

Definition at line 62 of file grid.h.

References _width.

Referenced by hoa_editor::Editor::_FileOpen(), hoa_editor::EditorScrollView::contentsMouseMoveEvent(), hoa_editor::EditorScrollView::contentsMousePressEvent(), and hoa_editor::EditorScrollView::contentsMouseReleaseEvent().

void Grid::initializeGL (  )  [protected]

Sets up the rendering context of the OpenGL portion of the editor.

Definition at line 466 of file grid.cpp.

References hoa_video::GameVideo::SetTarget(), hoa_video::GameVideo::SingletonInitialize(), hoa_video::GameVideo::ToggleFPS(), hoa_video::VIDEO_TARGET_QT_WIDGET, and hoa_video::VideoManager.

Here is the call graph for this function:

void Grid::LoadMap (  ) 

Loads a map from a config (lua) file when the user selects Open Map... from the File menu.

Definition at line 149 of file grid.cpp.

References _changed, _file_name, _grid_on, _height, _ll_on, _lower_layer, _middle_layer, _ml_on, _music_file, _ul_on, _upper_layer, _width, hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ReadScriptDescriptor::GetTableSize(), hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_script::ReadScriptDescriptor::OpenFile(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadInt(), hoa_script::ReadScriptDescriptor::ReadIntVector(), hoa_script::ReadScriptDescriptor::ReadString(), hoa_editor::TILE_HEIGHT, hoa_editor::TILE_WIDTH, tileset_names, and tilesets.

Referenced by hoa_editor::Editor::_FileOpen().

Here is the call graph for this function:

void Grid::paintGL (  )  [protected]

Paints the entire map with the Allacrost video engine.

Definition at line 473 of file grid.cpp.

References _grid_on, _ll_on, _lower_layer, _middle_layer, _ml_on, _ul_on, _upper_layer, _width, hoa_video::GameVideo::Clear(), hoa_video::GameVideo::DrawGrid(), hoa_video::GameVideo::DrawImage(), hoa_video::GameVideo::GetHeight(), hoa_video::GameVideo::GetWidth(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::MoveRelative(), hoa_video::GameVideo::SetCoordSys(), hoa_video::GameVideo::SetDrawFlags(), hoa_editor::TILE_HEIGHT, hoa_editor::TILE_WIDTH, tilesets, hoa_video::VIDEO_BLEND, hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_Y_TOP, and hoa_video::VideoManager.

Here is the call graph for this function:

void Grid::resizeGL ( int  w,
int  h 
) [protected]

Performs a resize operation of the OpenGL widget when appropriate.

Definition at line 563 of file grid.cpp.

References hoa_video::GameVideo::ApplySettings(), hoa_video::GameVideo::SetResolution(), and hoa_video::VideoManager.

Here is the call graph for this function:

void Grid::SaveMap (  ) 

Saves the map to a config (lua) file when the user selects Save, Save as..., or Quit from the File menu.

Definition at line 260 of file grid.cpp.

References _changed, _file_name, _height, _lower_layer, _middle_layer, _music_file, _upper_layer, _width, hoa_script::WriteScriptDescriptor::BeginTable(), hoa_script::WriteScriptDescriptor::CloseFile(), hoa_script::WriteScriptDescriptor::EndTable(), hoa_script::WriteScriptDescriptor::InsertNewLine(), hoa_script::WriteScriptDescriptor::OpenFile(), tileset_names, tilesets, hoa_script::WriteScriptDescriptor::WriteComment(), hoa_script::WriteScriptDescriptor::WriteInt(), hoa_script::WriteScriptDescriptor::WriteIntVector(), hoa_script::WriteScriptDescriptor::WriteLine(), and hoa_script::WriteScriptDescriptor::WriteString().

Referenced by hoa_editor::Editor::_FileSave().

Here is the call graph for this function:

void Grid::SetChanged ( bool  value  ) 

Sets the map's modified status;.

Definition at line 75 of file grid.cpp.

References _changed.

Referenced by hoa_editor::Editor::_MapSelectMusic(), and hoa_editor::EditorScrollView::contentsMousePressEvent().

void Grid::SetFileName ( QString  filename  ) 

Definition at line 80 of file grid.cpp.

References _file_name.

Referenced by hoa_editor::Editor::_FileOpen(), and hoa_editor::Editor::_FileSaveAs().

void Grid::SetGridOn ( bool  value  ) 

Definition at line 115 of file grid.cpp.

References _grid_on.

Referenced by hoa_editor::Editor::_ViewToggleGrid().

void Grid::SetHeight ( int  height  ) 

Definition at line 85 of file grid.cpp.

References _changed, and _height.

Referenced by hoa_editor::Editor::_FileResize(), and hoa_editor::EditorScrollView::Resize().

void Grid::SetLLOn ( bool  value  ) 

Definition at line 97 of file grid.cpp.

References _ll_on.

Referenced by hoa_editor::Editor::_ViewToggleLL().

void Grid::SetMLOn ( bool  value  ) 

Definition at line 103 of file grid.cpp.

References _ml_on.

Referenced by hoa_editor::Editor::_ViewToggleML().

void Grid::SetMusic ( const QString &  music_file  ) 

Sets the map's background music. Currently the map can only support one music file.

Parameters:
music_file The file name of the music file that will be used.

Definition at line 139 of file grid.cpp.

References _music_file.

Referenced by hoa_editor::Editor::_MapSelectMusic().

void Grid::SetULOn ( bool  value  ) 

Definition at line 109 of file grid.cpp.

References _ul_on.

Referenced by hoa_editor::Editor::_ViewToggleUL().

void Grid::SetWidth ( int  width  ) 

Definition at line 91 of file grid.cpp.

References _changed, and _width.

Referenced by hoa_editor::Editor::_FileResize(), and hoa_editor::EditorScrollView::Resize().


Member Data Documentation

bool hoa_editor::Grid::_changed [private]

When TRUE the map has been modified.

Definition at line 119 of file grid.h.

Referenced by GetChanged(), Grid(), LoadMap(), SaveMap(), SetChanged(), SetHeight(), and SetWidth().

QString hoa_editor::Grid::_file_name [private]

The map's file name.

Definition at line 112 of file grid.h.

Referenced by GetFileName(), Grid(), LoadMap(), SaveMap(), and SetFileName().

bool hoa_editor::Grid::_grid_on [private]

When TRUE the grid between tiles is displayed.

Definition at line 121 of file grid.h.

Referenced by Grid(), LoadMap(), paintGL(), and SetGridOn().

int hoa_editor::Grid::_height [private]

The height of the map in tiles.

Definition at line 114 of file grid.h.

Referenced by GetHeight(), Grid(), LoadMap(), SaveMap(), and SetHeight().

bool hoa_editor::Grid::_ll_on [private]

When TRUE the lower layer of tiles is displayed.

Definition at line 123 of file grid.h.

Referenced by Grid(), LoadMap(), paintGL(), and SetLLOn().

std::vector<int32> hoa_editor::Grid::_lower_layer [private]

A vector of tiles in the lower layer.

Definition at line 130 of file grid.h.

Referenced by GetLayer(), Grid(), LoadMap(), paintGL(), and SaveMap().

std::vector<int32> hoa_editor::Grid::_middle_layer [private]

A vector of tiles in the middle layer.

Definition at line 132 of file grid.h.

Referenced by GetLayer(), Grid(), LoadMap(), paintGL(), and SaveMap().

bool hoa_editor::Grid::_ml_on [private]

When TRUE the middle layer of tiles is displayed.

Definition at line 125 of file grid.h.

Referenced by Grid(), LoadMap(), paintGL(), and SetMLOn().

QString hoa_editor::Grid::_music_file [private]

Stores the background music file.

Definition at line 137 of file grid.h.

Referenced by GetMusic(), LoadMap(), SaveMap(), and SetMusic().

bool hoa_editor::Grid::_ul_on [private]

When TRUE the upper layer of tiles is displayed.

Definition at line 127 of file grid.h.

Referenced by Grid(), LoadMap(), paintGL(), and SetULOn().

std::vector<int32> hoa_editor::Grid::_upper_layer [private]

A vector of tiles in the upper layer.

Definition at line 134 of file grid.h.

Referenced by GetLayer(), Grid(), LoadMap(), paintGL(), and SaveMap().

int hoa_editor::Grid::_width [private]

The width of the map in tiles.

Definition at line 116 of file grid.h.

Referenced by GetWidth(), Grid(), LoadMap(), paintGL(), SaveMap(), and SetWidth().

QStringList hoa_editor::Grid::tileset_names

List of the tileset names being used.

Definition at line 96 of file grid.h.

Referenced by hoa_editor::Editor::_FileOpen(), hoa_editor::Editor::_FileResize(), hoa_editor::Editor::_TileLayerFill(), hoa_editor::EditorScrollView::contentsMouseMoveEvent(), hoa_editor::EditorScrollView::contentsMousePressEvent(), LoadMap(), and SaveMap().

std::vector<Tileset*> hoa_editor::Grid::tilesets

A vector which contains a pointer to each tileset and the tiles it has loaded via LoadMultiImage.

Definition at line 98 of file grid.h.

Referenced by hoa_editor::Editor::_FileNew(), hoa_editor::Editor::_FileOpen(), hoa_editor::Editor::_FileResize(), hoa_editor::EditorScrollView::contentsMouseMoveEvent(), hoa_editor::EditorScrollView::contentsMousePressEvent(), LoadMap(), paintGL(), and SaveMap().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:13:53 2007 for Hero of Allacrost by  doxygen 1.5.1