Skip to main content

Posts

Showing posts with the label Example

Creating 2d games with golang and gontuz/prototype

Golang was created as server language. But with the time and curiosity of people, golang has covered GUI application and game development as well. I am sharing here one of the available golang library, on top of which you can create 2d games. Its gonutz/prototype . Sample video Gonutz/prototype is very small and easy to learn library. It's cross-platform , that means the game your are creating in one platform will be able to run on other platforms without any change in code ( in normal case ).  This package currently supports windows , mac and linux. gonutz/prototype features Support for keyboard input Support for mouse input Support for 2d drawing Support for image and sprite-sheets Support for sound  Want to learn more about this package.  Follow my youtube video playlist "2d game development in golang" Video tutorial playlist:   https://www.youtube.com/playlist?list=PLub5C2vM5SjJIF0f561mAON7nFG2nKHD9

Upload Files to Firebase Storage with dropzone.js

Almost every file uploader I found on web are expecting url to where we want to upload file. If you are using firebase storage then you will find this awkward as you don't have any rest url where you have to upload file .  Instead, file upload handled by firestore library firebase-storage. After certain effort I found a way to use dropzone.js with firebase storage. Here is some snippet of code which you may find useful, If you are in the same situation as I am. This both function are in same file Dropzone configuration.. ( in index.js ) var myDropzone = new Dropzone( "form#dropzone" , { // Make the whole body a dropzone url : '/' , addRemoveLinks : true , method : 'put' , chunking : true , forceChunking : true , autoQueue : false , autoProcessQueue : false }); myDropzone.autoDiscover = false ; myDrop...

Simple Calc using golang and sciter-sdk

calc usin golang andsciter Last Update : 18-07-2018 Up to this, we know how to create a window, put elements inside it, get input from the user and convert them in datatype we want. We also know how to pass that converted input data to golang function and update GUI elements according to the response/ result we get from the execution of GUI element. Here I am sharing the code of calc which actually requires all of the elements we have seen in previous examples. GUI File Here  I am sharing GUI file given by Andrew as suggestions. But you can check original GUI code that I have written in case you want to curious how much this code is more optimized than the original code. main-update.html <html>     <head>                <style>                    html { background:transparent; }           div#buttons {           ...

Embed GUI Inside Your Go Code

Embed Gui (HTML) Inside Go code  In every application, you are going to need HTML for your GUI. Now it's not a good idea to put your HTML file with your executable.  Using an HTML file for GUI has two major disadvantages:  Your guy is loading from HTML file so you have to be sure about the location of your HTML file. Your HTML code is now reachable to end user with which they can play. So Safer option is to embed your HTML inside your go program. You can do this with two ways, first is go with go-rice like tools which actually makes single executable consisting of your every resource file ( which consist your HTML, CSS and even images!, but I have not used it so have no more idea about it ) The second way to embed HTML is to write your HTML inside your code as a string.  To make it more clearly see the example below. Golang File main.go package main import ( "fmt" "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" ) f...

Process Input Grabed From TIScript in Golang

process golang input in sciter In the real-world scenario, you have to get input from the user via GUI and then have to pass it down to go code for the further process. For example, let's say you are just creating a simple to-do app which takes the input of task and then stores it in the SQLite table which is handled by go code. In that case, you have to take data from the user using HTML and sciter and then have to pass that data to go code. Though the upper scenario is more real, we will go with a very simple example [ as still, we are in earlier stages ]. We will take two integer inputs from the user and then send those inputs to go function that will show the response given by code in the GUI over a label. First Lets See a working demo  Main goal of this post is to show you use of  ' view  ' in TIScript and ' DefineFunction ' function in GoLang File. So let's see the GUI File First.  GUI File First of all we will setup our input elements to get integers (...

Get Input In TIScript with sciter-sdk

What if you can not get input from the user in your application. This example is to show you how you can get user input from TIScript and process it with TIScript. Yes processing input on GUI Side. GUI File Making basic HTML layout with use of sugar syntax supported by sciter. I am using sciter syntax over defult HTML which also supported by sciter because its more consice and provieds more functionality like, we can define type of data input should accept on the tag itself so we don't have to do any datatype converions later on in TIScript.  Input tag is to get input while we will listen for click action on button. So lets just define HTML first. <html>     <head>                <style>                   </style>     </head>     <body>        <h1>Simple Input</h1>        ...