Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

having an issue to mlx_init, it returns 0 #57

Closed
raymond0517 opened this issue Dec 11, 2023 · 1 comment
Closed

having an issue to mlx_init, it returns 0 #57

raymond0517 opened this issue Dec 11, 2023 · 1 comment

Comments

@raymond0517
Copy link

Hi, not sure where went wrong, I can't get display!!, please help, man thanks.

echo $DISPLAY
8:8:8:8:0.0

C:\WINDOWS\system32>wsl --status
Default Distribution: Ubuntu
Default Version: 2

The following code having mlx_init() returns 0, which means can't get display
#include <mlx.h>
#include <stdio.h>
typedef struct s_data {
void *img;
char *addr;
int bits_per_pixel;
int line_length;
int endian;
} t_data;

void my_mlx_pixel_put(t_data *data, int x, int y, int color)
{
char *dst;

    dst = data->addr + (y * data->line_length + x * (data->bits_per_pixel / 8));
    *(unsigned int*)dst = color;

}

int main(void)
{
void *mlx;
// void *mlx_win;
t_data img;
printf("cp1");
fflush(stdout);
mlx = mlx_init();

@raymond0517
Copy link
Author

upgraded to wsl2 ubuntu, and it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant