Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hobby_programmer

10
Posts
A member registered 98 days ago

Recent community posts

Hi Ray

I have a question about texture loading and unloading correctness:

#include "raylib.h"

int main(void) {

    const int screenWidth = 400;

    const int screenHeight = 300;

    SetTargetFPS(60);

    InitWindow(screenWidth, screenHeight, "DrawTexture Example");

    int fontsize = 20;

    char *getfont = "fonts/JuliaMono-Light.ttf";

    Font font = LoadFontEx(getfont, fontsize, 0, 250);

    char *ptr = "Texture";

    int x = 50, y = 30;

    Image image = GenImageColor(screenWidth, screenHeight, WHITE);

    ImageDrawTextEx(&image, font, ptr, (Vector2){ x, y }, fontsize, 0, BLUE);

    Texture2D texture = LoadTextureFromImage(image);

    while (!WindowShouldClose()) {

        if (IsKeyDown(KEY_ENTER)) {

            ImageDrawRectangle(&image, x, y, 300, 30, WHITE);   // erase or text will become ugly

            ImageDrawTextEx(&image, font, ptr, (Vector2){ x, y }, fontsize, 0, RED);

            UnloadTexture(texture);                             // 1 saving memory or is it wrong?

            texture = LoadTextureFromImage(image);

        }

        else if (IsKeyDown(KEY_SPACE)) {

            ImageDrawRectangle(&image, x, y, 300, 30, WHITE);   // erase or text will become ugly

            ImageDrawTextEx(&image, font, ptr, (Vector2){ x, y }, fontsize, 0, PURPLE);

            UnloadTexture(texture);                             // 2 saving memory or is it wrong?

            texture = LoadTextureFromImage(image);

        }

        BeginDrawing();

        ClearBackground(WHITE);

        DrawTexture(texture, 0, 0, WHITE);

        EndDrawing();

    }

    UnloadImage(image);

    UnloadTexture(texture);

    CloseWindow();

    return 0;

}

/*

The console reports an incremental higher TEXTURE: [ID num] each time I use Enter or space. Is it only an intern Raylib count or?

Thanks in advance.

*/

I solved the issue by using an image of higher resolution and then print and it very fine.

Thanks for answer.
(1 edit)

Hi Ray

I'm printing (Linux CUBS printer) on paper and use this test code snip, that works fine. 

// Raylib 5

    int x = 0;

    int y = 100;

    int fontsize = 16;

    char *getfont =  "arial.ttf"; // tried different fonts without success.

    Font font;

    font = LoadFontEx(getfont, fontsize, 0, 250);

    const char *t = "mimMIN";

    ImageDrawTextEx(&image, font, t, (Vector2){ x, y }, fontsize, 1, BLACK);

    const char *filename = "output.png";

    ExportImage(image, filename);

But I have issues with the sharpness of the letters, they become a bit blurred or unclear. I had similar issue month ago, when I printed from Windows using Raylib 4.5, but not using the same font from Notepad. I never got that problem solved.

Do you have a suggestion for what I can improve, if the problem at all is related to Raylib?

Thanks in advance.
Hobby programmer

Worth it. The old database uses graphics.h you were inspired by. Because of the need of editing i have to address each character. The old database use extended ASCII. In the new database I have to convert to UTF8 in Raylib (Danish) when showing on the screen, but still save data as extended ASCII because of compatibility. Quite a task for a hobby programmer but doable with Raylib!

So many thanks for a great libray!

I linked with libraylib.a and had to add an m, before I could compile. 

And the

DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

was shown on the screen. 

The m did remove the error "undefined reference to 'sqrtf'" error.

Big thanks!

I don't think so, but now I got rid of that error and can compile without errors and warnings.

When I try to run the compiled file, the console shows: error while loading shared libraries: libraylib.so.500: cannot shared object file: No such file or directory

After many issues, I think the above is okay. Now I got errors about rlgl.h line 1200  gives undefined reference to 'sqrtf' and many more raymath.h e.g.

Thanks Ray. 

I guess it might be, because I'm trying to use the executable on a Linux Mint LMDE(Debian) and I had made it on a Linux Mint(Ubuntu).

Right now, I'm trying to install Raylib on Linux Mint LMDE, but it's a struggle.

I have read that the installation can be as simple as this:

1. git clone https://github.com/raysan5/raylib.git

2. cd raylib

3. cmake .  gives lots of errors

4. make

I fairly new to Linux and uses CodeBlocks and C99.

I have made small relational database in C, which uses the fantastic Raylib graphics for the interface. Raylib just works perfect for me.

I'm using Linux Mint and it works fine, but if I have to use the database on another Linux Mint computer, I ran into some issues. When I try to run the executable, it respond not associated to any known programs...

What do the other computer need to run the executable file?

Any help would be appreciated.