summary refs log tree commit diff stats
path: root/tools/mapedit/src/frame.cpp
blob: 858620eb828bb4909ab1d30b0958da5f9759bcc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "frame.h"
#include "widget.h"
#include "tile_widget.h"

wxBEGIN_EVENT_TABLE(MapeditFrame, wxFrame)
  EVT_MENU(wxID_EXIT, MapeditFrame::OnExit)
wxEND_EVENT_TABLE()

MapeditFrame::MapeditFrame(Map map) : wxFrame(NULL, wxID_ANY, "Map Editor", wxPoint(50, 50), wxSize(GAME_WIDTH*3, GAME_HEIGHT*2)), map(map)
{
  wxMenu* menuFile = new wxMenu;
  menuFile->Append(wxID_EXIT);

  wxMenuBar* menuBar = new wxMenuBar;
  menuBar->Append(menuFile, "&File");
  
  SetMenuBar(menuBar);
  
  wxPanel* panel = new wxPanel(this, wxID_ANY);
  int clientWidth, clientHeight;
  GetClientSize(&clientWidth, &clientHeight);
  
  TileWidget* tileEdit = new TileWidget(panel, wxID_ANY, 6, wxPoint(0,0), wxSize(TILE_WIDTH*3*6, clientHeight));
  MapeditWidget* wid = new MapeditWidget(panel, wxID_ANY, &this->map, tileEdit, wxPoint(TILE_WIDTH*3*6+8,0), wxSize(GAME_WIDTH*1.5, GAME_HEIGHT*1.5));
}

void MapeditFrame::OnExit(wxCommandEvent& event)
{
  Close(true);
}