Skip to content

Commit

Permalink
Add LoadingImage Page and Config page
Browse files Browse the repository at this point in the history
  • Loading branch information
VishalJangid123 committed Nov 26, 2023
1 parent ed0012d commit 370788f
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 72 deletions.
3 changes: 1 addition & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
distDir: "out",
defaultShowCopyCode: true
})

module.exports = {
Expand All @@ -11,6 +12,4 @@ module.exports = {
},
assetPrefix : "/imageswift-docs/",
basePath: "/imageswift-docs"

};

30 changes: 0 additions & 30 deletions pages/ImageLoading.mdx

This file was deleted.

62 changes: 62 additions & 0 deletions pages/LoadingImages.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Loading images to component using ImageSwift

## Overview

In **ImageSwift**, loading images into Unity GameObjects and sprites is a straightforward process. This section provides guidance on using the library to dynamically load and display images within your Unity project.

```csharp filename="C#"
ImageSwift.Load(string: url).Into(targetComponent);
```

Learn more about these functions down.

### `Load()`

The `Load` function is the starting point for fetching an image in ImageSwift. It is a static method that returns an instance of the `ImageSwift` class, allowing you to chain additional methods for customization.

#### Syntax:

```csharp filename="C#"
ImageSwift.Load(string url);
```

Parameter
`url` (string): The URL of the image to be loaded.

##### Example:
```csharp filename="C#"
ImageSwift.Load("https://example.com/image.jpg");
```
This initiates the process of loading the image from the specified URL.

### `Into()`
The Into function is used to specify the target where the loaded image should be applied. It supports various Unity components, allowing you to display images in different contexts.

##### Example:
```csharp filename="C#"
ImageSwift Into(GameObject gameObject);
ImageSwift Into(SpriteRenderer spriteRenderer);
ImageSwift Into(RawImage rawImage);
ImageSwift Into(Image uiImage);
ImageSwift Into(Sprite sprite);
```

Examples:
```csharp filename="C#"
// Loading into a SpriteRenderer
ImageSwift.Load("https://example.com/image.jpg").Into(spriteRenderer);

// Loading into a RawImage
ImageSwift.Load("https://example.com/image.jpg").Into(rawImageGameObject);

// Loading into a Unity UI Image
ImageSwift.Load("https://example.com/image.jpg").Into(uiImage);

// Loading into a sprite
ImageSwift.Load("https://example.com/image.jpg").Into(sprite);

```
This determines where the loaded image should be displayed based on the specified target.

ImageSwift provides callbacks for certain events learn about them more [here](/callback).

5 changes: 3 additions & 2 deletions pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"index": "Introduction",
"ImageLoading": "Image loading using ImageSwift",
"advanced": "Advanced (A Folder)",
"installation": "Add ImageSwift To Unity",
"LoadingImages": "Loading images",
"configuration": "Configuration",
"about": {
"title": "About",
"type": "page"
Expand Down
3 changes: 0 additions & 3 deletions pages/advanced.mdx

This file was deleted.

3 changes: 0 additions & 3 deletions pages/advanced/satori.mdx

This file was deleted.

31 changes: 0 additions & 31 deletions pages/another.mdx

This file was deleted.

28 changes: 28 additions & 0 deletions pages/configuration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ImageSwift Configuration

## Overview

**ImageSwift** provides a flexible configuration system that allows users to customize the behavior and settings of the library according to their project requirements. This section covers the configuration options available and how to use them effectively.

## Configuration File

### Creating a Configuration File

To create a configuration file for `ImageSwift`, follow these steps:

1. **Create a ScriptableObject:**

Create a new C# script that extends `ScriptableObject` to represent the configuration. For example:

```csharp
using UnityEngine;

[CreateAssetMenu(fileName = "ImageSwiftConfig", menuName = "ImageSwift/ImageSwiftConfig")]
public class ImageSwiftConfig : ScriptableObject
{
// Configuration options go here
public int MaxConcurrentDownloads = 5;
public int CompressionQuality = 75;
public bool UseCustomHeaders = false;
// Add more configuration options as needed
}
2 changes: 1 addition & 1 deletion pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

**ImageSwift** is a versatile Unity library that simplifies the process of loading and downloading images in Unity projects. It offers an easy-to-use API for handling image operations, including downloading images from URLs, caching, and applying them to Unity sprites.
**ImageSwift** is a versatile Unity library that simplifies the process of loading and downloading images in Unity projects. It offers an easy-to-use API for handling image operations, including downloading images from URLs, caching, and applying them to Unity UI components.

## Getting Started

Expand Down
1 change: 1 addition & 0 deletions pages/installation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Add ImageSwift to your Unity project

0 comments on commit 370788f

Please sign in to comment.