anonl / nvlist
Showing 13 of 38 files from the diff.
Other files ignored by Codecov

@@ -73,12 +73,12 @@
Loading
73 73
            shader = shaderStore.get().createShaderFromClasspath(getClass(), findBestShader(scaledRadius));
74 74
75 75
            // Horizontal
76 -
            shader.begin();
76 +
            shader.bind();
77 77
            shader.setUniformf("radius", (float)(scaledRadius * pixelSize.x), 0);
78 78
            context.draw(fbos.nextBlank(), shader);
79 79
80 80
            // Vertical
81 -
            shader.begin();
81 +
            shader.bind();
82 82
            shader.setUniformf("radius", 0, (float)(scaledRadius * pixelSize.y));
83 83
            context.draw(fbos.nextBlank(), shader);
84 84

@@ -94,16 +94,18 @@
Loading
94 94
     */
95 95
    public static class PointerScrollEvent extends Event {
96 96
97 -
        public final int scrollAmount;
97 +
        public final float scrollX;
98 +
        public final float scrollY;
98 99
99 100
        /**
100 -
         * @param scrollAmount The number of clicks scrolled by the scroll wheel. Positive values indicate a
101 -
         *        downward scroll, negative values an upward scroll.
101 +
         * The scroll amount is the number of clicks scrolled by the scroll wheel. Positive values indicate a
102 +
         * down/right scroll, negative values an up/left scroll.
102 103
         */
103 -
        public PointerScrollEvent(long timestampMs, int scrollAmount) {
104 +
        public PointerScrollEvent(long timestampMs, float scrollX, float scrollY) {
104 105
            super(timestampMs);
105 106
106 -
            this.scrollAmount = scrollAmount;
107 +
            this.scrollX = scrollX;
108 +
            this.scrollY = scrollY;
107 109
        }
108 110
109 111
    }

@@ -152,6 +152,33 @@
Loading
152 152
    W,
153 153
    X,
154 154
    Y,
155 -
    Z;
155 +
    Z,
156 +
    CAPS_LOCK,
157 +
    F13,
158 +
    F14,
159 +
    F15,
160 +
    F16,
161 +
    F17,
162 +
    F18,
163 +
    F19,
164 +
    F20,
165 +
    F21,
166 +
    F22,
167 +
    F23,
168 +
    F24,
169 +
    NUM_LOCK,
170 +
    NUMPAD_ADD,
171 +
    NUMPAD_COMMA,
172 +
    NUMPAD_DIVIDE,
173 +
    NUMPAD_DOT,
174 +
    NUMPAD_ENTER,
175 +
    NUMPAD_EQUALS,
176 +
    NUMPAD_LEFT_PAREN,
177 +
    NUMPAD_RIGHT_PAREN,
178 +
    NUMPAD_MULTIPLY,
179 +
    NUMPAD_SUBTRACT,
180 +
    PAUSE,
181 +
    PRINT_SCREEN,
182 +
    SCROLL_LOCK;
156 183
157 184
}

@@ -9,6 +9,7 @@
Loading
9 9
import org.slf4j.Logger;
10 10
import org.slf4j.LoggerFactory;
11 11
12 +
import com.badlogic.gdx.Gdx;
12 13
import com.badlogic.gdx.utils.Array;
13 14
import com.badlogic.gdx.utils.Disposable;
14 15
import com.google.common.collect.Iterables;
@@ -72,17 +73,35 @@
Loading
72 73
            // Clean garbage
73 74
            Reference<?> rawReference;
74 75
            while ((rawReference = garbage.poll()) != null) {
75 -
                Cleanable cleanable = (Cleanable)rawReference;
76 -
                LOG.debug("Disposing resource: {}", cleanable);
77 -
                try {
78 -
                    cleanable.cleanup.dispose();
79 -
                } catch (RuntimeException e) {
80 -
                    LOG.error("Cleanup task threw an exception: {}", cleanable.cleanup, e);
76 +
                CleanupRunnable cleanupRunnable = new CleanupRunnable((Cleanable)rawReference);
77 +
                if (Gdx.app != null) {
78 +
                    Gdx.app.postRunnable(cleanupRunnable);
79 +
                } else {
80 +
                    cleanupRunnable.run();
81 81
                }
82 82
            }
83 83
        }
84 84
    }
