From ca52ec37a68fba67b2f34392be097f5cc2c320fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Fri, 27 Dec 2013 17:50:05 +0100 Subject: [PATCH] option for clients to select whether text on screens should be anti-aliased or not --- .../textures/font/chars_aliased.png | Bin 0 -> 3155 bytes li/cil/oc/Settings.scala | 1 + .../client/renderer/MonospaceFontRenderer.scala | 6 +++++- li/cil/oc/server/component/Computer.scala | 4 ++-- reference.conf | 4 ++++ 5 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 assets/opencomputers/textures/font/chars_aliased.png diff --git a/assets/opencomputers/textures/font/chars_aliased.png b/assets/opencomputers/textures/font/chars_aliased.png new file mode 100644 index 0000000000000000000000000000000000000000..10574315b0d9bc934f7629beefe860d517263aa3 GIT binary patch literal 3155 zcmbtW`9IWq7yo=`G0Ygm*vTM8q@l7E#?Dx?r6glbj5V^RFO^Cul}Op*-jHof*Qu;^8JP;SRyR;gKF;KES{`*wcq-5$JKz$KJ=oJ36$(=hR*imz|ZP3FlvP zirb*=Wf0-^HVzyx^M*tL05@o1Y~UC*_AUEv)n^TERw%r-?EBd_o zeYCw^4NW&;txjA=4Sb0D`r>LkDB|36Pi(ld{ujL|V^{wT93e`ao{=sibtj-%_uJa^ zI8#kY2GuXYu6`TxrbgkUrwZJRSqXx*VNSO+fAuivYEE!#D`YB;U6SN#)Hsqig>3s&Szd!;O~OR}qu`>% zmaU^HH1lVf?K`2jYY>e<)=PW1`33k%3E+RklU4o$t%7irbgLp$Kiie8hrI#*I1K)j z13%KgD!Pkc3*F#zj$vEKH-`%NS%n}wyFJ8 zyQKnn!ldkKzeayClYxI%Jn=z}Lx7zWv7aRRPOS#1vXc%a?}SZ@PzU^?uyiDuWO0%J zaw*D|&Ajj$bOr*oDAO5|!r|mu01ly~pIHjS>H2pTEXozWB354A6q{TRA=^ zPGqzzI3za8P0`8?u!K$E_PRlK1sAhu{72?rxd)9(hTcNdLTedJ-cw%aTHIOv=kH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DNz!A5} z7f4w6aHV4O^_1i2ZN0pwxYGLwcO2{0X;v&0E;^^$>&A>o2-{c;zLF5T1@>oWxV!dX zeK*FQYN~w{J)6&}OsXT>RSbFc3f6y9h=)yqfr#wE8e3V0JnwcPN%0be!1hB;+#q zw2KMeUW=>`a=-U%4xnLdZePR)#9|k23-OT`I5Q~ROyR$~Kx&K$yD3E2uUa)PW<1k_ zPOpopgZ95xA!ndk5#&l7;RqR*`sj&~6Noyg1yNTZNfEnE=-j;CAetx)!U^0AQ&P|Y z;2ljEQ9APsqSx+(L}H%2+xX67bf}IV{V@Pa)$QF7Jbzo>K&m9p-l!|dKm%)ahPYF5 zo>f&kxu(z{!OZa4`)XRQMO(P}6dkdsfqsuM{RWf literal 0 HcmV?d00001 diff --git a/li/cil/oc/Settings.scala b/li/cil/oc/Settings.scala index cbb2c0cbf..bd3072bc6 100644 --- a/li/cil/oc/Settings.scala +++ b/li/cil/oc/Settings.scala @@ -21,6 +21,7 @@ class Settings(config: Config) { val screenTextFadeStartDistance = config.getDouble("client.screenTextFadeStartDistance") val maxScreenTextRenderDistance = config.getDouble("client.maxScreenTextRenderDistance") val textLinearFiltering = config.getBoolean("client.textLinearFiltering") + val textAntiAlias = config.getBoolean("client.textAntiAlias") val rTreeDebugRenderer = false // *Not* to be configurable via config file. // ----------------------------------------------------------------------- // diff --git a/li/cil/oc/client/renderer/MonospaceFontRenderer.scala b/li/cil/oc/client/renderer/MonospaceFontRenderer.scala index fe04ea64e..32ad3448e 100644 --- a/li/cil/oc/client/renderer/MonospaceFontRenderer.scala +++ b/li/cil/oc/client/renderer/MonospaceFontRenderer.scala @@ -11,6 +11,7 @@ import scala.io.Source object MonospaceFontRenderer { val font = new ResourceLocation(Settings.resourceDomain, "textures/font/chars.png") + val fontAliased = new ResourceLocation(Settings.resourceDomain, "textures/font/chars_aliased.png") private val chars = Source.fromInputStream(MonospaceFontRenderer.getClass.getResourceAsStream("/assets/" + Settings.resourceDomain + "/textures/font/chars.txt"))("UTF-8").mkString @@ -71,7 +72,10 @@ object MonospaceFontRenderer { def drawString(x: Int, y: Int, value: Array[Char], color: Array[Short], depth: PackedColor.Depth.Value) = { if (color.length != value.length) throw new IllegalArgumentException("Color count must match char count.") - textureManager.bindTexture(MonospaceFontRenderer.font) + if (Settings.get.textAntiAlias) + textureManager.bindTexture(MonospaceFontRenderer.font) + else + textureManager.bindTexture(MonospaceFontRenderer.fontAliased) GL11.glPushMatrix() GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_TEXTURE_BIT) GL11.glTranslatef(x, y, 0) diff --git a/li/cil/oc/server/component/Computer.scala b/li/cil/oc/server/component/Computer.scala index 716836462..148335cf2 100644 --- a/li/cil/oc/server/component/Computer.scala +++ b/li/cil/oc/server/component/Computer.scala @@ -1351,7 +1351,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con catch { case e: LuaRuntimeException => OpenComputers.log.warning("Kernel crashed. This is a bug!\n" + e.toString + "\tat " + e.getLuaStackTrace.mkString("\n\tat ")) - crash("kernel panic") + crash("kernel panic: this is a bug, check your log file and report it") case e: LuaGcMetamethodException => if (e.getMessage != null) crash("kernel panic:\n" + e.getMessage) else crash("kernel panic:\nerror in garbage collection metamethod") @@ -1361,7 +1361,7 @@ class Computer(val owner: tileentity.Computer) extends ManagedComponent with Con crash("not enough memory") case e: Throwable => OpenComputers.log.log(Level.WARNING, "Unexpected error in kernel. This is a bug!\n", e) - crash("kernel panic") + crash("kernel panic: this is a bug, check your log file and report it") } } } diff --git a/reference.conf b/reference.conf index 957cda471..c3b173510 100644 --- a/reference.conf +++ b/reference.conf @@ -43,6 +43,10 @@ opencomputers { # anymore (for example for box drawing characters. Look it up on # Wikipedia.) textLinearFiltering: false + + # If you prefer the text on the screens to be aliased (you know, *not* + # anti-aliased / smoothed) turn this option off. + textAntiAlias: true } # Computer related settings, concerns server performance and security.