-
Notifications
You must be signed in to change notification settings - Fork 403
Getting started
Mikulas Florek edited this page Jun 25, 2024
·
51 revisions
You can get Lumix Engine from itch.io or download standalone zip file from actions.
- Visual Studio 2022 on Windows
- git client
- MinGW is not supported
Download bootstrap batch file and run it. It will fetch the repository, create Visual Studio solution and open it. After that you can build the solution and run the editor. If something fails or you do not want to use the batch file, execute these 4 steps manually
Download this shell script and run it. It will fetch the repository, create makefile, build it and run the editor.
- Note: the shell script needs git, make and g++ accessible
- Note: to build using clang, call
./genie --gcc=linux-clang gmake
- Note: to build using clang & ninja, call
./genie --gcc=linux-clang ninja
This is minimal code to display a triangle for people who want code-first workflow without editor. Up to date code can be found at the bottom of https://github.com/nem0/LumixEngine/blob/master/src/app/main.cpp
#include "engine/allocators.h"
#include "engine/os.h"
#include "renderer/gpu/gpu.h"
using namespace Lumix;
int main(int args, char* argv[]) {
OS::WindowHandle win = OS::createWindow({});
DefaultAllocator allocator;
gpu::preinit(allocator, false);
gpu::init(win, gpu::InitFlags::NONE);
gpu::ProgramHandle shader = gpu::allocProgramHandle();
const gpu::ShaderType types[] = {gpu::ShaderType::VERTEX, gpu::ShaderType::FRAGMENT};
const char* srcs[] = {
"void main() { gl_Position = vec4(gl_VertexID & 1, (gl_VertexID >> 1) & 1, 0, 1); }",
"layout(location = 0) out vec4 color; void main() { color = vec4(1, 0, 1, 1); }",
};
gpu::createProgram(shader, {}, srcs, types, 2, nullptr, 0, "shader");
bool finished = false;
while (!finished) {
OS::Event e;
while (OS::getEvent(Ref(e))) {
switch (e.type) {
case OS::Event::Type::WINDOW_CLOSE:
case OS::Event::Type::QUIT: finished = true; break;
}
}
gpu::setFramebuffer(nullptr, 0, gpu::INVALID_TEXTURE, gpu::FramebufferFlags::NONE);
const float clear_col[] = {0, 0, 0, 1};
gpu::clear(gpu::ClearFlags::COLOR | gpu::ClearFlags::DEPTH, clear_col, 0);
gpu::useProgram(shader);
gpu::setState(gpu::StateFlags::NONE);
gpu::drawArrays(0, 3, gpu::PrimitiveType::TRIANGLES);
u32 frame = gpu::swapBuffers();
gpu::waitFrame(frame);
}
gpu::shutdown();
OS::destroyWindow(win);
}