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

New Tutorials for splashkit - Local Network Programs that Connect #157

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

breezy-codes
Copy link

Description

This pull request contains 2 new guides created for Splashkit, the first is based on creating two programs that can communicate, and the second being adding in messaging capabilities on one side. The goal of these is that they can be extended in numerous ways. Such as for games or local both way chat applications and many other things.

They are kept quite basic on purpose with the goal for the person trying it out to think on how they could take this for their own projects.

Type of change

  • Two New Tutorials

Tests

Ran the following checks to ensure the tutorials don't cause any issues.

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

Code Checks

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Folders and Files Added/Modified

Files changed:

  • Added:
    • src/content/docs/guides/Networking/3-connecting-programs
    • src/content/docs/guides/Networking/4-messaging-application

Programs Running for Tutorial 1

C++

starter cpp

C#

image

Python

starter python

Programs Running for Tutorial 2

C++

program running

C#

image

Python

program running

Copy link

netlify bot commented Aug 26, 2024

Deploy Preview for splashkit-io ready!

Name Link
🔨 Latest commit 623c19c
🔍 Latest deploy log https://app.netlify.com/sites/splashkit-io/deploys/66cbdec9d955900008e83449
😎 Deploy Preview https://deploy-preview-157--splashkit-io.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@Liquidscroll Liquidscroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tutorials look really good! I particularly like your 'Expanding your Horizons' aside and how you transition into a practical example in 'Build a Messaging Application'.

There are 2 small issues with this:

  1. Neither of the images at the bottom of the tutorials display for me, do these still have to be added?

  2. The use of while(true) in the server programs. My issue here is that you can't break out of that while loop without using an interrupt signal (CTRL-C) to exit; this leads to the connection failing to close and if you run the server again at this point it won't be able to connecting with the client without first specifically closing all connections.

One way to change this would be to build a simple graphical application to control the server, like this:

// existing code

open_window("Server Interface", 150, 100);
while(!quit_requested())
{
    process_events();
    clear_screen(COLOR_WHITE);
    if(button("Close Server", rectangle_from(25, 25, 100, 50)))
    {
        break;
    }
    
    // existing code
    
    draw_interface();
    refresh_screen();
}

close_all_windows();

// existing code

This will provide a way for the user to safely exit the program, and it will create a window like this:
image

I wouldn't necessarily explain this code within this tutorial either, I'd probably put in an aside in the first tutorial and link to the interface tutorial if the reader wants more information.

I hope this all makes sense!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants