Mercurial > games > semicongine
comparison examples/E04_input.nim @ 530:cfa230e1f3b9
fix: mouse coord, colors
author | Sam <sam@basx.dev> |
---|---|
date | Sun, 05 Feb 2023 00:46:40 +0700 |
parents | 3ec1be39e1ad |
children | 5d457f7bb624 |
comparison
equal
deleted
inserted
replaced
529:eb92723db7b2 | 530:cfa230e1f3b9 |
---|---|
22 Vec3([1'f32, -1'f32, 0'f32]), | 22 Vec3([1'f32, -1'f32, 0'f32]), |
23 Vec3([-0.3'f32, -0.3'f32, 0'f32]), | 23 Vec3([-0.3'f32, -0.3'f32, 0'f32]), |
24 Vec3([-0.3'f32, -0.3'f32, 0'f32]), | 24 Vec3([-0.3'f32, -0.3'f32, 0'f32]), |
25 Vec3([-1'f32, 1'f32, 0'f32]), | 25 Vec3([-1'f32, 1'f32, 0'f32]), |
26 Vec3([-1'f32, -1'f32, 0'f32]), | 26 Vec3([-1'f32, -1'f32, 0'f32]), |
27 ] | |
28 arrow_colors = @[ | |
29 Vec4([1'f32, 0'f32, 0'f32, 1'f32]), | |
30 Vec4([1'f32, 0'f32, 0'f32, 1'f32]), | |
31 Vec4([1'f32, 0'f32, 0'f32, 1'f32]), | |
32 Vec4([0.8'f32, 0'f32, 0'f32, 1'f32]), | |
33 Vec4([0.8'f32, 0'f32, 0'f32, 1'f32]), | |
34 Vec4([0.8'f32, 0'f32, 0'f32, 1'f32]), | |
35 ] | 27 ] |
36 # keyboard layout, specifying rows with key widths, negative numbers are empty spaces | 28 # keyboard layout, specifying rows with key widths, negative numbers are empty spaces |
37 keyrows = ( | 29 keyrows = ( |
38 [1.0, -0.6, 1.0, 1.0, 1.0, 1.0, -0.5, 1.0, 1.0, 1.0, 1.0, -0.5, 1.0, 1.0, | 30 [1.0, -0.6, 1.0, 1.0, 1.0, 1.0, -0.5, 1.0, 1.0, 1.0, 1.0, -0.5, 1.0, 1.0, |
39 1.0, 1.0, -0.1, 1.0, 1.0, 1.0], | 31 1.0, 1.0, -0.1, 1.0, 1.0, 1.0], |
45 [2.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.8, -1.3, 1.0], | 37 [2.6, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.8, -1.3, 1.0], |
46 [1.5, 1.5, 1.5, 6, 1.5, 1.5, -1.2, 1.5, -0.1, 1.0, 1.0, 1.0], | 38 [1.5, 1.5, 1.5, 6, 1.5, 1.5, -1.2, 1.5, -0.1, 1.0, 1.0, 1.0], |
47 ) | 39 ) |
48 keyDimension = 50'f32 | 40 keyDimension = 50'f32 |
49 keyGap = 10'f32 | 41 keyGap = 10'f32 |
50 backgroundColor = Vec4([1'f32, 0.3'f32, 0.3'f32, 0'f32]) | 42 backgroundColor = Vec4([0.6705882352941176'f32, 0.6078431372549019'f32, |
51 baseColor = Vec4([1'f32, 0'f32, 0'f32, 0'f32]) | 43 0.5882352941176471'f32, 0'f32]) |
52 activeColor = Vec4([1'f32, 1'f32, 1'f32, 0'f32]) | 44 baseColor = Vec4([0.9411764705882353'f32, 0.9058823529411765'f32, |
45 0.8470588235294118'f32, 0'f32]) | |
46 activeColor = Vec4([0.6509803921568628'f32, 0.22745098039215686'f32, | |
47 0.3137254901960784'f32, 0'f32]) | |
48 | |
49 arrow_colors = @[ | |
50 baseColor * 0.9'f32, | |
51 baseColor * 0.9'f32, | |
52 baseColor * 0.9'f32, | |
53 baseColor * 0.8'f32, | |
54 baseColor * 0.8'f32, | |
55 baseColor * 0.8'f32, | |
56 ] | |
53 keyIndices = [ | 57 keyIndices = [ |
54 Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PrintScreen, | 58 Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PrintScreen, |
55 ScrollLock, Pause, | 59 ScrollLock, Pause, |
56 | 60 |
57 NumberRowExtra1, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`, | 61 NumberRowExtra1, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`, |
114 0'f32, 1'f32, | 118 0'f32, 1'f32, |
115 ) | 119 ) |
116 engine.vulkan.device.updateUniformData(pipeline, uniforms) | 120 engine.vulkan.device.updateUniformData(pipeline, uniforms) |
117 | 121 |
118 let | 122 let |
119 mousePos = translate3d(engine.input.mousePos.x, engine.input.mousePos.y, 0'f32) | 123 mousePos = translate3d(engine.input.mousePos.x + 20, |
124 engine.input.mousePos.y + 20, 0'f32) | |
120 winsize = engine.window.size | 125 winsize = engine.window.size |
121 center = translate3d(float32(winsize[0]) / 2'f32, float32(winsize[1]) / | 126 center = translate3d(float32(winsize[0]) / 2'f32, float32(winsize[1]) / |
122 2'f32, 0.1'f32) | 127 2'f32, 0.1'f32) |
123 scene.firstWithName("cursor").transform = mousePos | 128 scene.firstWithName("cursor").transform = mousePos |
124 scene.firstWithName("keyboard-center").transform = center | 129 scene.firstWithName("keyboard-center").transform = center |