electronstudio / jaylib

Java JNI bindings for Raylib
Other
114 stars 21 forks source link

Fixing HighDPI causes text blurring issue in jaylib doesn't works! #9

Closed ghost closed 4 years ago

ghost commented 4 years ago

As jaylib is almost same as raylib in C,I managed to fix HighDPI causes text blurring issue in raylib by the line that raysan5 mentioned in this issue https://github.com/raysan5/raylib/issues/1111#issuecomment-590571060

SetTextureFilter(GetFontDefault().texture, FILTER_POINT);

I think it should works as same as in raylib C but it gives error in the following image

Screenshot (238)

Here is the full file source code,Called Game.java

import com.raylib.Raylib;
import static com.raylib.Jaylib.*;

public class Game {
    public static void main(String[] args) {

        SetConfigFlags(FLAG_VSYNC_HINT);
        SetConfigFlags(FLAG_MSAA_4X_HINT);

        InitWindow(800, 600, "Game");
        SetTargetFPS(60);

        SetTextureFilter(GetFontDefault().texture, FILTER_POINT);

        while (!WindowShouldClose()) {
            BeginDrawing();
            ClearBackground(WHITE);

            DrawRectangleLines(100, 100, 100, 50, BLUE);
            DrawCircleLines(200, 100, 25, RED);
            DrawLine(300, 100, 600, 100, BLACK);
            DrawTriangleLines(new Vector2(500, 300), new Vector2(600, 400), new Vector2(500, 200), BROWN);
            DrawPolyLines(new Vector2(500, 600), 6, 50, 0, GOLD);
            DrawEllipseLines(500, 400, 100, 50, PURPLE);

            EndDrawing();
        }

        Raylib.CloseWindow();
    }
}

I don't know until now what causes this,Thanks for helping me if you can!

electronstudio commented 4 years ago

C is very different than Java even if they look similar. In this case the difference is that texture is a field in C but a method in java, so the code would be:

 SetTextureFilter(GetFontDefault().texture(), FILTER_POINT);

I would guess that you haven't used Java before so I would suggest learning Java with some simple text programs before attempting graphics or Raylib. Also it's very difficult to write Java without an IDE and if you were using an IDE it would have suggested this fix automatically so I'd suggest IntelliJ.