mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 03:22:20 +07:00
GL 3.0 should now work for mac - kudos @lishaoxia1985
This commit is contained in:
parent
14b24d17ee
commit
81e520e608
@ -517,8 +517,8 @@
|
||||
|
||||
declaringWar:"Jip-hyun-jun (Hall of Worthies) will no longer tolerate your irksome behavior. We will liberate the citizens under your oppression even with force, and enlighten them!"
|
||||
attacked:"Foolish, miserable wretch! You will be crushed by this country's magnificent scientific power!"
|
||||
defeated:"Now the question is who will protect my people. A dark age has come."
|
||||
introduction:"Welcome to the palace of Choson, stanger. I am the learned King Sejong, who looks after his great people."
|
||||
defeated:"Now the question is who will protect my people. A dark age has come.",
|
||||
introduction:"Welcome to the palace of Choson, stranger. I am the learned King Sejong, who looks after his great people.",
|
||||
|
||||
neutralHello:"Hello."
|
||||
neutralLetsHearIt:["I will hear it.","Go on","Continue."]
|
||||
|
@ -570,7 +570,7 @@
|
||||
declaringWar:"Jip-hyun-jun (Hall of Worthies) will no longer tolerate your irksome behavior. We will liberate the citizens under your oppression even with force, and enlighten them!"
|
||||
attacked:"Foolish, miserable wretch! You will be crushed by this country's magnificent scientific power!"
|
||||
defeated:"Now the question is who will protect my people. A dark age has come."
|
||||
introduction:"Welcome to the palace of Choson, stanger. I am the learned King Sejong, who looks after his great people."
|
||||
introduction:"Welcome to the palace of Choson, stranger. I am the learned King Sejong, who looks after his great people."
|
||||
|
||||
neutralHello:"Hello."
|
||||
neutralLetsHearIt:["I will hear it.","Go on","Continue."]
|
||||
|
@ -532,8 +532,8 @@
|
||||
|
||||
declaringWar:"Jip-hyun-jun (Hall of Worthies) will no longer tolerate your irksome behavior. We will liberate the citizens under your oppression even with force, and enlighten them!"
|
||||
attacked:"Foolish, miserable wretch! You will be crushed by this country's magnificent scientific power!"
|
||||
defeated:"Now the question is who will protect my people. A dark age has come."
|
||||
introduction:"Welcome to the palace of Choson, stanger. I am the learned King Sejong, who looks after his great people."
|
||||
defeated:"Now the question is who will protect my people. A dark age has come.",
|
||||
introduction:"Welcome to the palace of Choson, stranger. I am the learned King Sejong, who looks after his great people.",
|
||||
|
||||
neutralHello:"Hello."
|
||||
neutralLetsHearIt:["I will hear it.","Go on","Continue."]
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.unciv.ui.utils
|
||||
|
||||
import com.badlogic.gdx.Application
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.Screen
|
||||
@ -7,6 +8,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram
|
||||
import com.badlogic.gdx.scenes.scene2d.*
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.*
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener
|
||||
@ -73,7 +75,45 @@ open class CameraStageBaseScreen : Screen {
|
||||
skin.get(SelectBox.SelectBoxStyle::class.java).listStyle.font = Fonts().getFont(45).apply { data.setScale(20/45f) }
|
||||
skin.get(CheckBox.CheckBoxStyle::class.java).fontColor= Color.WHITE
|
||||
}
|
||||
internal var batch: Batch = SpriteBatch()
|
||||
internal var batch: Batch = if(Gdx.app.type == Application.ApplicationType.Android) SpriteBatch() else SpriteBatch(1000, createDefaultShader())
|
||||
|
||||
// This is so the MacOS works with GL 3.0, see https://github.com/yairm210/Unciv/issues/1428
|
||||
fun createDefaultShader(): ShaderProgram? {
|
||||
val vertexShader = ("#version 330 core\n"
|
||||
+ "in vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
|
||||
+ "in vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
|
||||
+ "in vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
|
||||
+ "uniform mat4 u_projTrans;\n" //
|
||||
+ "out vec4 v_color;\n" //
|
||||
+ "out vec2 v_texCoords;\n" //
|
||||
+ "\n" //
|
||||
+ "void main()\n" //
|
||||
+ "{\n" //
|
||||
+ " v_color = " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" //
|
||||
+ " v_color.a = v_color.a * (255.0/254.0);\n" //
|
||||
+ " v_texCoords = " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //
|
||||
+ " gl_Position = u_projTrans * " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" //
|
||||
+ "}\n")
|
||||
val fragmentShader = ("#version 330 core\n"
|
||||
+ "#ifdef GL_ES\n" //
|
||||
+ "#define LOWP lowp\n" //
|
||||
+ "precision mediump float;\n" //
|
||||
+ "#else\n" //
|
||||
+ "#define LOWP \n" //
|
||||
+ "#endif\n" //
|
||||
+ "in LOWP vec4 v_color;\n" //
|
||||
+ "in vec2 v_texCoords;\n" //
|
||||
+ "out vec4 fragColor;\n" //
|
||||
+ "uniform sampler2D u_texture;\n" //
|
||||
+ "void main()\n" //
|
||||
+ "{\n" //
|
||||
+ " fragColor = v_color * texture(u_texture, v_texCoords);\n" //
|
||||
+ "}")
|
||||
val shader = ShaderProgram(vertexShader, fragmentShader)
|
||||
require(shader.isCompiled) { "Error compiling shader: " + shader.log }
|
||||
return shader
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun onBackButtonClicked(action:()->Unit){
|
||||
|
Loading…
Reference in New Issue
Block a user