Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VitePress to the Repository #19

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.vitepress/dist
.vitepress/cache
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# .npmrc
public-hoist-pattern[]=@braintree/sanitize-url
public-hoist-pattern[]=dayjs
public-hoist-pattern[]=debug
public-hoist-pattern[]=cytoscape-cose-bilkent
public-hoist-pattern[]=cytoscape
111 changes: 111 additions & 0 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { withMermaid } from "vitepress-plugin-mermaid";

// https://vitepress.dev/reference/site-config
export default withMermaid({
title: "GeneralsWiki",
description: "Generals Community Wiki",
lastUpdated: true,
ignoreDeadLinks: true,

// MermaidConfig
mermaid: {
// refer https://mermaid.js.org/config/setup/modules/mermaidAPI.html#mermaidapi-configuration-defaults for options
},
// optionally set additional config for plugin itself with MermaidPluginConfig
mermaidPlugin: {
class: "mermaid my-class", // set additional css classes for parent container
},

// Theme Config
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: "/assets/icon.webp",

nav: [
{ text: "Home", link: "/" },
{ text: "Compile", link: "/SourceCode/Builds/vs22_compile.md" },
],

sidebar: [
{
text: "Assets",
items: [
{
text: "Art",
items: [
{ text: "Cameo Sizes", link: "/Asset/Art/cameo_sizes" },
{ text: "DDS Files and DXT Compression", link: "/Asset/Art/dds/dds-files-and-dxt-compression" },
{ text: "3DS Max Readme", link: "/Asset/Art/w3d/3dsmax/readme" },
],
},
{
text: "Audio",
items: [{ text: "Audio Documentation", link: "/Asset/Audio/audio" }],
},
{
text: "Game Design",
items: [
{ text: "INI Map Documentation", link: "/Asset/GameDesign/ini/map" },
{ text: "SCB Links", link: "/Asset/GameDesign/scb/links" },
],
},
{
text: "GUI",
items: [
{ text: "Texturing", link: "/Asset/GUI/texturing" },
{ text: "WND Reference", link: "/Asset/GUI/wnd_reference" },
{
text: "WND Controls",
items: [
{ text: "Checkbox", link: "/Asset/GUI/WND_Controls/checkbox" },
{ text: "Combobox", link: "/Asset/GUI/WND_Controls/combobox" },
{ text: "Entry Field", link: "/Asset/GUI/WND_Controls/entryfiled" },
{ text: "Progress Bar", link: "/Asset/GUI/WND_Controls/progressbar" },
{ text: "Push Button", link: "/Asset/GUI/WND_Controls/pushbutton" },
{ text: "Radio Button", link: "/Asset/GUI/WND_Controls/radiobutton" },
{ text: "Scroll List Box", link: "/Asset/GUI/WND_Controls/scrollistbox" },
{ text: "Slider", link: "/Asset/GUI/WND_Controls/slider" },
{ text: "Static Text", link: "/Asset/GUI/WND_Controls/statictext" },
{ text: "User", link: "/Asset/GUI/WND_Controls/user" },
],
},
],
},
{
text: "Localization",
items: [{ text: "CSF Format", link: "/Asset/Localization/csf/csf_format" }],
},
{
text: "Maps",
items: [{ text: "WorldBuilder Links", link: "/Asset/Maps/worldbuilder/links" }],
},
{
text: "Tools",
items: [
{ text: "Generals Mod Builder", link: "/Asset/Tools/generals_mod_builder" },
{ text: "BIG Format", link: "/Asset/Tools/big/big_format" },
],
},
],
},
{
text: "Source Code",
items: [
{ text: "Builds", link: "/SourceCode/Builds/vs22_compile" },
{ text: "Tools", link: "/SourceCode/Tools/switchers_arguments" },
],
},
],

footer: {
message:
'Want to contribute to this Wiki? <a href="https://github.com/TheSuperHackers/GeneralsWiki.git">Fork it and send a pull request.</a>',
},

socialLinks: [
{ icon: "github", link: "https://github.com/TheSuperHackers/GeneralsWiki" },
{ icon: "discord", link: "https://www.community-outpost.com/discord" },
],
},
head: [["link", { rel: "icon", href: "/assets/favicon.ico" }]],
});
24 changes: 24 additions & 0 deletions .vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Component: Home
* --------------------------------------------------------------------------
*/

:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #0033be 20%, #006eff);

--vp-home-hero-image-background-image: linear-gradient(-45deg, #1e3a8a 50%, #2563eb 50%);
--vp-home-hero-image-filter: blur(44px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(68px);
}
}
4 changes: 4 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultTheme from "vitepress/theme";
import "./custom.css";

export default DefaultTheme;
100 changes: 49 additions & 51 deletions Asset/GUI/texturing.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ Textures are used to provide the visual appearance of various UI elements, such
Generals uses `.tga` (Targa) files to store textures. These files are often large images that contain multiple smaller
images, each used for a different UI element.

