mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
scrolling credit text outside of text area would not move the scrollbar
This commit is contained in:
@@ -25,9 +25,6 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
width, height
|
||||
).also {
|
||||
it.setWallOfText(text)
|
||||
it.scrolledListener = { x, y ->
|
||||
scrollbar?.scrolledForce(5*x, 5*y)
|
||||
}
|
||||
}
|
||||
|
||||
private val scrollbar: UIItemVertSlider? = if (true) {
|
||||
@@ -62,6 +59,7 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
override fun scrolled(amountX: Float, amountY: Float): Boolean {
|
||||
textArea.scrolled(amountX, amountY)
|
||||
scrollbar?.scrolledForce(5*amountX, 5*amountY)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
#define srgbmix(c1, c2, control) unlinearise(mix(linearise(c1), linearise(c2), (control))) // wow this is slow...
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_texCoords;
|
||||
@@ -119,6 +119,20 @@ vec4 random(vec2 p) {
|
||||
);
|
||||
} // TODO the "grain" needs to be larger
|
||||
|
||||
vec4 linearise(vec4 c) {
|
||||
bvec3 cutoff = lessThan(c.rgb, vec3(0.04045));
|
||||
vec3 higher = pow((c.rgb + vec3(0.055))/vec3(1.055), vec3(2.4));
|
||||
vec3 lower = c.rgb / vec3(12.92);
|
||||
return vec4(mix(higher, lower, cutoff), c.a);
|
||||
}
|
||||
|
||||
vec4 unlinearise(vec4 c) {
|
||||
bvec3 cutoff = lessThan(c.rgb, vec3(0.0031308));
|
||||
vec3 higher = vec3(1.055) * pow(c.rgb, vec3(1.0 / 2.4)) - vec3(0.055);
|
||||
vec3 lower = c.rgb * vec3(12.92);
|
||||
return vec4(mix(higher, lower, cutoff), c.a);
|
||||
}
|
||||
|
||||
// draw call to this function must use UV coord of (0,0,1,1)!
|
||||
void main(void) {
|
||||
vec4 colorTexA = texture(u_texture, mix(uvA.xy, uvA.zw, v_texCoords));
|
||||
|
||||
Reference in New Issue
Block a user