Closed lsdrfrx closed 4 months ago
First of all, You're welcome! I'm glad you're finding leif helpful!
#include <cstddef>
#include <cstdio>
#include <cstdlib>
// If you're working with c++, you need to define extern "C" for leif include
extern "C" {
#include <leif/leif.h>
}
#include <GLFW/glfw3.h>
#define WINDOW_HEIGHT 600
#define WINDOW_WIDTH 800
#define WINDOW_VSYNC false
int main() {
if (!glfwInit()) {
exit(-1);
}
bool show_text = false;
GLFWwindow *window = glfwCreateWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "FIND PEOPLE", NULL, NULL);
if (!window) {
perror("failed glfwcreatewindow");
exit(-1);
}
glfwMakeContextCurrent(window);
glfwSwapInterval(WINDOW_VSYNC);
lf_init_glfw(WINDOW_WIDTH, WINDOW_HEIGHT, window);
// Your application loop (runs while the window is open)
while(!glfwWindowShouldClose(window)) {
// Clearing the screen with a gray color
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
lf_begin();
lf_text("Hello Leif!");
lf_next_line();
if(lf_button("Close") == LF_CLICKED) {
glfwSetWindowShouldClose(window, true);
}
if(lf_button("Show Text") == LF_CLICKED) {
show_text = !show_text;
}
if(show_text) {
lf_next_line();
lf_text_wide(L"Привет");
}
lf_end();
// Polling the input events from the window
glfwPollEvents();
// Swapping the windows buffers
glfwSwapBuffers(window);
}
return 0;
}
g++ main.cpp -o main -lleif -lglfw -lclipboard -lGL -lm
Thank you! It works I'm kinda goofy, now I figured out what to do next
Hi! Thanks for great library! Finally found bloat-free minimalist library with comfy API I'm pretty new to C++, and I can't build example from docs. Code: https://pastebin.com/CSF4Jimi Error: https://imgur.com/a/36zfMTm