**Note:** While `.tga` was the original format, in Patch 1.04p development, support has been added for formats
`.psd` and `.tiff` formats. These newer formats offer advantages such as layer support, which simplifies the texture
editing process. Additionally, you can also use `.dds` (DirectDraw Surface) files, specifically in DXT1 or
DXT5 formats, and reference them within the game's `.wnd` files.
**Note:** While `.tga` was the original format, in Patch 1.04p development, support has been added for formats `.psd`
and `.tiff` formats. These newer formats offer advantages such as layer support, which simplifies the texture editing
process. Additionally, you can also use `.dds` (DirectDraw Surface) files, specifically in DXT1 or DXT5 formats, and
reference them within the game's `.wnd` files.

### `SCSmShellUserInterface512_001.tga`

you can find the texture files in the `Data\Art\Textures` directory.

![Description of the image](/SCSmShellUserInterface512_001.tga.png)
![Description of the image](./SCSmShellUserInterface512_001.tga.png)

The main texture file used for the game's UI is `SCSmShellUserInterface512_001.tga`.
This file contains a large number of textures, packed together into a single image file.
The dimensions of this texture are typically 512x512 pixels, butother sizes might be used for other files.
The main texture file used for the game's UI is `SCSmShellUserInterface512_001.tga`. This file contains a large number
of textures, packed together into a single image file. The dimensions of this texture are typically 512x512 pixels,
butother sizes might be used for other files.

## Mapping Textures

Expand Down Expand Up @@ -49,12 +49,12 @@ MappedImage TextureName
End
```

- `TextureName`: The unique name used to reference the texture within the game's WND files.
- `TextureName`: The unique name used to reference the texture within the game's WND files.
- `Texture`: The name of the .tga file where the texture is stored.
- `TextureWidth`: The width of the .tga texture file in pixels.
- `TextureHeight`: The height of the .tga texture file in pixels.
- `Coords`: The coordinates of the texture within the .tga file. `Left`, `Top`, `Right` and `Bottom` define the
position of the top-left and bottom-right corners of the texture, in pixels.
- `Coords`: The coordinates of the texture within the .tga file. `Left`, `Top`, `Right` and `Bottom` define the position
of the top-left and bottom-right corners of the texture, in pixels.
- `Status`: Usually `NONE`.

#### Example
Expand All @@ -78,22 +78,21 @@ In this example:

## Using Textures in WND Files

You reference textures in WND files using the `DRAWDATA` tags, such as `ENABLEDDRAWDATA`, `DISABLEDDRAWDATA`,
and `HILITEDRAWDATA`. Each `DRAWDATA` tag consists of a sequence of **exactly 9 entries**,
each defining how a specific part of the control's texture should be rendered.
You reference textures in WND files using the `DRAWDATA` tags, such as `ENABLEDDRAWDATA`, `DISABLEDDRAWDATA`, and
`HILITEDRAWDATA`. Each `DRAWDATA` tag consists of a sequence of **exactly 9 entries**, each defining how a specific part
of the control's texture should be rendered.

**Important:** The order and position (or "slot") of each texture within the `DRAWDATA` tag is crucial.
The game expects the textures to be in a specific order, and placing them in the wrong slots can lead to incorrect
rendering or even cause the game to crash.
**Important:** The order and position (or "slot") of each texture within the `DRAWDATA` tag is crucial. The game expects
the textures to be in a specific order, and placing them in the wrong slots can lead to incorrect rendering or even
cause the game to crash.

The correct order and slots for textures can be determined by examining the code examples for each specific control.
Even if some parts of the control don't have a texture and need to use `NoImage`,
you must still include the `NoImage` entry in the correct slot.
Even if some parts of the control don't have a texture and need to use `NoImage`, you must still include the `NoImage`
entry in the correct slot.

**Example:**

> [!NOTE]
> Colors whose alpha value is 0 are not actually applied.
> [!NOTE] Colors whose alpha value is 0 are not actually applied.

```nasm
ENABLEDDRAWDATA = IMAGE: LoadingBar_R, COLOR: 255 0 0 0, BORDERCOLOR: 255 128 128 0,
Expand All @@ -107,16 +106,16 @@ ENABLEDDRAWDATA = IMAGE: LoadingBar_R, COLOR: 255 0 0 0, BORDERCOLOR: 255 128 12
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
```

Here, `LoadingBar_R`, `LoadingBar_L` and other are the names of textures defined in the
`SCSmShellUserInterface512.ini` file. The `NoImage` entries must still be included in their correct slots,
even if there is no specific texture for that part of the control.
Here, `LoadingBar_R`, `LoadingBar_L` and other are the names of textures defined in the `SCSmShellUserInterface512.ini`
file. The `NoImage` entries must still be included in their correct slots, even if there is no specific texture for that
part of the control.

> [!IMPORTANT]
> Each control has it's own way of setting up `DRAWDATA`, for example, a `LoadingBar_Progress` must have the progress
> bar texture in slot 7, so if you try to use that slot for anything else, the progress bar will not be shown.
> [!IMPORTANT] Each control has it's own way of setting up `DRAWDATA`, for example, a `LoadingBar_Progress` must have
> the progress bar texture in slot 7, so if you try to use that slot for anything else, the progress bar will not be
> shown.

It's important to use the example for each specific control and keep the textures on the exact slot,
so the rendering will be correct, or you may cause the game to crash.
It's important to use the example for each specific control and keep the textures on the exact slot, so the rendering
will be correct, or you may cause the game to crash.

## Creating and Modifying Textures

Expand All @@ -125,28 +124,28 @@ You can create new textures or modify existing ones by editing the `.tga` files
### Step-by-Step Guide

1. **Edit the `.tga` File:**
- Open the TGA file (`SCSmShellUserInterface512_001.tga`) with an image editor that supports TGA files (e.g.,
Photoshop, GIMP).
- Add or modify the textures as needed.
- Make sure the new textures do not overlap with existing ones.

> [!NOTE]
> While TGA has been the traditional format, for Patch 1.04p development, support for formats like PSD or TIFF has
> been added. These formats allow saving layers and greatly simplify editing.
- Open the TGA file (`SCSmShellUserInterface512_001.tga`) with an image editor that supports TGA files (e.g.,
Photoshop, GIMP).
- Add or modify the textures as needed.
- Make sure the new textures do not overlap with existing ones.

> [!NOTE] While TGA has been the traditional format, for Patch 1.04p development, support for formats like PSD or
> TIFF has been added. These formats allow saving layers and greatly simplify editing.

2. **Update the Mapping INI File:**
- Open the corresponding INI file (`SCSmShellUserInterface512.ini`).
- For each new texture, create a new `MappedImage` entry, as shown above, using a unique `TextureName`, the correct
filename, `TextureWidth`, `TextureHeight` and the precise coordinates (`Coords`) of the new texture within the
edited TGA file.
- If you modified an existing texture, update its `Coords` values accordingly.

> [!NOTE]
> It is also possible to use DDS files in DXT1 or DXT5 formats and reference them in the WND file.
- Open the corresponding INI file (`SCSmShellUserInterface512.ini`).
- For each new texture, create a new `MappedImage` entry, as shown above, using a unique `TextureName`, the correct
filename, `TextureWidth`, `TextureHeight` and the precise coordinates (`Coords`) of the new texture within the
edited TGA file.
- If you modified an existing texture, update its `Coords` values accordingly.

> [!NOTE] It is also possible to use DDS files in DXT1 or DXT5 formats and reference them in the WND file.

3. **Test Your Changes:**
- Save both the edited TGA and INI files.
- Launch the game and check that the changes to the UI are applied correctly.
- Save both the edited TGA and INI files.
- Launch the game and check that the changes to the UI are applied correctly.

### Important Notes

Expand All @@ -156,12 +155,11 @@ You can create new textures or modify existing ones by editing the `.tga` files
if you are not using such a system, it's recommended to always back up the original files before editing.
- **DDS:** Consider using DDS files in DXT1 or DXT5 formats for textures, which can be referenced in the WND files.
- **TGA Format:** If you choose to use the TGA format, save your images as a 32-bit uncompressed TGA file.
- Note that texture loading in the engine is handled specially. At runtime, the engine will first attempt to
load the texture with the `.dds` extension (e.g., `Texture.dds`). If it doesn't find the DDS file, it will
then try to load the same texture with the `.tga` extension (e.g., `Texture.tga`). This process occurs regardless
of whether the input name is `.tga` or `.dds`. Therefore, if a reference exists for `Texture.tga` but
only `Texture.dds` is present, the engine will still successfully load the texture, as it prioritizes `.dds` first
and falls back to `.tga` if necessary.
- Note that texture loading in the engine is handled specially. At runtime, the engine will first attempt to load the
texture with the `.dds` extension (e.g., `Texture.dds`). If it doesn't find the DDS file, it will then try to load the
same texture with the `.tga` extension (e.g., `Texture.tga`). This process occurs regardless of whether the input name
is `.tga` or `.dds`. Therefore, if a reference exists for `Texture.tga` but only `Texture.dds` is present, the engine
will still successfully load the texture, as it prioritizes `.dds` first and falls back to `.tga` if necessary.

## See Also

Expand Down
32 changes: 32 additions & 0 deletions Mairmaid_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Go to /Mairmaid_example -->

## Example 1

```mermaid
flowchart LR
Start --> Stop
```

## Example 2

```mermaid
mindmap
root((mindmap))
Origins
Long history
::icon(fa fa-book)
Popularisation
British popular psychology author Tony Buzan
Research
On effectiveness<br/>and features
On Automatic creation
Uses
Creative techniques
Strategic planning
Argument mapping
Tools
Pen and paper
Mermaid
```

### More info [here](https://emersonbottero.github.io/vitepress-plugin-mermaid/)
Loading