Skip to content
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
52 changes: 52 additions & 0 deletions public/usage-examples/interface/reset_layout-1-example-oop.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using SplashKitSDK;

namespace ResetLayoutExample
{
public class Program
{
public static void Main()
{
SplashKit.OpenWindow("Resetting Interface Layout", 800, 600);

SplashKit.SetInterfaceStyle(InterfaceStyle.ShadedLightStyle);

while (!SplashKit.QuitRequested())
{
SplashKit.ProcessEvents();

SplashKit.ClearScreen(Color.White);

if (SplashKit.StartPanel("Layout Reset Demo", SplashKit.RectangleFrom(40, 40, 500, 400)))
{
SplashKit.StartCustomLayout();

SplashKit.LabelElement("Before reset");

SplashKit.SplitIntoColumns(3);
SplashKit.SetLayoutHeight(64);

SplashKit.Button("One");
SplashKit.Button("Two");
SplashKit.Button("Three");

// Resetting returns the interface to the default single-column layout.
SplashKit.ResetLayout();

SplashKit.LabelElement("Default Layout After Reset");

SplashKit.Button("Default Layout 1");
SplashKit.Button("Default Layout 2");
SplashKit.Button("Default Layout 3");

SplashKit.EndPanel("Layout Reset Demo");
}

SplashKit.DrawInterface();

SplashKit.RefreshScreen(60);
}

SplashKit.CloseAllWindows();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using SplashKitSDK;
using static SplashKitSDK.SplashKit;

OpenWindow("Resetting Interface Layout", 800, 600);

SetInterfaceStyle(InterfaceStyle.ShadedLightStyle);

while (!QuitRequested())
{
ProcessEvents();

ClearScreen(Color.White);

if (StartPanel("Layout Reset Demo", RectangleFrom(40, 40, 500, 400)))
{
StartCustomLayout();

LabelElement("Before reset");

SplitIntoColumns(3);
SetLayoutHeight(64);

Button("One");
Button("Two");
Button("Three");

// Resetting returns the interface to the default single-column layout.
ResetLayout();

LabelElement("Default Layout After Reset");

Button("Default Layout 1");
Button("Default Layout 2");
Button("Default Layout 3");

EndPanel("Layout Reset Demo");
}

DrawInterface();

RefreshScreen(60);
}

CloseAllWindows();
48 changes: 48 additions & 0 deletions public/usage-examples/interface/reset_layout-1-example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include "splashkit.h"

int main()
{
open_window("Resetting Interface Layout", 800, 600);

set_interface_style(SHADED_LIGHT_STYLE);

while (!quit_requested())
{
process_events();

clear_screen(COLOR_WHITE);

if (start_panel("Layout Reset Demo", rectangle_from(40, 40, 500, 400)))
{
start_custom_layout();

label_element("Before reset");

split_into_columns(3);
set_layout_height(64);

button("One");
button("Two");
button("Three");

// Resetting returns the interface to the default single-column layout.
reset_layout();

label_element("Default Layout After Reset");

button("Default Layout 1");
button("Default Layout 2");
button("Default Layout 3");

end_panel("Layout Reset Demo");
}

draw_interface();

refresh_screen(60);
}

close_all_windows();

return 0;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions public/usage-examples/interface/reset_layout-1-example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from splashkit import *

open_window("Resetting Interface Layout", 800, 600)

set_interface_style(SHADED_LIGHT_STYLE)

while not quit_requested():
process_events()

clear_screen(COLOR_WHITE)

if start_panel("Layout Reset Demo", rectangle_from(40, 40, 500, 400)):
start_custom_layout()

label_element("Before reset")

split_into_columns(3)
set_layout_height(64)

button("One")
button("Two")
button("Three")

# Resetting returns the interface to the default single-column layout.
reset_layout()

label_element("Default Layout After Reset")

button("Default Layout 1")
button("Default Layout 2")
button("Default Layout 3")

end_panel("Layout Reset Demo")

draw_interface()

refresh_screen(60)

close_all_windows()
1 change: 1 addition & 0 deletions public/usage-examples/interface/reset_layout-1-example.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resetting Interface Layout
27 changes: 27 additions & 0 deletions scripts/json-files/usage-example-references.json
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,33 @@
]
}
],
"interface": [
{
"funcKey": "reset_layout",
"title": "Resetting Interface Layout",
"url": "/api/interface/#reset-layout",
"functions": [
"open_window",
"set_interface_style",
"quit_requested",
"process_events",
"clear_screen",
"color_white",
"start_panel",
"rectangle_from",
"start_custom_layout",
"label_element",
"split_into_columns",
"set_layout_height",
"button",
"reset_layout",
"end_panel",
"draw_interface",
"refresh_screen",
"close_all_windows"
]
}
],
"networking": [
{
"funcKey": "dec_to_hex",
Expand Down