Skip to content

Commit

Permalink
Merge pull request #96 from breezy-codes/fixing-tutorial-style-guide
Browse files Browse the repository at this point in the history
Fixing Tutorial Style Guide
  • Loading branch information
omckeon authored Sep 5, 2024
2 parents fd6eca1 + f061e10 commit 704e9b4
Showing 1 changed file with 205 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,38 @@ to copy.

Always include a language with the fenced code blocks.

### C++ Code

For C++, you would use the following format:

````md
```cpp
#include "splashkit.h"

int main()
{
open_window("Window Title... to change", 800, 600);
delay(5000);
close_all_windows();
return 0;
}
```
````

Which would produce:

```cpp
#include "splashkit.h"

int main()
{
open_window("Window Title... to change", 800, 600);
delay(5000);
close_all_windows();
return 0;
}
```

### C# Code

For example, if using C#, you would use the following format:
Expand All @@ -95,11 +127,8 @@ For example, if using C#, you would use the following format:
```csharp
using static SplashKitSDK.SplashKit;

OpenWindow("SplashKit!", 800, 600);
ClearScreen();
RefreshScreen();
OpenWindow("Window Title... to change", 800, 600);
Delay(5000);

CloseAllWindows();
```
````
Expand All @@ -109,52 +138,33 @@ Which would produce:
```csharp
using static SplashKitSDK.SplashKit;

OpenWindow("SplashKit!", 800, 600);
ClearScreen();
RefreshScreen();
OpenWindow("Window Title... to change", 800, 600);
Delay(5000);

CloseAllWindows();
```

### C++ Code
### Python Code

For C++, you would use the following format:
For Python, you would use the following format:

````md
```cpp
#include "splashkit.h"
```python
from splashkit import *

int main()
{
open_window("SplashKit!", 800, 600);
clear_screen();
refresh_screen();
delay(5000);

close_all_windows();

return 0;
}
open_window("Window Title... to change", 800, 600)
delay(5000)
close_all_windows()
```
````

Which would produce:

```cpp
#include "splashkit.h"

int main()
{
open_window("SplashKit!", 800, 600);
clear_screen();
refresh_screen();
delay(5000);

close_all_windows();
```python
from splashkit import *

return 0;
}
open_window("Window Title... to change", 800, 600)
delay(5000)
close_all_windows()
```

For any blocks that are not code, you can use `plaintext` for the language. For terminal commands,
Expand All @@ -179,79 +189,199 @@ import { Tabs, TabItem } from "@astrojs/starlight/components";
And then using the examples from above, you would have:

````md
<Tabs>
<TabItem label="C#">
<Tabs syncKey="code-language">
<TabItem label="C++">

```cpp
#include "splashkit.h"

int main()
{
string name; // declare a variable to store the name
string quest; // and another to store a quest

write("What is your name: "); // prompt the user for input
name = read_line(); // read user input

// read in another value
write("And what is your quest? ");
quest = read_line();

write_line(name + "'s quest is: " + quest); // output quest to the terminal

return 0;
}
```

</TabItem>
<TabItem label="C#">

<Tabs syncKey="csharp-style">
<TabItem label="Top-level Statements">

```csharp
using static SplashKitSDK.SplashKit;

OpenWindow("SplashKit!", 800, 600);
ClearScreen();
RefreshScreen();
Delay(5000);
string name; // declare a variable to store the name
string quest; // and another to store a quest

CloseAllWindows();
Write("What is your name: "); // prompt the user for input
name = ReadLine(); // read user input

// Read in another value
Write("And what is your quest? ");
quest = ReadLine();

WriteLine(name + "'s quest is: " + quest); // output quest to the terminal
```

</TabItem>
<TabItem label="Object-Oriented">

```csharp
using SplashKitSDK;

namespace ReadingText
{
public class Program
{
public static void Main()
{
string name; // declare a variable to store the name
string quest; // and another to store a quest

SplashKit.Write("What is your name: "); // prompt the user for input
name = SplashKit.ReadLine(); // read user input

// Read in another value
SplashKit.Write("And what is your quest? ");
quest = SplashKit.ReadLine();

SplashKit.WriteLine(name + "'s quest is: " + quest); // output quest to the terminal
}
}
}
```

</TabItem>
<TabItem label="C++">
</TabItem>
</Tabs>

</TabItem>
<TabItem label="Python">

```python
from splashkit import *

write("What is your name: ") # prompt the user for input
name = read_line() # read user input and store in a variable

# Read in another value
write("And what is your quest? ")
quest = read_line()

write_line(name + "'s quest is: " + quest)
```

</TabItem>
</Tabs>
````

Which would produce the following:

<Tabs syncKey="code-language">
<TabItem label="C++">

```cpp
#include "splashkit.h"

int main()
{
open_window("SplashKit!", 800, 600);
clear_screen();
refresh_screen();
delay(5000);
string name; // declare a variable to store the name
string quest; // and another to store a quest

close_all_windows();
write("What is your name: "); // prompt the user for input
name = read_line(); // read user input

// read in another value
write("And what is your quest? ");
quest = read_line();

write_line(name + "'s quest is: " + quest); // output quest to the terminal

return 0;
}
```

</TabItem>
</Tabs>
````

Which would produce the following:
</TabItem>
<TabItem label="C#">

<Tabs>
<TabItem label="C#">
<Tabs syncKey="csharp-style">
<TabItem label="Top-level Statements">

```csharp
using static SplashKitSDK.SplashKit;

OpenWindow("SplashKit!", 800, 600);
ClearScreen();
RefreshScreen();
Delay(5000);
string name; // declare a variable to store the name
string quest; // and another to store a quest
CloseAllWindows();
Write("What is your name: "); // prompt the user for input
name = ReadLine(); // read user input
// Read in another value
Write("And what is your quest? ");
quest = ReadLine();

WriteLine(name + "'s quest is: " + quest); // output quest to the terminal
```

</TabItem>
<TabItem label="C++">
</TabItem>
<TabItem label="Object-Oriented">

```cpp
#include "splashkit.h"
```csharp
using SplashKitSDK;

int main()
namespace ReadingText
{
open_window("SplashKit!", 800, 600);
clear_screen();
refresh_screen();
delay(5000);
public class Program
{
public static void Main()
{
string name; // declare a variable to store the name
string quest; // and another to store a quest
SplashKit.Write("What is your name: "); // prompt the user for input
name = SplashKit.ReadLine(); // read user input
// Read in another value
SplashKit.Write("And what is your quest? ");
quest = SplashKit.ReadLine();

SplashKit.WriteLine(name + "'s quest is: " + quest); // output quest to the terminal
}
}
}
```

close_all_windows();
</TabItem>
</Tabs>

return 0;
}
</TabItem>
<TabItem label="Python">

```python
from splashkit import *

write("What is your name: ") # prompt the user for input
name = read_line() # read user input and store in a variable

# Read in another value
write("And what is your quest? ")
quest = read_line()

write_line(name + "'s quest is: " + quest)
```

</TabItem>
</TabItem>
</Tabs>

## Callouts (Asides)
Expand Down

0 comments on commit 704e9b4

Please sign in to comment.