about summary refs log tree commit diff stats
path: root/data/maps/daedalus/rooms/Computer Room.txtpb
blob: 1d5a56dc2c2e11593931da12c94c2d4311288c1e (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: "Computer Room"
panel_display_name: "Computer Room"
panels {
  name: "MONITOR (1)"
  path: "Panels/Computer/computer_1"
  clue: "monitor"
  answer: "television"
  symbols: AGE
}
panels {
  name: "MICROPHONE"
  path: "Panels/Computer/computer_2"
  clue: "microphone"
  answer: "headset"
  symbols: BOXES
}
panels {
  name: "SPEAKER"
  path: "Panels/Computer/computer_3"
  clue: "speaker"
  answer: "headset"
  symbols: BOXES
}
panels {
  name: "PROCESSOR (1)"
  path: "Panels/Computer/computer_4"
  clue: "processor"
  answer: "circuit"
  symbols: AGE
}
panels {
  name: "MOUSE (1)"
  path: "Panels/Computer/computer_5"
  clue: "mouse"
  answer: "joystick"
  symbols: EXAMPLE
}
panels {
  name: "KEYBOARD (1)"
  path: "Panels/Computer/computer_6"
  clue: "keyboard"
  answer: "typewriter"
  symbols: AGE
}
panels {
  name: "MONITOR (2)"
  path: "Panels/Computer/computer_7"
  clue: "monitor"
  answer: "computer"
  symbols: BOXES
}
panels {
  name: "PROCESSOR (2)"
  path: "Panels/Computer/computer_8"
  clue: "processor"
  answer: "computer"
  symbols: BOXES
}
panels {
  name: "MOUSE (2)"
  path: "Panels/Computer/computer_9"
  clue: "mouse"
  answer: "computer"
  symbols: BOXES
}
panels {
  name: "KEYBOARD (2)"
  path: "Panels/Computer/computer_10"
  clue: "keyboard"
  answer: "computer"
  symbols: BOXES
}
d'>3e98951 ^
3e98951 ^

8702c11 ^
3e98951 ^


8702c11 ^



3e98951 ^





8702c11 ^

213cab3 ^



8702c11 ^
3e98951 ^

8702c11 ^

3e98951 ^





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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
                        
                   
 
                                                    
 
                                               








                                      
                                                                                                                        
                                                                                  










                             
                                             




                                                                                                     

 
                                       



                               
  

                             



                                     

                           
 

                                
                                                                                                                                                                                                        


                      



                                                                                                                                           





                                             

                         



                                     
                           

                                    

                                               





                               
#include "tile_widget.h"
#include "consts.h"

IMPLEMENT_DYNAMIC_CLASS(TileWidget,wxScrolledCanvas)

BEGIN_EVENT_TABLE(TileWidget, wxScrolledCanvas)
	EVT_PAINT(TileWidget::OnPaint)
  EVT_LEFT_DOWN(TileWidget::OnClick)
END_EVENT_TABLE()

TileWidget::TileWidget()
{
  Init();
}

TileWidget::TileWidget(wxWindow* parent, wxWindowID winid, int width, int scale, const wxPoint& pos, const wxSize& size)
  : wxScrolledCanvas(parent, winid, pos, size), numTilesWidth(width), scale(scale)
{
  Init();
}

int TileWidget::getSelected()
{
  return selected;
}

void TileWidget::Init()
{
  tiles = wxBitmap(wxImage("res/tiles.png"));
  
  this->FitInside();
  this->SetScrollRate(5, 5);
  
  SetVirtualSize(numTilesWidth*TILE_WIDTH*scale, (numTiles / numTilesWidth + 1) * TILE_HEIGHT*scale);
}

void TileWidget::OnPaint(wxPaintEvent&)
{
  wxPaintDC dc(this);
  wxMemoryDC tiles_dc;
  tiles_dc.SelectObject(tiles);
  
  int vX, vY, vW, vH, aW, aH;
  GetViewStart(&vX, &vY);
  int vXX, vYX;
  GetScrollPixelsPerUnit(&vXX, &vYX);
  vX *= vXX;
  vY *= vYX;
  GetVirtualSize(&vW, &vH);
  GetSize(&aW, &aH);

  for (int i=0; i<numTiles; i++)
  {
    dc.StretchBlit(i%numTilesWidth*TILE_WIDTH*scale-vX, i/numTilesWidth*TILE_HEIGHT*scale-vY, TILE_WIDTH*scale, TILE_HEIGHT*scale, &tiles_dc, i%8*TILE_WIDTH, i/8*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT);
    
    if (i == selected)
    {
      wxPen pen(*wxGREEN, 2);
      dc.SetPen(pen);
      dc.SetBrush(*wxTRANSPARENT_BRUSH);
      dc.DrawRectangle(i%numTilesWidth*TILE_WIDTH*scale - vX, i/numTilesWidth*TILE_HEIGHT*scale - vY, TILE_WIDTH*scale, TILE_HEIGHT*scale);
    }
  }
}

void TileWidget::OnClick(wxMouseEvent& event)
{
  int vX, vY, vW, vH;
  GetViewStart(&vX, &vY);
  int vXX, vYX;
  GetScrollPixelsPerUnit(&vXX, &vYX);
  vX *= vXX;
  vY *= vYX;
  GetVirtualSize(&vW, &vH);
  
  wxPoint pos = event.GetPosition();
  int x = (pos.x + vX) / (TILE_WIDTH * scale);
  int y = (pos.y + vY) / (TILE_HEIGHT * scale);
  
  selected = x+y*numTilesWidth;
  
  Refresh();
  event.Skip();
}