#pragma once #include #include #if defined(__EMSCRIPTEN__) #include #endif #include #include #include namespace wne { // TODO: load me in a better way const char shaderCode[] = R"( @vertex fn vertexMain(@builtin(vertex_index) i : u32) -> @builtin(position) vec4f { const pos = array(vec2f(0, 1), vec2f(-1, -1), vec2f(1, -1)); return vec4f(pos[i], 0, 1); } @fragment fn fragmentMain() -> @location(0) vec4f { return vec4f(1, 0, 0, 1); } )"; class window { wgpu::Instance instance; wgpu::Adapter adapter; wgpu::Device device; wgpu::RenderPipeline pipeline; wgpu::Surface surface; wgpu::TextureFormat format; const uint32_t kWidth = 512; const uint32_t kHeight = 512; void ConfigureSurface(); void CreateRenderPipeline(); void Render(); void InitGraphics(); public: //TODO: make init the constructor window(); void Start(); }; } // namespace wne