Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/windowing/StarGuiTypes.hpp
blob: 9a8618065f73a8f5f1397388b3212c01f8757d7b (plain)
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
#pragma once

#include "StarString.hpp"
#include "StarVector.hpp"
#include "StarBiMap.hpp"
#include "StarGameTypes.hpp"

namespace Star {

struct ImageStretchSet {
  // how does inner fill up space?
  enum class ImageStretchType {
    Stretch,
    Repeat
  };

  String begin;
  String inner;
  String end;
  ImageStretchType type;

  bool fullyPopulated() const;
};

enum class GuiDirection {
  Horizontal,
  Vertical
};
extern EnumMap<GuiDirection> const GuiDirectionNames;

GuiDirection otherDirection(GuiDirection direction);

template <typename T>
T directionalValueFromVector(GuiDirection direction, Vector<T, 2> const& vec);

String rarityBorder(Rarity rarity);

template <typename T>
T& directionalValueFromVector(GuiDirection direction, Vector<T, 2> const& vec) {
  switch (direction) {
    case GuiDirection::Horizontal:
      return vec[0];
    case GuiDirection::Vertical:
      return vec[1];
  }
}

}