85 85
86 +
    private static final class CleanupRunnable implements Runnable {
87 +
88 +
        private final Cleanable cleanable;
89 +
90 +
        CleanupRunnable(Cleanable cleanable) {
91 +
            this.cleanable = cleanable;
92 +
        }
93 +
94 +
        @Override
95 +
        public void run() {
96 +
            LOG.debug("Disposing resource: " + cleanable);
97 +
            try {
98 +
                cleanable.cleanup.dispose();
99 +
            } catch (RuntimeException e) {
100 +
                LOG.error("Cleanup task threw an exception: " + cleanable.cleanup, e);
101 +
            }
102 +
        }
103 +
    }
104 +
86 105
    private static final class Cleanable extends WeakReference<Object> {
87 106
88 107
        private final Disposable cleanup;

@@ -50,7 +50,7 @@
Loading
50 50
51 51
            shader = shaderStore.get().createShaderFromClasspath(getClass(), "colormatrix");
52 52
53 -
            shader.begin();
53 +
            shader.bind();
54 54
            shader.setUniformMatrix4fv("u_matrix", matrix.getGLMatrix(), 0, 16);
55 55
            shader.setUniform4fv("u_offset", matrix.getGLOffset(), 0, 4);
56 56
            context.drawInitial(texRegion, shader);

@@ -26,6 +26,7 @@
Loading
26 26
     *         {@link Pixmap#dispose()} on the pixmap when it's no longer needed.
27 27
     */
28 28
    public static Pixmap screenshot(Rect glRect) {
29 +
        //Pixmap pixmap = Pixmap.createFromFrameBuffer(glRect.x, glRect.y, glRect.w, glRect.h);
29 30
        Pixmap pixmap = ScreenUtils.getFrameBufferPixmap(glRect.x, glRect.y, glRect.w, glRect.h);
30 31
        NativeMemoryTracker.get().register(pixmap);
31 32
        PixmapUtil.flipVertical(pixmap);

@@ -53,7 +53,8 @@
Loading
53 53
54 54
        // Mouse scroll wheel handling
55 55
        if (containsPointer) {
56 -
            scroll(0, scrollWheelAccel * input.getPointerScroll());
56 +
            Vec2 scroll = input.getPointerScrollXY();
57 +
            scroll(scrollWheelAccel * scroll.x, scrollWheelAccel * scroll.y);
57 58
        }
58 59
59 60
        // Mouse/touch draw handling

@@ -301,7 +301,7 @@
Loading
301 301
        int g = (argb >> 8) & 0xFF;
302 302
        int b = argb & 0xFF;
303 303
304 -
        spriteBatch.setColor(Color.toFloatBits(r, g, b, a));
304 +
        spriteBatch.setPackedColor(Color.toFloatBits(r, g, b, a));
305 305
    }
306 306
307 307
    @Override

@@ -1,6 +1,6 @@
Loading
1 1
package nl.weeaboo.vn.gdx.scene2d;
2 2
3 -
import com.badlogic.gdx.scenes.scene2d.ui.TextField;
3 +
import com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldClickListener;
4 4
5 5
/**
6 6
 * Various functions related to GDX scene2d.
@@ -11,8 +11,7 @@
Loading
11 11
    }
12 12
13 13
    /**
14 -
     * @see TextField#ENTER_ANDROID
15 -
     * @see TextField#ENTER_DESKTOP
14 +
     * @see TextFieldClickListener#keyTyped
16 15
     */
17 16
    public static boolean isEnterChar(char c) {
18 17
        return c == '\r' || c == '\n';

@@ -1,6 +1,7 @@
Loading
1 1
package nl.weeaboo.vn.buildtools.gdx;
2 2
3 3
import com.badlogic.gdx.Gdx;
4 +
import com.badlogic.gdx.backends.headless.HeadlessApplicationConfiguration;
4 5
import com.badlogic.gdx.backends.headless.HeadlessFiles;
5 6
import com.badlogic.gdx.backends.headless.HeadlessNativesLoader;
6 7
import com.badlogic.gdx.backends.headless.HeadlessNet;
@@ -25,7 +26,7 @@
Loading
25 26
        HeadlessNativesLoader.load();
26 27
        Gdx.app = null;
27 28
        Gdx.files = new HeadlessFiles();
28 -
        Gdx.net = new HeadlessNet();
29 +
        Gdx.net = new HeadlessNet(new HeadlessApplicationConfiguration());
29 30
        Gdx.graphics = new MockGraphics();
30 31
        Gdx.gl20 = null;
31 32
        Gdx.gl = Gdx.gl20;

@@ -26,7 +26,7 @@
Loading
26 26
27 27
    private final EnumMap<KeyCode, ButtonState> buttonStates = Maps.newEnumMap(KeyCode.class);
28 28
    private final Vec2 pointerPos = new Vec2();
29 -
    private int pointerScroll;
29 +
    private final Vec2 pointerScroll = new Vec2();
30 30
    private boolean idle;
31 31
32 32
    private long timestampMs;
@@ -47,7 +47,8 @@
Loading
47 47
        this.idle = events.isEmpty();
48 48
49 49
        // Clear outdated state from last update
50 -
        pointerScroll = 0;
50 +
        pointerScroll.x = 0;
51 +
        pointerScroll.y = 0;
51 52
        for (ButtonState state : buttonStates.values()) {
52 53
            state.clearJustPressed();
53 54
        }
@@ -78,7 +79,8 @@
Loading
78 79
            } else if (raw instanceof PointerScrollEvent) {
79 80
                PointerScrollEvent event = (PointerScrollEvent)raw;
80 81
81 -
                pointerScroll += event.scrollAmount;
82 +
                pointerScroll.x += event.scrollX;
83 +
                pointerScroll.y += event.scrollY;
82 84
            } else {
83 85
                LOG.warn("Unknown event type: {}", raw.getClass());
84 86
            }
@@ -139,7 +141,12 @@
Loading
139 141
140 142
    @Override
141 143
    public int getPointerScroll() {
142 -
        return pointerScroll;
144 +
        return (int)Math.round(pointerScroll.y);
145 +
    }
146 +
147 +
    @Override
148 +
    public Vec2 getPointerScrollXY() {
149 +
        return new Vec2(pointerScroll);
143 150
    }
144 151
145 152
    @Override

@@ -93,8 +93,8 @@
Loading
93 93
    }
94 94
95 95
    @Override
96 -
    public boolean scrolled(int amount) {
97 -
        addMouseScrollEvent(amount);
96 +
    public boolean scrolled(float amountX, float amountY) {
97 +
        addMouseScrollEvent(amountX, amountY);
98 98
        return true;
99 99
    }
100 100
@@ -121,9 +121,9 @@
Loading
121 121
        accum.addEvent(new PointerPositionEvent(timestampMs(), worldCoords.x, worldCoords.y));
122 122
    }
123 123
124 -
    private void addMouseScrollEvent(int scrollAmount) {
125 -
        LOG.trace("Mouse scroll event: {}", scrollAmount);
126 -
        accum.addEvent(new PointerScrollEvent(timestampMs(), scrollAmount));
124 +
    private void addMouseScrollEvent(float amountX, float amountY) {
125 +
        LOG.trace("Mouse scroll event: {}/{}", amountX, amountY);
126 +
        accum.addEvent(new PointerScrollEvent(timestampMs(), amountX, amountY));
127 127
    }
128 128
129 129
    @VisibleForTesting
@@ -150,6 +150,7 @@
Loading
150 150
        case Keys.C: return KeyCode.C;
151 151
        case Keys.CALL: return KeyCode.CALL;
152 152
        case Keys.CAMERA: return KeyCode.CAMERA;
153 +
        case Keys.CAPS_LOCK: return KeyCode.CAPS_LOCK;
153 154
        case Keys.CLEAR: return KeyCode.CLEAR;
154 155
        case Keys.COMMA: return KeyCode.COMMA;
155 156
        case Keys.D: return KeyCode.D;
@@ -191,17 +192,21 @@
Loading
191 192
        case Keys.N: return KeyCode.N;
192 193
        case Keys.NOTIFICATION: return KeyCode.NOTIFICATION;
193 194
        case Keys.NUM: return KeyCode.NUM;
195 +
        case Keys.NUM_LOCK: return KeyCode.NUM_LOCK;
194 196
        case Keys.O: return KeyCode.O;
195 197
        case Keys.P: return KeyCode.P;
198 +
        case Keys.PAUSE: return KeyCode.PAUSE;
196 199
        case Keys.PERIOD: return KeyCode.PERIOD;
197 200
        case Keys.PLUS: return KeyCode.PLUS;
198 201
        case Keys.POUND: return KeyCode.POUND;
199 202
        case Keys.POWER: return KeyCode.POWER;
203 +
        case Keys.PRINT_SCREEN: return KeyCode.PRINT_SCREEN;
200 204
        case Keys.Q: return KeyCode.Q;
201 205
        case Keys.R: return KeyCode.R;
202 206
        case Keys.RIGHT_BRACKET: return KeyCode.RIGHT_BRACKET;
203 207
        case Keys.S: return KeyCode.S;
204 208
        case Keys.SEARCH: return KeyCode.SEARCH;
209 +
        case Keys.SCROLL_LOCK: return KeyCode.SCROLL_LOCK;
205 210
        case Keys.SEMICOLON: return KeyCode.SEMICOLON;
206 211
        case Keys.SHIFT_LEFT: return KeyCode.SHIFT_LEFT;
207 212
        case Keys.SHIFT_RIGHT: return KeyCode.SHIFT_RIGHT;
@@ -256,6 +261,16 @@
Loading
256 261
        case Keys.NUMPAD_7: return KeyCode.NUMPAD_7;
257 262
        case Keys.NUMPAD_8: return KeyCode.NUMPAD_8;
258 263
        case Keys.NUMPAD_9: return KeyCode.NUMPAD_9;
264 +
        case Keys.NUMPAD_ADD: return KeyCode.NUMPAD_ADD;
265 +
        case Keys.NUMPAD_COMMA: return KeyCode.NUMPAD_COMMA;
266 +
        case Keys.NUMPAD_DIVIDE: return KeyCode.NUMPAD_DIVIDE;
267 +
        case Keys.NUMPAD_DOT: return KeyCode.NUMPAD_DOT;
268 +
        case Keys.NUMPAD_ENTER: return KeyCode.NUMPAD_ENTER;
269 +
        case Keys.NUMPAD_EQUALS: return KeyCode.NUMPAD_EQUALS;
270 +
        case Keys.NUMPAD_LEFT_PAREN: return KeyCode.NUMPAD_LEFT_PAREN;
271 +
        case Keys.NUMPAD_RIGHT_PAREN: return KeyCode.NUMPAD_RIGHT_PAREN;
272 +
        case Keys.NUMPAD_MULTIPLY: return KeyCode.NUMPAD_MULTIPLY;
273 +
        case Keys.NUMPAD_SUBTRACT: return KeyCode.NUMPAD_SUBTRACT;
259 274
        case Keys.COLON: return KeyCode.COLON;
260 275
        case Keys.F1: return KeyCode.F1;
261 276
        case Keys.F2: return KeyCode.F2;
@@ -269,6 +284,18 @@
Loading
269 284
        case Keys.F10: return KeyCode.F10;
270 285
        case Keys.F11: return KeyCode.F11;
271 286
        case Keys.F12: return KeyCode.F12;
287 +
        case Keys.F13: return KeyCode.F13;
288 +
        case Keys.F14: return KeyCode.F14;
289 +
        case Keys.F15: return KeyCode.F15;
290 +
        case Keys.F16: return KeyCode.F16;
291 +
        case Keys.F17: return KeyCode.F17;
292 +
        case Keys.F18: return KeyCode.F18;
293 +
        case Keys.F19: return KeyCode.F19;
294 +
        case Keys.F20: return KeyCode.F20;
295 +
        case Keys.F21: return KeyCode.F21;
296 +
        case Keys.F22: return KeyCode.F22;
297 +
        case Keys.F23: return KeyCode.F23;
298 +
        case Keys.F24: return KeyCode.F24;
272 299
        default:
273 300
            LOG.warn("Unmapped keyboard button: {}", keycode);
274 301
            return KeyCode.UNKNOWN;

@@ -124,11 +124,17 @@
Loading
124 124
        return delegate.getPointerPos(transform);
125 125
    }
126 126
127 +
    @SuppressWarnings("deprecation") // Delegates to deprecated method
127 128
    @Override
128 129
    public int getPointerScroll() {
129 130
        return delegate.getPointerScroll();
130 131
    }
131 132
133 +
    @Override
134 +
    public Vec2 getPointerScrollXY() {
135 +
        return delegate.getPointerScrollXY();
136 +
    }
137 +
132 138
    @Override
133 139
    public boolean isIdle() {
134 140
        return delegate.isIdle();
Files Complexity Coverage
api/src/main/java/nl/weeaboo/vn 91.53% 96.76%
buildtools/src/main/java/nl/weeaboo/vn/buildtools 63.39% 70.06%
core/src/main/java/nl/weeaboo/vn 81.35% 85.26%
Project Totals (368 files) 81.11% 85.13%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading