Skip to content
Snippets Groups Projects
Select Git revision
  • 3bc0c45339beee4140b4ee4dbb55037e314fba6f
  • master default protected
2 results

BackPackSolverTest.java

Blame
  • Forked from NAVES Guyslain / ProgAvExercices
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    main.cpp 5.88 KiB
    #include <iostream>
    
    #include <GL/glew.h>
    #include <GLFW/glfw3.h>
    
    //#include <imgui.h>
    //#include <imgui_impl_glfw.h>
    //#include <imgui_impl_opengl3.h>
    
    #define WINDOW_WIDTH  1280
    #define WINDOW_HEIGHT 720
    
    #include <engine/io/Window.hpp>
    #include <engine/graphics/back/cameras/View.hpp>
    #include <engine/graphics/front/object/Image.hpp>
    #include <engine/graphics/front/group/ImageGroup.hpp>
    #include <engine/graphics/front/engine/Renderer.hpp>
    #include <engine/graphics/front/engine/Engine.hpp>
    #include <engine/graphics/errors.hpp>
    
    const float i_x =  1.f;
    const float i_y =  0.5f;
    const float j_x = -1.f;
    const float j_y =  0.5f;
    
    glm::vec2 to_screen_coordinate(const glm::vec2 & tile, float w, float h, float layer = 0.0f) {
        return {
            (tile.x + layer) * i_x * 0.5f * w + (tile.y + layer) * j_x * 0.5f * w,
            (tile.x + layer) * i_y * 0.5f * h + (tile.y + layer) * j_y * 0.5f * h
        };
    }
    
    int main(int argc, const char * argv[]) {
        try {
            //? Window
            megu::Window window;
            window.open("Isometric Window", 360, 360);
            megu::error::opengl_error::check();
    
            std::cout << "Window Inited" << std::endl;
    
            //? Group
            megu::ImageGroup group;
            megu::ImageGroup group_2;
           
            std::cout << "Group Inited" << std::endl;
    
            //? Image 1
            std::vector<int> map = {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
                1, 1, 2, 3, 4, 5, 6, 7, 8, 9,
                2, 2, 2, 3, 4, 5, 6, 7, 8, 9,
                3, 3, 3, 3, 4, 5, 6, 7, 8, 9,
                4, 4, 4, 4, 4, 5, 6, 7, 8, 9,
                5, 5, 5, 5, 5, 5, 6, 7, 8, 9,
                6, 6, 6, 6, 6, 6, 6, 7, 8, 9,
                7, 7, 7, 7, 7, 7, 7, 7, 8, 9,
                8, 8, 8, 8, 8, 8, 8, 8, 8, 9,
                9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
    
            };
    
            size_t x = 0;
            size_t y = 0;
    
            std::vector<std::unique_ptr<megu::Image>> images;
    
            megu::Texture texture_0;
            texture_0.store(megu::TextureBuffer("assets/textures/Cube_Red.png"));