예제 #1
0
        void updateInput()
        {
            Actor *actor = game_->findActor("wizard");
            if (actor) {
                PropertyComponent *component = actor->getPropertyComponent();
                if (component) {
                    bool *upInput = component->findBool("up-input");
                    bool *leftInput = component->findBool("left-input");
                    bool *downInput = component->findBool("down-input");
                    bool *rightInput = component->findBool("right-input");
                    bool *jumpInput = component->findBool("jump-input");

                    Uint8 *state = SDL_GetKeyboardState(0);
                    if (upInput) {
                        *upInput = bool(state[SDL_SCANCODE_W]) | bool(state[SDL_SCANCODE_UP]);
                    }
                    if (leftInput) {
                        *leftInput = bool(state[SDL_SCANCODE_A]) | bool(state[SDL_SCANCODE_LEFT]);
                    }
                    if (downInput) {
                        *downInput = bool(state[SDL_SCANCODE_S]) | bool(state[SDL_SCANCODE_DOWN]);
                    }
                    if (rightInput) {
                        *rightInput = bool(state[SDL_SCANCODE_D]) | bool(state[SDL_SCANCODE_RIGHT]);
                    }
                    if (jumpInput) {
                        *jumpInput = bool(state[SDL_SCANCODE_SPACE]);
                    }
                }
            }
        }
예제 #2
0
Rectangle<int> IntrojucerLookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component)
{
    if (component.findParentComponentOfClass<AppearanceEditor::EditorPanel>() != nullptr)
        return component.getLocalBounds().reduced (1).removeFromRight (component.getWidth() / 2);

    return LookAndFeel::getPropertyComponentContentPosition (component);
}
예제 #3
0
void ProjucerLookAndFeel::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component)
{
    ignoreUnused (width);

    g.setColour (component.findColour (defaultTextColourId)
                          .withMultipliedAlpha (component.isEnabled() ? 1.0f : 0.6f));

    auto textWidth = getTextWidthForPropertyComponent (&component);

    g.setFont (getPropertyComponentFont());
    g.drawFittedText (component.getName(), 0, 0, textWidth - 5, height, Justification::centredLeft, 5, 1.0f);
}
예제 #4
0
void pMixLookAndFeel::drawPropertyComponentLabel (Graphics& g, int width, int height, PropertyComponent& component)
{
  g.setColour (Colours::black);
  
  if (! component.isEnabled())
    g.setOpacity (0.6f);
  
  g.setFont (jmin (height, 24) * 0.65f);
  
  const Rectangle<int> r (getPropertyComponentContentPosition (component));
  
  g.drawText (component.getName(),
              3, r.getY(), r.getX() - 5, r.getHeight(),
              Justification::centredLeft, 2);
}
예제 #5
0
Rectangle<int> ProjucerLookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component)
{
    const auto textW = getTextWidthForPropertyComponent (&component);
    return { textW, 0, component.getWidth() - textW, component.getHeight() - 1 };
}
예제 #6
0
//=======================   PropertyComponent  =========================================
Rectangle<int> CabbageIDELookAndFeel::getPropertyComponentContentPosition (PropertyComponent& component)
{
    const int textW = jmin (250, component.getWidth() / 2);
    return Rectangle<int> (textW, 1, component.getWidth() - textW - 1, component.getHeight() - 3);
}