~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to UI/DisplayLayoutEditor.cpp

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2012- PPSSPP Project.
 
2
 
 
3
// This program is free software: you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation, version 2.0 or later versions.
 
6
 
 
7
// This program is distributed in the hope that it will be useful,
 
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
// GNU General Public License 2.0 for more details.
 
11
 
 
12
// A copy of the GPL 2.0 should have been included with the program.
 
13
// If not, see http://www.gnu.org/licenses/
 
14
 
 
15
// Official git repository and contact information can be found at
 
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
 
17
 
 
18
#include <algorithm>
 
19
#include "ui/ui_context.h"
 
20
#include "ui_atlas.h"
 
21
#include "UI/DisplayLayoutEditor.h"
 
22
 
 
23
void MultiTouchDisplay::GetContentDimensions(const UIContext &dc, float &w, float &h) const {
 
24
        const AtlasImage &image = dc.Draw()->GetAtlas()->images[img_];
 
25
        w = image.w * scale_;
 
26
        h = image.h * scale_;
 
27
}
 
28
 
 
29
void MultiTouchDisplay::Touch(const TouchInput &input) {
 
30
        if ((input.flags & TOUCH_DOWN) && bounds_.Contains(input.x, input.y)) {
 
31
                pointerDownMask_ |= 1 << input.id;
 
32
        }
 
33
        if (input.flags & TOUCH_MOVE) {
 
34
                if (bounds_.Contains(input.x, input.y))
 
35
                        pointerDownMask_ |= 1 << input.id;
 
36
                else
 
37
                        pointerDownMask_ &= ~(1 << input.id);
 
38
        }
 
39
        if (input.flags & TOUCH_UP) {
 
40
                pointerDownMask_ &= ~(1 << input.id);
 
41
        }
 
42
        if (input.flags & TOUCH_RELEASE_ALL) {
 
43
                pointerDownMask_ = 0;
 
44
        }
 
45
}
 
46
 
 
47
 
 
48
void MultiTouchDisplay::Draw(UIContext &dc) {
 
49
        float opacity = 0.5f;
 
50
        float scale = scale_;
 
51
        uint32_t color = colorAlpha(0xFFFFFF, opacity);
 
52
        dc.Draw()->DrawImageRotated(img_, bounds_.centerX(), bounds_.centerY(), scale, angle_ * (M_PI * 2 / 360.0f), color, flipImageH_);
 
53
}