diff --git a/docs/assets/content/imguiExample.png b/docs/assets/content/imguiExample.png new file mode 100644 index 00000000..c61416fe Binary files /dev/null and b/docs/assets/content/imguiExample.png differ diff --git a/docs/assets/content/imguiExample.zip b/docs/assets/content/imguiExample.zip new file mode 100644 index 00000000..35e99a90 Binary files /dev/null and b/docs/assets/content/imguiExample.zip differ diff --git a/docs/en/beamng/cef-snippets.md b/docs/en/beamng/cef-snippets.md new file mode 100644 index 00000000..680d0713 --- /dev/null +++ b/docs/en/beamng/cef-snippets.md @@ -0,0 +1,11 @@ +!!! warning "This site is under construction!" + + This site is being actively worked on. + + Feel you could help? Please do by clicking on the page with a pencil on the right! + + This can be done any page too. + +# BeamNG.drive CEF Code Snippets + +to-do diff --git a/docs/en/beamng/css-snippets.md b/docs/en/beamng/css-snippets.md new file mode 100644 index 00000000..6d0a6a9a --- /dev/null +++ b/docs/en/beamng/css-snippets.md @@ -0,0 +1,179 @@ +!!! warning "This site is under construction!" + + This site is being actively worked on. + + Feel you could help? Please do by clicking on the page with a pencil on the right! + + This can be done any page too. + +# BeamNG.drive CSS Code Snippets + +## Common variables + +=== BeamNG Orange + + ```css + var(--bng-orange) /*Common orange*/ + var(--bng-orange-shade1) /*70% opacity*/ + var(--bng-orange-shade2) /*40% opacity*/ + var(--bng-orange-shade1opaque) + var(--bng-orange-shade2opaque) + ``` + +=== Monochrome + + ```css + --- Monochrome + var(--bng-black-8) /*80% opacity (duplicate --bng-black-o8)*/ + var(--bng-black-6) /*60% opacity (duplicate --bng-black-o6)*/ + var(--bng-black-4) /*40% opacity (duplicate --bng-black-o4)*/ + var(--bng-black-2) /*20% opacity (duplicate --bng-black-o2)*/ + + var(--dark-neutral-grey) + var(--neutral-grey) + var(--light-neutral-grey) + var(--dark-grey) + var(--dark-grey-alpha) /*80% opacity*/ + + var(--black-1) /*70% opacity*/ + var(--black-2) /*40% opacity (duplicate --bng-black-o4)*/ + + var(--white-1) /*80% opacity*/ + var(--white-2) /*40% opacity*/ + var(--white-3) /*20% opacity*/ + ``` + +=== BeamNG UI Color Palette + + === Orange + + ```css + var(--bng-orange-50) + var(--bng-orange-100) + var(--bng-orange-200) + var(--bng-orange-300) + var(--bng-orange-b400) + var(--bng-orange-500) + var(--bng-orange-600) + var(--bng-orange-700) + var(--bng-orange-800) + var(--bng-orange-900) + ``` + + === Cool Gray + + ```css + var(--bng-cool-gray-50) + var(--bng-cool-gray-100) + var(--bng-cool-gray-200) + var(--bng-cool-gray-300) + var(--bng-cool-gray-400) + var(--bng-cool-gray-500) + var(--bng-cool-gray-600) + var(--bng-cool-gray-700) + var(--bng-cool-gray-800) + var(--bng-cool-gray-900) + ``` + + === Ter Blue + ```css + var(--bng-ter-blue-50) + var(--bng-ter-blue-100) + var(--bng-ter-blue-200) + var(--bng-ter-blue-300) + var(--bng-ter-blue-400) + var(--bng-ter-blue-500) + var(--bng-ter-blue-600) + var(--bng-ter-blue-700) + var(--bng-ter-blue-800) + var(--bng-ter-blue-900) + ``` + + === Add Blue + ```css + var(--bng-add-blue-50) + var(--bng-add-blue-100) + var(--bng-add-blue-200) + var(--bng-add-blue-300) + var(--bng-add-blue-400) + var(--bng-add-blue-500) + var(--bng-add-blue-600) + var(--bng-add-blue-700) + var(--bng-add-blue-800) + var(--bng-add-blue-900) + ``` + + === Add Green + ```css + var(--bng-add-green-50) + var(--bng-add-green-100) + var(--bng-add-green-200) + var(--bng-add-green-300) + var(--bng-add-green-400) + var(--bng-add-green-500) + var(--bng-add-green-600) + var(--bng-add-green-700) + var(--bng-add-green-800) + var(--bng-add-green-900) + ``` + + === Add Yellow + ```css + var(--bng-add-yellow-50) + var(--bng-add-yellow-100) + var(--bng-add-yellow-200) + var(--bng-add-yellow-300) + var(--bng-add-yellow-400) + var(--bng-add-yellow-500) + var(--bng-add-yellow-600) + var(--bng-add-yellow-700) + var(--bng-add-yellow-800) + var(--bng-add-yellow-900) + ``` + + === Add Peach + ```css + var(--bng-add-peach-50) + var(--bng-add-peach-100) + var(--bng-add-peach-200) + var(--bng-add-peach-300) + var(--bng-add-peach-400) + var(--bng-add-peach-500) + var(--bng-add-peach-600) + var(--bng-add-peach-700) + var(--bng-add-peach-800) + var(--bng-add-peach-900) + ``` + + === Add Red + ```css + var(--bng-add-red-50) + var(--bng-add-red-100) + var(--bng-add-red-200) + var(--bng-add-red-300) + var(--bng-add-red-400) + var(--bng-add-red-500) + var(--bng-add-red-600) + var(--bng-add-red-700) + var(--bng-add-red-800) + var(--bng-add-red-900) + ``` + + +=== Extra color presets + + ```css + var(--bng-filter-orange) /*Filter preset to force SVGs to use bng-orange*/ + var(--bng-black-o8) /*80% opacity*/ + var(--bng-black-o6) /*60% opacity*/ + var(--bng-black-o4) /*40% opacity*/ + var(--bng-black-o2) /*20% opacity*/ + ``` + +=== Corner rounding presets + + ```css + var(--bng-corners-1) /*0.25rem*/ + var(--bng-corners-2) /*0.50rem*/ + var(--bng-corners-3) /*1.00rem*/ + ``` diff --git a/docs/en/beamng/dev/modding/imgui-window-tutorial.md b/docs/en/beamng/dev/modding/imgui-window-tutorial.md new file mode 100644 index 00000000..6b707491 --- /dev/null +++ b/docs/en/beamng/dev/modding/imgui-window-tutorial.md @@ -0,0 +1,88 @@ +!!! warning "This site is under construction!" + + This site is being actively worked on. + + Feel you could help? Please do by clicking on the page with a pencil on the right! + + This can be done any page too. + # Creating an ImGui Window + +This page covers how to create a basic ImGui window. + +## Setup + +Before using ImGui, some setup is required: + +```lua +local im = ui_imgui -- shortcut to prevent lookups all the time. should help with optimization +local imguiExampleWindowOpen = im.BoolPtr(true) +``` + +`imguiExampleWindowOpen` will be used to determine when this example window should be rendered. + +## Window Rendering + +ImGui windows and their contents must be recreated for every frame they should be displayed. This means that some form of onUpdate function is necessary to use ImGui. + +```lua +local function onUpdate() + if worldReadyState == 2 then + if imguiExampleWindowOpen[0] == true then + imguiExample() + end + end +end +M.onUpdate = onUpdate +``` + +This will run a function to create this example's window, so long as the level is fully loaded, and that the example window should be displaying. + +## Window Content + +If you're new to writing ImGui, think of it as a distant cousin of HTML: + +* `im.SetNextWindowSize(im.ImVec2(x, y), im.Cond_FirstUseEver)` defines your viewport size if it hasn't already been defined +* `im.Begin()` and `im.End()` is your `` and `` +* `im.Text()` is your `

` + +```lua +local buttonPresses = 0 + +local function imguiExample() + im.SetNextWindowSize(im.ImVec2(366, 100), im.Cond_FirstUseEver) -- prepare our window + im.Begin("Hello World, I am a window") -- create a window with the title of "Hello World, I am a window" + im.Indent() -- a... padding element + im.Text("Hello World, I am text.") -- add a line of text, somewhat like a

element + im.SameLine() -- Not really HTML. This appends the following element to the same line as the previous element. + if im.Button("The Hello World Button") then -- Like