Java - Libgdx : Save & Load a screen - libgdx

my game is about stories, you make choices and it will lead you to other screen like a novel in which you are the hero, I realised I need a save system, I want to save the last screen a player was on and load it when he click on load button in main menu :
like this
I found the class FileHandle but I don't know how to link it with my gamescreens. How am I supposed to code "save the last screen the player is on" and "load the last screen the player was on"
Thanks for your knowledge sharing

You should have a look at the libGDX wiki.
Specifically:
File Handling
and
Preferences
If you only need to save the last page the user was on, Preferences might be your best option. You can easily save primitive data types, such as the index of the last screen, or the title, or however you have your content set up.

use the Preference to save the game state in libgdx . which will store the data in devices internal memory. by using the preference you can save anything say example the score of the player. I have answered for the same kind of question in below link .please go through it once. I hope you will get the solution.
Creating an Android save file on the local storage of the device?

Related

Creating a Picture Log with HTML index

I have a large hard drive full of photos/videos all organized into folders by events or years, which works for me. However, I want a way to just view them all in total just organized by date. Is there any way to easily code it into some sort of an HTML index that takes all the pictures without having to manually write the source to each picture. (Im not planning on hosting it or anything)
I assume this can't happen, so is there an easy way/program to grab all photos/videos from folders within folders and paste them all into one folder?
You didn't tell us which OS you are using. I will show you the way under Windows10.
open an explorer-window
move to the root-directory of your photos/videos
in the upper right there is a search-window.
lets presume your videos have the format mp4. Enter *.mp4 and press [enter]
you will get all videos including all videos in your sub-directorties in one plain list
press [ctrl]-a (this will select all videos), [ctrl]-c (copy all videos) or [ctrl]-x (mark all for deletion), move to the new spot in your directory-structure and press [ctrl]-v (copies all selected videos to this spot).
Alternatively you can open a second explorer-window, move to the new spot and move all videos with your mouse from one window to the other. Please note that it may take some time for the OS to do the work if the amount of files is real big.
repeat this for all video- and picture-formats.
That way you need no programming at all.
It can easily be done in linux too but I don't have the correct commands at hand at the moment. HTH.

Game show buzzer screens

I'm doing a training class right now and one of the games I plan on doing is a Jeopardy style of Q & A. The problem I'm trying to figure out is the buzzer. My idea is to use the projector as the question board I control. The trainees would go to an HTML page with nothing more than a single button. They would turn their monitors around to face me up front. As soon as I read the question they would click the button and it would change their screens the color red.
The button and background color change is easy enough, I got that. There are two problems I'm facing: 1) I need it so that they can't click the button until I'm done reading the question - this one isn't as important, I can just make up a rule. 2) Only the fastest person will have a red screen. To show me who clicked first. The others' buttons will be disabled.
I just have no idea how to even Google these two things. Like: "Disable button for other users"...? Or maybe, "only one click"...?
Any direction to search is appreciated. Eventually, I'd like to add other aspects to like the presenter could click an "incorrect button" then it would clear the screen and enable all the buttons again, for the answer steal.
You can do it with modern WebSocket or applications interact via TCP. However, WebSocket may be overkill for the simple application with a few teams. I faced the same problem before and developed a simple solution with PHP using Flock to write into a shared file on disk. Only request from one team gets the chance to write into that file. Stick to not to use WebSocket, the web page on client site does some polling to receive the "restart" signal from the server for the new question/round. It can run in LAN, different team gets different site, i.e. http://[server-ip]/team1, http://[server-ip]/team2.
You can have control over the round: allow them to press button/ restart, start a new question in http://[server-ip]/admin.
Further improvement can be made in several ways to facilitate your needs (i.e. assign team name, register team, use database instead of a flock file). The code is available here : https://github.com/minhhn2910/buzzergameshow

Least intrusive webcam capture in browser

I need to capture webcam images from inside browser. I am planning to use Flash but since am not experienced in it, before jumping into it, I want to ask you experts :
Will Flash ask for Webcam permission every time user refreshes the page ? Isn't there some global security setting to allow a website.
Is it essential to display the webcam feed on the browser to be able to capture it / take snapshot and upload to server. I totally don't want to show live feed on the webpage, all I want is to take snapshots and upload it in the background.
The purpose of above requirement is that we are trying to add proctoring to our online assessment platform, and hence we don't want to reload / ask for permission again every time candidate views a new test page. One alternative can be making the whole site a single page webapp, but definitely that will add quite some overhead.

create a page which contain a flash can be add text dynamiclly

I have to create a web page which can be set to full screen(I mean the real full screen,not like press the F11),in the full screen there should be some words displaying.
Take the http://stackoverflow.com for example:
Normally,it show its contents(the questions),but someday,maybe a VIP come to visit the page,so we want to replace the whole page with a welcome screen.
Of course we can replace the https://stackoverflow.com/index.html (suppose it is the index page) with the welcome text(welcome xxx to our site...) in the server side.
However this is not convenient,and the text can not be full screened.
So I thought the flash,I can add a controller button at the page,when required,I click this button,and set the welcome words,then a flash will start to play with the sepcified words in a full screen model. It would be better if the flash can show the text with a Animation.
I have never did the flash development,so I want to know if this is possible?
BTW,can all the clients change to flash with juse one click?
I mean I click the controller button,then all the client who is visit this page should see the contents replaced by the flash at the same time.
I am not sure if you guys know what I am meaning. If not,I can update more details.
I am really Anxious, Thanks. :)
Since you're starting from scratch with Flash, I made a quick example of what I think you want to do. http://clearmpls.com/temp/fullscreen/ - the source files that I made this example with can be grabbed from here: http://clearmpls.com/temp/xml-loading-fullscreen-thing.zip
I used the Flash IDE to create this. You can grab a 60-day trial from Adobe's site here: https://www.adobe.com/cfusion/tdrc/index.cfm?product=flash
This example shows examples of these functions:
- it loads an XML file with text data
- displays that data in a textfield on the stage
- gives you a button where you can toggle back and forth between fullscreen and regular
- resizes the stage and textfield based on what you have written in your XML file

Open Window that has been put in tab or other options?

I'm hoping that someone may be able to help me out.
My Home page (Home.html) has a link to a mp3player located at (mp3.html)
On the mp3player page there is a link back to Home.html
If the user clicks on the link to the Mp3 player I would like for the music to continue to play even if the link to home.html is pressed.
What I would like to avoid is having multiple tabs from being opened if the user would re-click one of these links.
Also I would like to have the appropriate page to open when it's link is pressed instead of being locked in a tab and not displaying.
The mp3 player isn't affected by being refreshed.
I would prefer not to have different tabs open if at all possible.
This really got me stumped. I've tried different things out only to either be stuck choosing a tab or loosing the music from playing.
Thank you.
You can program your site with AJAX, so index page won't be reloaded but supplemented by content loaded be demand - Google Mail is a good example. Not a task for beginner, though.
You can use HTML frames (see examples) and load index and player at the same time in one tab. Very easy and may fit your needs, but makes your site harder to link to.
I'd go with the AJAX version as well, it's a nicer user experience. If there's a player somewhere in another tab, that's pretty annoying for the user to find if he wants to turn it off or change a track. Check out the Sixtyone and how they're solving the problem.