base_ui/
lib.rs

1pub mod core;
2pub mod graphics;
3pub mod text;
4pub mod animation;
5pub mod widget;
6pub mod figlet;
7pub mod style;
8use crate::core::{ GLContext, Window };
9
10// 외부에서 직접 사용하기 쉽도록 re-export합니다.
11pub use crate::graphics::renderer::Renderer;
12pub use crate::text::font::FontRenderer;
13pub use crate::text::text_renderer::TextRenderer;
14pub use crate::animation::Animation;
15pub use crate::widget::Widget;
16pub use crate::widget::widgets::text_view::TextView;
17pub use crate::figlet::figlet_3d::FIGLET_3D_FONT;
18pub use crate::core::error_handler::initialize_error_handler;
19
20use log::info;
21use figlet_rs::FIGfont;
22use gl;
23
24pub const ENGINE_NAME: &str = "BASE-UI";
25pub const ENGINE_VERSION: &str = "1.0.2";
26pub const ENGINE_AUTHOR: &str = "CHOI SIHUN";
27pub const ENGINE_COPYRIGHT: &str =
28    "Copyright © 2025 BASE-UI GUI Engine by CHOI SIHUN, All rights reserved.";
29
30pub fn initialize(window: &Window) -> GLContext {
31    core::logger::initialize();
32
33    // FIGlet 폰트로 아스키 아트 생성
34    let standard_font = FIGfont::from_content(FIGLET_3D_FONT).unwrap();
35    let figure = standard_font.convert(ENGINE_NAME).unwrap();
36
37    info!("\n{}", figure);
38    info!("----------------------------------------");
39    info!("{} v{}", ENGINE_NAME, ENGINE_VERSION);
40    info!("{}", ENGINE_COPYRIGHT);
41    info!("Author: {}", ENGINE_AUTHOR);
42    info!("----------------------------------------");
43
44    // OpenGL 컨텍스트 초기화
45    let gl_context = GLContext::new(window);
46
47    // OpenGL 정보 출력
48    unsafe {
49        let version = gl::GetString(gl::VERSION);
50        let renderer = gl::GetString(gl::RENDERER);
51        let vendor = gl::GetString(gl::VENDOR);
52        let glsl = gl::GetString(gl::SHADING_LANGUAGE_VERSION);
53
54        info!("OpenGL Information:");
55        info!("  Vendor: {}", std::ffi::CStr::from_ptr(vendor as *const i8).to_string_lossy());
56        info!("  Renderer: {}", std::ffi::CStr::from_ptr(renderer as *const i8).to_string_lossy());
57        info!("  Version: {}", std::ffi::CStr::from_ptr(version as *const i8).to_string_lossy());
58        info!("  GLSL Version: {}", std::ffi::CStr::from_ptr(glsl as *const i8).to_string_lossy());
59    }
60    info!("----------------------------------------");
61
62    gl_context
63}
64
65#[no_mangle]
66pub extern "C" fn engine_version() -> *const u8 {
67    b"Base UI v1.0.2\0".as_ptr()
68}