Compare commits

...

21 Commits

Author SHA1 Message Date
MCL Software
f32898f4a7 Spacing 2023-06-03 17:21:32 -04:00
MCL Software
ddba3e77af Update README.MD 2023-06-02 16:46:52 -04:00
MCL Software
7521066d5e Update README.MD 2023-06-01 17:13:01 -04:00
MCL Software
5c97c52e1d Spacing 2023-05-31 15:33:05 -04:00
MCL Software
48d18cfe99 Minor changes 2023-05-30 16:05:55 -04:00
ddac2429b1 Updated .gitignore 2022-10-26 17:10:44 -04:00
dd8c51df2e Updated Android icon 2022-10-26 17:10:19 -04:00
23a66800ef Updated the Android build files 2022-10-23 18:30:28 -04:00
78fb1bc302 More main menu tweaks 2022-10-22 15:28:25 -04:00
f15b796344 Update bg.png 2022-10-22 15:27:59 -04:00
5bf89170b5 Updated clientlauncher.cpp 2022-10-22 15:27:46 -04:00
56340e0826 Update README.MD 2022-10-22 15:27:21 -04:00
8bbc7b6b1f Capitalize LICENSE.TXT 2022-10-22 15:27:09 -04:00
a820a06bfa Title menu improvements 2022-10-09 15:10:52 -04:00
78b702ecf5 C:/Program Files/Git/misc/ pt3 2022-10-09 15:04:37 -04:00
0967e1f364 Files in /misc/ pt2 2022-10-09 15:04:20 -04:00
93fe67ad9f Files in /misc/ 2022-10-09 15:02:27 -04:00
2db7449ded Update CMakeLists.txt 2022-10-09 14:58:41 -04:00
81e67359f0 Title menu revisions 2022-10-09 14:58:24 -04:00
MCL Software
5744acae16 Another readme revision 2022-10-09 11:43:41 -04:00
766bcbac55 Revised the redame 2022-10-09 11:30:23 -04:00
33 changed files with 970 additions and 518 deletions

119
.gitignore vendored Normal file
View File

@@ -0,0 +1,119 @@
## Editors and development environments
*~
*.swp
*.bak*
*.orig
.DS_Store
# Vim
*.vim
# Kate
.*.kate-swp
.swp.*
# KDevelop4
.kdev4/
*.kdev4
# Eclipse (CDT and LDT)
.project
.cproject
.settings/
.buildpath
.metadata
# GNU Global
tags
!tags/
gtags.files
.idea
# Codelite
*.project
# Visual Studio Code & plugins
.vscode/
build/.cmake/
# Gradle
.gradle
## Files related to Minetest development cycle
/*.patch
*.diff
# GNU Patch reject file
*.rej
## Non-static Minetest directories or symlinks to these
/bin/
/games/*
!/games/devtest/
/cache
/textures/*
!/textures/base/
/screenshots
/sounds
/mods/*
!/mods/minetest/
/mods/minetest/*
!/mods/minetest/mods_here.txt
/worlds
/world/
/clientmods/*
!/clientmods/preview/
/client/mod_storage/
## Configuration/log files
minetest.conf
debug.txt
debug.txt.1
## Other files generated by Minetest
screenshot_*.png
testbm.txt
## Doxygen files
doc/Doxyfile
doc/html/
doc/doxygen_*
## MkDocs files
public/
doc/mkdocs/docs/*.md
doc/mkdocs/mkdocs.yml
## Build files
build/
CMakeFiles
Makefile
cmake_install.cmake
CMakeCache.txt
CPackConfig.cmake
CPackSourceConfig.cmake
src/test_config.h
src/cmake_config.h
src/cmake_config_githash.h
src/unittest/test_world/world.mt
games/devtest/mods/testnodes/textures/testnodes_generated_*.png
/locale/
.directory
*.cbp
*.layout
*.o
*.a
*.ninja
.ninja*
*.gch
*.iml
test_config.h
cmake-build-debug/
cmake-build-release/
cmake_config.h
cmake_config_githash.h
CMakeDoxy*
compile_commands.json
*.apk
*.zip
# Visual Studio
*.vcxproj*
*.sln
.vs/
# Optional user provided library folder
lib/irrlichtmt
# Generated mod storage database
client/mod_storage.sqlite

View File

@@ -17,7 +17,7 @@ set(GCC_MINIMUM_VERSION "5.1")
set(CLANG_MINIMUM_VERSION "3.5")
# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
set(VERSION_MAJOR 6)
set(VERSION_MAJOR 8)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
set(VERSION_EXTRA "pre-release 1" CACHE STRING "Stuff to append to version string")
@@ -260,16 +260,16 @@ install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
if(UNIX AND NOT APPLE)
install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}")
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
install(FILES "misc/minetest-xorg-icon-128.png"
install(FILES "misc/info.sovnat.xtreemtest.desktop" DESTINATION "${XDG_APPS_DIR}")
install(FILES "misc/info.sovnat.xtreemtest.appdata.xml" DESTINATION "${APPDATADIR}")
install(FILES "misc/xtreemtest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
install(FILES "misc/xtreemtest-xorg-icon-128.png"
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
RENAME "minetest.png")
RENAME "xtreemtest.png")
endif()
if(APPLE)
install(FILES "misc/minetest-icon.icns" DESTINATION "${SHAREDIR}")
install(FILES "misc/xtreemtest-icon.icns" DESTINATION "${SHAREDIR}")
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
endif()

191
README.MD
View File

@@ -1,47 +1,38 @@
~~Minetest~~ XtreemTest
========
### "It's just not a game anymore!"
XtreemTest
==========
### "It's like MineTest, but more XTREEM!"
Fork of Minetest, a free-as-in-freedom voxel game engine with easy modding and game creation.
Copyright (C) 2010-2022 Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2021-2022 Migdyn <xtreemsex@testing.cubesoftware.xyz>
Copyright (C) 2021-2022 Migdyn <temp1@cubesoftware.xyz>
and contributors (see source file comments and the version control log of the original Minetest repository, which can be found [here](https://github.com/minetest/minetest).
## IMPORTANT NOTE: This readme file and other documentation might be outdated or irrelevant, as it was taken directly from the original Minetest code.
In case you downloaded the source code
--------------------------------------
If you downloaded the Minetest Engine source code in which this file is
contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/)
project too. See its README.txt for more information.
Table of Contents
------------------
1. [Further Documentation](#further-documentation)
2. [Default Controls](#default-controls)
3. [Paths](#paths)
4. [Configuration File](#configuration-file)
5. [Command-line Options](#command-line-options)
6. [Compiling](#compiling)
7. [Docker](#docker)
1. [Our goal](#our-goal)
2. [Further Documentation](#further-documentation)
3. [Default Controls](#default-controls)
4. [Paths](#paths)
5. [Configuration File](#configuration-file)
6. [Command-line Options](#command-line-options)
7. [Compiling](#compiling)
8. [Version Scheme](#version-scheme)
Our goal
---------
Our goal is to create a positive and censorship-free community around MineTest,
improve upon the MineTest engine by adding new features to it, as well as integrated
Google AdMob into the engine.
Further documentation
----------------------
- Website: https://minetest.net/
- Wiki: https://wiki.minetest.net/
- Developer wiki: https://dev.minetest.net/
- Forum: https://forum.minetest.net/
- GitHub: https://github.com/minetest/minetest/
- Website: https://mcl.sovnat.info
- phpBB forums: https://bb.cubesoftware.xyz
- GitHub: https://github.com/MCLx86/xtreemtest/
- [doc/](doc/) directory of source distribution
Default controls
@@ -102,17 +93,17 @@ Where each location is on each platform:
* `share` = `.`
* `user` = `.`
* Windows installed:
* `bin` = `C:\Program Files\Minetest\bin (Depends on the install location)`
* `share` = `C:\Program Files\Minetest (Depends on the install location)`
* `user` = `%APPDATA%\Minetest`
* `bin` = `C:\Program Files\XtreemTest\bin (Depends on the install location)`
* `share` = `C:\Program Files\XtreemTest (Depends on the install location)`
* `user` = `%APPDATA%\XtreemTest`
* Linux installed:
* `bin` = `/usr/bin`
* `share` = `/usr/share/minetest`
* `user` = `~/.minetest`
* `share` = `/usr/share/xtreemtest`
* `user` = `~/.xtreemtest`
* macOS:
* `bin` = `Contents/MacOS`
* `share` = `Contents/Resources`
* `user` = `Contents/User OR ~/Library/Application Support/minetest`
* `user` = `Contents/User OR ~/Library/Application Support/xtreemtest`
Worlds can be found as separate folders in: `user/worlds/`
@@ -120,7 +111,7 @@ Configuration file
------------------
- Default location:
`user/minetest.conf`
- This file is created by closing Minetest for the first time.
- This file is created by closing XtreemTest for the first time.
- A specific file can be specified on the command line:
`--config <path-to-file>`
- A run-in-place build will look for the configuration file in
@@ -164,7 +155,7 @@ For Alpine users:
sudo apk add build-base cmake libpng-dev jpeg-dev libxi-dev mesa-dev sqlite-dev libogg-dev libvorbis-dev openal-soft-dev curl-dev freetype-dev zlib-dev gmp-dev jsoncpp-dev luajit-dev zstd-dev
#### Download
#### Download w/ Git
You can install Git for easily keeping your copy up to date.
If you dont want Git, read below on how to get the source without Git.
@@ -178,30 +169,20 @@ For Fedora users:
Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
git clone --depth 1 https://github.com/minetest/minetest.git
cd minetest
Download minetest_game (otherwise only the "Development Test" game is available) using Git:
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
git clone --depth 1 https://github.com/MCLx86/xtreemtest.git
cd xtreemtest
Download IrrlichtMt to `lib/irrlichtmt`, it will be used to satisfy the IrrlichtMt dependency that way:
git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
#### Download w/out Git
Download source, without using Git:
wget https://github.com/minetest/minetest/archive/master.tar.gz
wget https://github.com/MCLx86/xtreemtest/archive/master.tar.gz
tar xf master.tar.gz
cd minetest-master
Download minetest_game, without using Git:
cd games/
wget https://github.com/minetest/minetest_game/archive/master.tar.gz
tar xf master.tar.gz
mv minetest_game-master minetest_game
cd ..
mv xtreemtest-master xtreemtest
cd xtreemtest
Download IrrlichtMt, without using Git:
@@ -232,7 +213,7 @@ Run it:
- If you build a bare server you don't need to compile IrrlichtMt, just the headers suffice.
- In that case use `-DIRRLICHT_INCLUDE_DIR=/some/where/irrlichtmt/include`.
- Minetest will use the IrrlichtMt package that is found first, given by the following order:
- XtreemTest will use the IrrlichtMt package that is found first, given by the following order:
1. Specified `IRRLICHTMT_BUILD_DIR` CMake variable
2. `${PROJECT_SOURCE_DIR}/lib/irrlichtmt` (if existent)
3. Installation of IrrlichtMt in the system-specific library paths
@@ -243,8 +224,8 @@ Run it:
General options and their default values:
BUILD_CLIENT=TRUE - Build Minetest client
BUILD_SERVER=FALSE - Build Minetest server
BUILD_CLIENT=TRUE - Build the XtreemTest client
BUILD_SERVER=FALSE - Build the XtreemTest server
BUILD_UNITTESTS=TRUE - Build unittest sources
BUILD_BENCHMARKS=FALSE - Build benchmark sources
CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug)
@@ -320,25 +301,17 @@ Library specific options:
ZSTD_INCLUDE_DIR - Directory that contains zstd.h
ZSTD_LIBRARY - Path to libzstd.a/libzstd.so/ztd.lib
### Compiling on Windows using MSVC
### Building on Windows with MSYS2
### Requirements
- [Visual Studio 2015 or newer](https://visualstudio.microsoft.com)
- [MSYS2](https://visualstudio.microsoft.com)
- [CMake](https://cmake.org/download/)
- [vcpkg](https://github.com/Microsoft/vcpkg)
- [Git](https://git-scm.com/downloads)
### Compiling and installing the dependencies
### Installing the dependencies
Enter the MSYS2 MinGW-W64 CLI and use *pacman* to install the required libraries, as well as mingw32-make and gcc.
It is highly recommended to use vcpkg as package manager.
After you successfully built vcpkg you can easily install the required libraries:
```powershell
vcpkg install zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo sqlite3 freetype luajit gmp jsoncpp opengl-registry --triplet x64-windows
```
- **Don't forget about IrrlichtMt.** The easiest way is to clone it to `lib/irrlichtmt` as described in the Linux section.
- **Don't forget about IrrlichtMt.** The easiest way is to clone it to `lib/irrlichtmt`.
- `curl` is optional, but required to read the serverlist, `curl[winssl]` is required to use the content store.
- `openal-soft`, `libvorbis` and `libogg` are optional, but required to use sound.
- `luajit` is optional, it replaces the integrated Lua interpreter with a faster just-in-time interpreter.
@@ -346,35 +319,10 @@ vcpkg install zlib zstd curl[winssl] openal-soft libvorbis libogg libjpeg-turbo
There are other optional libraries, but they are not tested if they can build and link correctly.
Use `--triplet` to specify the target triplet, e.g. `x64-windows` or `x86-windows`.
### Compile Minetest
#### a) Using the vcpkg toolchain and CMake GUI
1. Start up the CMake GUI
2. Select **Browse Source...** and select DIR/minetest
3. Select **Browse Build...** and select DIR/minetest-build
4. Select **Configure**
5. Choose the right visual Studio version and target platform. It has to match the version of the installed dependencies
6. Choose **Specify toolchain file for cross-compiling**
7. Click **Next**
8. Select the vcpkg toolchain file e.g. `D:/vcpkg/scripts/buildsystems/vcpkg.cmake`
9. Click Finish
10. Wait until cmake have generated the cash file
11. If there are any errors, solve them and hit **Configure**
12. Click **Generate**
13. Click **Open Project**
14. Compile Minetest inside Visual studio.
#### b) Using the vcpkg toolchain and the commandline
Run the following script in PowerShell:
```powershell
cmake . -G"Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT=OFF -DENABLE_CURSES=OFF
cmake --build . --config Release
```
Make sure that the right compiler is selected and the path to the vcpkg toolchain is correct.
### Build XtreemTest
Start up the CMake GUI and select the root XtreemTest directory and press *Configure*, select MinGW Makefiles,
once it's done configuring click *Generate* and once that's finished go into the root directory and run mingw32-make -j[NUMBER_OF_PROCESSORS]
(replace [NUMBER_OF_PROCESSORS] with the number of processor cores you have)
### Windows Installer using WiX Toolset
@@ -406,14 +354,8 @@ brew install cmake freetype gettext gmp hiredis jpeg jsoncpp leveldb libogg libp
Download source (this is the URL to the latest of source repository, which might not work at all times) using Git:
```bash
git clone --depth 1 https://github.com/minetest/minetest.git
cd minetest
```
Download minetest_game (otherwise only the "Development Test" game is available) using Git:
```
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
git clone --depth 1 https://github.com/MCLx86/xtreemtest.git
cd xtreemtest
```
Download Minetest's fork of Irrlicht:
@@ -444,43 +386,6 @@ make install
open ./build/macos/minetest.app
```
Docker
------
We provide Minetest server Docker images using the GitLab mirror registry.
Images are built on each commit and available using the following tag scheme:
* `registry.gitlab.com/minetest/minetest/server:latest` (latest build)
* `registry.gitlab.com/minetest/minetest/server:<branch/tag>` (current branch or current tag)
* `registry.gitlab.com/minetest/minetest/server:<commit-id>` (current commit id)
If you want to test it on a Docker server you can easily run:
sudo docker run registry.gitlab.com/minetest/minetest/server:<docker tag>
If you want to use it in a production environment you should use volumes bound to the Docker host
to persist data and modify the configuration:
sudo docker create -v /home/minetest/data/:/var/lib/minetest/ -v /home/minetest/conf/:/etc/minetest/ registry.gitlab.com/minetest/minetest/server:master
Data will be written to `/home/minetest/data` on the host, and configuration will be read from `/home/minetest/conf/minetest.conf`.
**Note:** If you don't understand the previous commands please read the official Docker documentation before use.
You can also host your Minetest server inside a Kubernetes cluster. See our example implementation in [`misc/kubernetes.yml`](misc/kubernetes.yml).
Version scheme
--------------
We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`.
- Major is incremented when the release contains breaking changes, all other
numbers are set to 0.
- Minor is incremented when the release contains new non-breaking features,
patch is set to 0.
- Patch is incremented when the release only contains bugfixes and very
minor/trivial features considered necessary.
Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release,
i.e.: 5.0.0-dev is the development version leading to 5.0.0.
Prior to that we used `previous_version-dev`.
We use the MAJOR.MINOR.PATCH-INFO versioning scheme since version 8.0.0-test

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1,11 +1,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
project.ext.set("versionMajor", 5) // Version Major
project.ext.set("versionMinor", 6) // Version Minor
project.ext.set("versionMajor", 8) // Version Major
project.ext.set("versionMinor", 0) // Version Minor
project.ext.set("versionPatch", 0) // Version Patch
project.ext.set("versionExtra", "") // Version Extra
project.ext.set("versionExtra", "test") // Version Extra
project.ext.set("versionCode", 42) // Android Version Code
project.ext.set("developmentBuild", 0) // Whether it is a development build, or a release
project.ext.set("developmentBuild", 1) // Whether it is a development build, or a release
// NOTE: +2 after each release!
// +1 for ARM and +1 for ARM64 APK's, because
// each APK must have a larger `versionCode` than the previous
@@ -24,8 +24,10 @@ buildscript {
}
}
allprojects {
repositories {
allprojects
{
repositories
{
google()
jcenter()
}

View File

@@ -1,2 +1,2 @@
rootProject.name = "Minetest"
rootProject.name = "XtreemTest"
include ':app', ':native'

View File

@@ -0,0 +1,38 @@
core.async_jobs = {}
local function handle_job(jobid, serialized_retval)
local retval = core.deserialize(serialized_retval)
assert(type(core.async_jobs[jobid]) == "function")
core.async_jobs[jobid](retval)
core.async_jobs[jobid] = nil
end
if core.register_globalstep then
core.register_globalstep(function(dtime)
for i, job in ipairs(core.get_finished_jobs()) do
handle_job(job.jobid, job.retval)
end
end)
else
core.async_event_handler = handle_job
end
function core.handle_async(func, parameter, callback)
-- Serialize function
local serialized_func = string.dump(func)
assert(serialized_func ~= nil)
-- Serialize parameters
local serialized_param = core.serialize(parameter)
if serialized_param == nil then
return false
end
local jobid = core.do_async_callback(serialized_func, serialized_param)
core.async_jobs[jobid] = callback
return true
end

View File

@@ -0,0 +1,237 @@
--Minetest
--Copyright (C) 2014 sapier
--
--This program is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version.
--
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License along
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
tabview_layouts = {}
tabview_layouts.tabs = {
get = function(self, view)
local formspec = ""
if view.parent == nil then
local tsize = view.tablist[view.last_tab_index].tabsize or
{width=view.width, height=view.height}
formspec = formspec ..
string.format("size[%f,%f,%s]",tsize.width,tsize.height,
dump(view.fixed_size))
end
formspec = formspec .. self:get_header(view)
formspec = formspec ..
view.tablist[view.last_tab_index].get_formspec(
view,
view.tablist[view.last_tab_index].name,
view.tablist[view.last_tab_index].tabdata,
view.tablist[view.last_tab_index].tabsize
)
return formspec
end,
get_header = function(self, view)
local toadd = ""
for i=1,#view.tablist do
if toadd ~= "" then
toadd = toadd .. ","
end
toadd = toadd .. view.tablist[i].caption
end
return string.format("tabheader[%f,%f;%s;%s;%i;true;false]",
view.header_x, view.header_y, view.name, toadd, view.last_tab_index);
end,
handle_buttons = function(self, view, fields)
--save tab selection to config file
if fields[view.name] then
local index = tonumber(fields[view.name])
view:switch_to_tab(index)
return true
end
return false
end,
}
tabview_layouts.vertical = {
get = function(self, view)
local formspec = ""
if view.parent == nil then
local tsize = view.tablist[view.last_tab_index].tabsize or
{width=view.width, height=view.height}
formspec = formspec ..
string.format("size[%f,%f,%s]real_coordinates[true]",tsize.width+3,tsize.height,
dump(view.fixed_size))
end
formspec = formspec .. self:get_header(view)
formspec = formspec .. "container[3,0]"
formspec = formspec ..
view.tablist[view.last_tab_index].get_formspec(
view,
view.tablist[view.last_tab_index].name,
view.tablist[view.last_tab_index].tabdata,
view.tablist[view.last_tab_index].tabsize
)
formspec = formspec .. "container_end[]"
return formspec
end,
get_header = function(self, view)
local icon = view.icon
local bgcolor = view.bgcolor or "#ACACAC33"
local selcolor = view.selcolor or "#ACACAC66"
local tsize = view.tablist[view.last_tab_index].tabsize or
{width=view.width, height=view.height}
local fs = {
("box[%f,%f;%f,%f;%s]"):format(0, 0, 3, tsize.height, bgcolor)
}
if icon then
fs[#fs + 1] = "image[1,0.375;1,1;"
fs[#fs + 1] = icon
fs[#fs + 1] = "]"
end
for i = 1, #view.tablist do
local tab = view.tablist[i]
local name = "tab_" .. tab.name
local y = (i - 1) * 0.8 + 2.25
fs[#fs + 1] = "label[0.375,"
fs[#fs + 1] = tonumber(y)
fs[#fs + 1] = ";"
fs[#fs + 1] = tab.caption
fs[#fs + 1] = "]"
fs[#fs + 1] = "style["
fs[#fs + 1] = name
fs[#fs + 1] = ";border=false]"
fs[#fs + 1] = "button[0,"
fs[#fs + 1] = tonumber(y - 0.4 )
fs[#fs + 1] = ";3,0.8;"
fs[#fs + 1] = name
fs[#fs + 1] = ";]"
if i == view.last_tab_index then
fs[#fs + 1] = ("box[%f,%f;%f,%f;%s]"):format(0, y - 0.4, 3, 0.8, selcolor)
end
end
print(defaulttexturedir .. "blank.png")
return table.concat(fs, "")
end,
handle_buttons = function(self, view, fields)
for i = 1, #view.tablist do
local tab = view.tablist[i]
if fields["tab_" .. tab.name] then
view:switch_to_tab(i)
return true
end
end
return false
end,
}
tabview_layouts.mainmenu = {
backtxt = (defaulttexturedir or "") .. "back.png",
get = function(self, view)
local tab = view.tablist[view.last_tab_index]
if tab then
return self:get_with_back(view, tab)
else
return self:get_main_buttons(view)
end
end,
get_with_back = function(self, view, tab)
local backtxt = view.backtxt or self.backtxt
local formspec = ""
if view.parent == nil then
local tsize = tab.tabsize or
{width=view.width, height=view.height}
formspec = formspec ..
string.format("size[%f,%f,%s]real_coordinates[true]",tsize.width,tsize.height,
dump(view.fixed_size))
end
formspec = formspec ..
"style[main_back;noclip=true;border=false]image_button[-1.25,0;1,1;" .. backtxt .. ";main_back;]" ..
tab.get_formspec(
view,
view.tablist[view.last_tab_index].name,
view.tablist[view.last_tab_index].tabdata,
view.tablist[view.last_tab_index].tabsize
)
return formspec
end,
get_main_buttons = function(self, view)
local icon = view.icon
local bgcolor = view.bgcolor or "#ACACAC33"
local selcolor = view.selcolor or "#ACACAC66"
local tsize = { width = 3, height = #view.tablist - 0.2}
local fs = {
("size[%f,%f]"):format(tsize.width, tsize.height),
"real_coordinates[true]",
"bgcolor[#00000000]",
("box[%f,%f;%f,%f;%s]"):format(0, 0, 3, tsize.height, bgcolor)
}
for i = 1, #view.tablist do
local tab = view.tablist[i]
local name = "tab_" .. tab.name
local y = i - 1
fs[#fs + 1] = "button[0,"
fs[#fs + 1] = tonumber(y)
fs[#fs + 1] = ";3,0.8;"
fs[#fs + 1] = name
fs[#fs + 1] = ";"
fs[#fs + 1] = minetest.formspec_escape(tab.caption)
fs[#fs + 1] ="]"
end
return table.concat(fs, "")
end,
handle_buttons = function(self, view, fields)
if fields.main_back then
view:switch_to_tab(nil)
return true
end
for i = 1, #view.tablist do
local tab = view.tablist[i]
if fields["tab_" .. tab.name] then
view:switch_to_tab(i)
return true
end
end
return false
end,
}

View File

@@ -0,0 +1,26 @@
--Minetest
--Copyright (C) 2014 sapier
--
--This program is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version.
--
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License along
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
local function beta_menu_formspec()
return "size[8,2.5,true]" ..
"style[label_button;border=false]" ..
"button[0.5,0.5;7,0.5;label_button;" ..
fgettext("You have no games installed.") .. "]" ..
"button[0.5,1.5;2.5,0.5;world_create_open_cdb;" .. fgettext("Install a game") .. "]" ..
"button[5.0,1.5;2.5,0.5;world_create_cancel;" .. fgettext("Cancel") .. "]"
end

View File

@@ -39,7 +39,7 @@ local screenshot_downloaded = {}
local search_string = ""
local cur_page = 1
local num_per_page = 5
local filter_type = 1
local filter_type = -1
local filter_types_titles = {
fgettext("All packages"),
fgettext("Games"),
@@ -434,6 +434,8 @@ function install_dialog.get_formspec()
end
function install_dialog.handle_submit(this, fields)
store.filter_packages(search_string)
if fields.cancel then
this:delete()
return true
@@ -713,12 +715,13 @@ function store.filter_packages(query)
for k = 1, #keywords do
local keyword = keywords[k]
if string.find(package.name:lower(), keyword, 1, true) or
string.find(package.title:lower(), keyword, 1, true) or
string.find(package.author:lower(), keyword, 1, true) or
string.find(package.short_description:lower(), keyword, 1, true) then
if string.find(package.author:lower(), keyword, 1, true) then
return true
end
--if string.find(package.name:lower(), keyword, 1, true) or string.find(package.title:lower(), keyword, 1, true) or string.find(package.author:lower(), keyword, 1, true) or string.find(package.short_description:lower(), keyword, 1, true) then
-- return true
--end
end
return false
@@ -736,6 +739,8 @@ end
function store.get_formspec(dlgdata)
store.update_paths()
dlgdata.pagemax = math.max(math.ceil(#store.packages / num_per_page), 1)
if cur_page > dlgdata.pagemax then
cur_page = 1
@@ -899,10 +904,15 @@ function store.get_formspec(dlgdata)
formspec[#formspec + 1] = "container_end[]"
end
return table.concat(formspec, "")
end
function store.handle_submit(this, fields)
if fields.search or fields.key_enter_field == "search_string" then
search_string = fields.search_string:trim()
cur_page = 1
@@ -913,7 +923,7 @@ function store.handle_submit(this, fields)
if fields.clear then
search_string = ""
cur_page = 1
store.filter_packages("")
store.filter_packages(search_string)
return true
end

View File

@@ -17,46 +17,60 @@
mt_color_grey = "#AAAAAA"
mt_color_blue = "#6389FF"
mt_color_lightblue = "#99CCFF"
mt_color_green = "#72FF63"
mt_color_dark_green = "#25C191"
mt_color_orange = "#FF8800"
mt_color_red = "#FF3300"
--for all other colors ask sfan5 to complete his work!
local menupath = core.get_mainmenu_path()
local basepath = core.get_builtin_path()
local menustyle = core.settings:get("main_menu_style")
defaulttexturedir = core.get_texturepath_share() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
dofile(basepath .. "common" .. DIR_DELIM .. "async_event.lua")
dofile(basepath .. "common" .. DIR_DELIM .. "filterlist.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "buttonbar.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "dialog.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "tabview_layouts.lua")
dofile(basepath .. "fstk" .. DIR_DELIM .. "ui.lua")
dofile(menupath .. DIR_DELIM .. "async_event.lua")
dofile(menupath .. DIR_DELIM .. "common.lua")
dofile(menupath .. DIR_DELIM .. "pkgmgr.lua")
dofile(menupath .. DIR_DELIM .. "serverlistmgr.lua")
dofile(menupath .. DIR_DELIM .. "game_theme.lua")
dofile(menupath .. DIR_DELIM .. "textures.lua")
dofile(menupath .. DIR_DELIM .. "dlg_config_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_settings_advanced.lua")
dofile(menupath .. DIR_DELIM .. "dlg_contentstore.lua")
if menustyle ~= "simple" then
dofile(menupath .. DIR_DELIM .. "dlg_create_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_content.lua")
dofile(menupath .. DIR_DELIM .. "dlg_delete_world.lua")
dofile(menupath .. DIR_DELIM .. "dlg_register.lua")
dofile(menupath .. DIR_DELIM .. "dlg_rename_modpack.lua")
dofile(menupath .. DIR_DELIM .. "dlg_version_info.lua")
end
local tabs = {}
tabs.settings = dofile(menupath .. DIR_DELIM .. "tab_settings.lua")
tabs.content = dofile(menupath .. DIR_DELIM .. "tab_content.lua")
tabs.about = dofile(menupath .. DIR_DELIM .. "tab_about.lua")
tabs.local_game = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
tabs.play_online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
tabs.beta = dofile(menupath .. DIR_DELIM .. "tab_beta.lua")
if menustyle == "simple" then
tabs.simple_main = dofile(menupath .. DIR_DELIM .. "tab_simple_main.lua")
else
tabs.world = dofile(menupath .. DIR_DELIM .. "tab_local.lua")
tabs.online = dofile(menupath .. DIR_DELIM .. "tab_online.lua")
tabs.new_game = {
name = "new",
caption = fgettext("New Game"),
show = function(_, _, this)
local create_world_dlg = create_create_world_dlg(true)
create_world_dlg:set_parent(this)
this:hide()
create_world_dlg:show()
return true
end
}
end
--------------------------------------------------------------------------------
local function main_event_handler(tabview, event)
@@ -71,6 +85,34 @@ local function init_globals()
-- Init gamedata
gamedata.worldindex = 0
if menustyle == "simple" then
local world_list = core.get_worlds()
local world_index
local found_singleplayerworld = false
for i, world in ipairs(world_list) do
if world.name == "singleplayerworld" then
found_singleplayerworld = true
world_index = i
break
end
end
if not found_singleplayerworld then
core.create_world("singleplayerworld", 1)
world_list = core.get_worlds()
for i, world in ipairs(world_list) do
if world.name == "singleplayerworld" then
world_index = i
break
end
end
end
gamedata.worldindex = world_index
else
menudata.worldlist = filterlist.create(
core.get_worlds,
compare_worlds,
@@ -92,19 +134,20 @@ local function init_globals()
core.settings:set("menu_last_game", default_game)
end
mm_game_theme.init()
mm_texture.init()
end
-- Create main tabview
local tv_main = tabview_create("maintab", {x = 12, y = 5.4}, {x = 0, y = 0})
-- note: size would be 15.5,7.1 in real coordinates mode
local tv_main = tabview_create("maintab", {x = 15.5, y = 9}, {x = 0, y = 0}, tabview_layouts.mainmenu)
tv_main.icon = "/home/ruben/dev/minetest/games/minetest_game/menu/icon.png"
if menustyle == "simple" then
tv_main:add(tabs.simple_main)
else
tv_main:set_autosave_tab(true)
tv_main:add(tabs.beta)
tv_main:add(tabs.local_game)
tv_main:add(tabs.play_online)
tv_main:add(tabs.online)
tv_main:add(tabs.world)
end
tv_main:add(tabs.content)
tv_main:add(tabs.settings)
tv_main:add(tabs.about)
@@ -112,25 +155,19 @@ local function init_globals()
tv_main:set_global_event_handler(main_event_handler)
tv_main:set_fixed_size(false)
tv_main:set_tab(tabs.about)
-- In case the folder of the last selected game has been deleted,
-- display "Minetest" as a header
if tv_main.current_tab == "local" then
local game = pkgmgr.find_by_gameid(core.settings:get("menu_last_game"))
if game == nil then
mm_game_theme.reset()
end
local last_tab = core.settings:get("maintab_LAST")
if menustyle ~= "simple" and last_tab and tv_main.current_tab ~= last_tab then
tv_main:set_tab(last_tab)
else
tv_main:set_tab("local")
end
ui.set_default("maintab")
check_new_version()
tv_main:show()
ui.update()
core.sound_play("main_menu", true)
end
init_globals()

View File

@@ -20,7 +20,6 @@
local xtreemtest_developers = {
"Migdyn (a.k.a. Mike) <xtreemsex@testing.cubesoftware.xyz> [XtreemTest founder]",
"Looki2000",
"Kacper Kostka <kacperks@cubesoftware.xyz>",
}
local core_developers = {
@@ -165,7 +164,7 @@ return {
"style[label_button;border=false]" ..
"button[0.1,3.4;5.3,0.5;label_button;" ..
core.formspec_escape(version.project .. " " .. version.string) .. "]" ..
"button[1.5,4.1;2.5,0.8;homepage;mcl.sovnat.info]" ..
"button[0.5,4.1;4.5,0.8;homepage;mcl.sovnat.info]" ..
"scroll_container[5.5,0.1;9.5,6.9;scroll_credits;vertical;" ..
tostring(scroll_height / 1000) .. "]" .. credit_fs ..
"scroll_container_end[]"..

View File

@@ -16,199 +16,116 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
local current_game, singleplayer_refresh_gamebar
local valid_disabled_settings = {
["enable_damage"]=true,
["creative_mode"]=true,
["enable_server"]=true,
}
-- Currently chosen game in gamebar for theming and filtering
function current_game()
local function current_game()
local last_game_id = core.settings:get("menu_last_game")
local game = pkgmgr.find_by_gameid(last_game_id)
local game, index = pkgmgr.find_by_gameid(last_game_id)
return game
end
-- Apply menu changes from given game
function apply_game(game)
core.set_topleft_text(game.name)
core.settings:set("menu_last_game", game.id)
menudata.worldlist:set_filtercriteria(game.id)
mm_game_theme.update("singleplayer", game) -- this refreshes the formspec
local index = filterlist.get_current_index(menudata.worldlist,
tonumber(core.settings:get("mainmenu_last_selected_world")))
if not index or index < 1 then
local selected = core.get_textlist_index("sp_worlds")
if selected ~= nil and selected < #menudata.worldlist:get_list() then
index = selected
else
index = #menudata.worldlist:get_list()
end
end
menu_worldmt_legacy(index)
end
function singleplayer_refresh_gamebar()
local old_bar = ui.find_by_name("game_button_bar")
if old_bar ~= nil then
old_bar:delete()
end
local function game_buttonbar_button_handler(fields)
if fields.game_open_cdb then
local maintab = ui.find_by_name("maintab")
local dlg = create_store_dlg("game")
dlg:set_parent(maintab)
maintab:hide()
dlg:show()
return true
end
for _, game in ipairs(pkgmgr.games) do
if fields["game_btnbar_" .. game.id] then
apply_game(game)
return true
end
end
end
local btnbar = buttonbar_create("game_button_bar",
game_buttonbar_button_handler,
{x=-0.3,y=5.9}, "horizontal", {x=12.4,y=1.15})
for _, game in ipairs(pkgmgr.games) do
local btn_name = "game_btnbar_" .. game.id
local image = nil
local text = nil
local tooltip = core.formspec_escape(game.title)
if (game.menuicon_path or "") ~= "" then
image = core.formspec_escape(game.menuicon_path)
else
local part1 = game.id:sub(1,5)
local part2 = game.id:sub(6,10)
local part3 = game.id:sub(11)
text = part1 .. "\n" .. part2
if part3 ~= "" then
text = text .. "\n" .. part3
end
end
btnbar:add_button(btn_name, text, image, tooltip)
end
local plus_image = core.formspec_escape(defaulttexturedir .. "plus.png")
btnbar:add_button("game_open_cdb", "", plus_image, fgettext("Install games from ContentDB"))
end
local function get_disabled_settings(game)
if not game then
return {}
end
local gameconfig = Settings(game.path .. "/game.conf")
local disabled_settings = {}
if gameconfig then
local disabled_settings_str = (gameconfig:get("disabled_settings") or ""):split()
for _, value in pairs(disabled_settings_str) do
local state = false
value = value:trim()
if string.sub(value, 1, 1) == "!" then
state = true
value = string.sub(value, 2)
end
if valid_disabled_settings[value] then
disabled_settings[value] = state
else
core.log("error", "Invalid disabled setting in game.conf: "..tostring(value))
end
end
end
return disabled_settings
end
local function get_formspec(tabview, name, tabdata)
local retval = ""
local index = filterlist.get_current_index(menudata.worldlist,
tonumber(core.settings:get("mainmenu_last_selected_world")))
local list = menudata.worldlist:get_list()
local world = list and index and list[index]
local game
if world then
game = pkgmgr.find_by_gameid(world.gameid)
else
game = current_game()
end
local disabled_settings = get_disabled_settings(game)
local creative, damage, host = "", "", ""
retval = {
"container[0.375,0.375]",
"box[11,-0.375;4.125,9;#ACACAC33]",
--"field[1.75,0;5.125,0.8;query;;", query, "]",
--"button[6.875,0;1.5,0.8;search;", fgettext("Search"), "]",
"textlist[0,0;10.625,8.25;sp_worlds;", menu_render_worldlist(), ";", index, "]",
}
-- Y offsets for game settings checkboxes
local y = -0.2
local yo = 0.45
do
retval[#retval + 1] = "container[11.375,0.2]"
local enable_server = core.settings:get_bool("enable_server")
local options = {
{ name = "creative_mode", text = fgettext("Creative Mode") },
{ name = "enable_damage", text = fgettext("Enable Damage") },
{ name = "enable_server", text = fgettext("Host Server") },
}
if disabled_settings["creative_mode"] == nil then
creative = "checkbox[0,"..y..";cb_creative_mode;".. fgettext("Creative Mode") .. ";" ..
dump(core.settings:get_bool("creative_mode")) .. "]"
y = y + yo
end
if disabled_settings["enable_damage"] == nil then
damage = "checkbox[0,"..y..";cb_enable_damage;".. fgettext("Enable Damage") .. ";" ..
dump(core.settings:get_bool("enable_damage")) .. "]"
y = y + yo
end
if disabled_settings["enable_server"] == nil then
host = "checkbox[0,"..y..";cb_server;".. fgettext("Host Server") ..";" ..
dump(core.settings:get_bool("enable_server")) .. "]"
y = y + yo
if enable_server then
options[#options + 1] = { name = "server_announce", text = fgettext("Announce Server") }
end
retval = retval ..
"button[3.9,3.8;2.8,1;world_delete;".. fgettext("Delete") .. "]" ..
"button[6.55,3.8;2.8,1;world_configure;".. fgettext("Select Mods") .. "]" ..
"button[9.2,3.8;2.8,1;world_create;".. fgettext("New") .. "]" ..
"label[3.9,-0.05;".. fgettext("Select World:") .. "]"..
creative ..
damage ..
host ..
"textlist[3.9,0.4;7.9,3.45;sp_worlds;" ..
menu_render_worldlist() ..
";" .. index .. "]"
local y = 0
for _, opt in pairs(options) do
retval[#retval + 1] = "checkbox[0,"
retval[#retval + 1] = y
retval[#retval + 1] =";cb_"
retval[#retval + 1] = opt.name
retval[#retval + 1] = ";"
retval[#retval + 1] = opt.text
retval[#retval + 1] = ";"
retval[#retval + 1] = dump(core.settings:get_bool(opt.name))
retval[#retval + 1] = "]"
if core.settings:get_bool("enable_server") and disabled_settings["enable_server"] == nil then
retval = retval ..
"button[7.9,4.75;4.1,1;play;".. fgettext("Host Game") .. "]" ..
"checkbox[0,"..y..";cb_server_announce;" .. fgettext("Announce Server") .. ";" ..
dump(core.settings:get_bool("server_announce")) .. "]" ..
"field[0.3,2.85;3.8,0.5;te_playername;" .. fgettext("Name") .. ";" ..
core.formspec_escape(core.settings:get("name")) .. "]" ..
"pwdfield[0.3,4.05;3.8,0.5;te_passwd;" .. fgettext("Password") .. "]"
y = y + 0.5
end
y = y + 0.25
if enable_server then
retval[#retval + 1] = "container[0,"
retval[#retval + 1] = y
retval[#retval + 1] = "]label[0,0;"
retval[#retval + 1] = fgettext("Name/Password")
retval[#retval + 1] = "]"
retval[#retval + 1] = "field[0,0.3;3.375,0.5;te_playername;;"
retval[#retval + 1] = core.formspec_escape(core.settings:get("name"))
retval[#retval + 1] = "]"
retval[#retval + 1] = "pwdfield[0,1;3.375,0.5;te_passwd;]"
local bind_addr = core.settings:get("bind_address")
if bind_addr ~= nil and bind_addr ~= "" then
retval = retval ..
"field[0.3,5.25;2.5,0.5;te_serveraddr;" .. fgettext("Bind Address") .. ";" ..
core.formspec_escape(core.settings:get("bind_address")) .. "]" ..
"field[2.85,5.25;1.25,0.5;te_serverport;" .. fgettext("Port") .. ";" ..
core.formspec_escape(core.settings:get("port")) .. "]"
retval[#retval + 1] = "field[0,2.2;2.25,0.5;te_serveraddr;" .. fgettext("Bind Address")
retval[#retval + 1] = ";"
retval[#retval + 1] = core.formspec_escape(core.settings:get("bind_address"))
retval[#retval + 1] = "]"
retval[#retval + 1] = "field[2.3,2.2;1.25,0.5;te_serverport;"
retval[#retval + 1] = fgettext("Port")
retval[#retval + 1] = ";"
retval[#retval + 1] = core.formspec_escape(core.settings:get("port"))
retval[#retval + 1] = "]"
else
retval = retval ..
"field[0.3,5.25;3.8,0.5;te_serverport;" .. fgettext("Server Port") .. ";" ..
core.formspec_escape(core.settings:get("port")) .. "]"
retval[#retval + 1] = "field[0,2.2;3.375,0.5;te_serverport;"
retval[#retval + 1] = fgettext("Server Port")
retval[#retval + 1] = ";"
retval[#retval + 1] = core.formspec_escape(core.settings:get("port"))
retval[#retval + 1] = "]"
end
else
retval = retval ..
"button[7.9,4.75;4.1,1;play;" .. fgettext("Play Game") .. "]"
retval[#retval + 1] = "container_end[]"
end
return retval
if index > 0 then
retval[#retval + 1] = "container[0,5.15]"
retval[#retval + 1] = "button[0,0;3.375,0.8;world_delete;"
retval[#retval + 1] = fgettext("Delete")
retval[#retval + 1] = "]"
retval[#retval + 1] = "button[0,1.05;3.375,0.8;world_configure;"
retval[#retval + 1] = fgettext("Configure")
retval[#retval + 1] = "]"
retval[#retval + 1] = "button[0,2.1;3.375,0.8;play;"
retval[#retval + 1] = fgettext("Play Game")
retval[#retval + 1] = "]"
-- "button[4,3.95;2.6,1;world_delete;", fgettext("Delete"), "]",
--"button[6.5,3.95;2.8,1;world_configure;", fgettext("Configure"), "]",
retval[#retval + 1] = "container_end[]"
else
retval[#retval + 1] = "container[0,5.15]"
retval[#retval + 1] = "box[0,0;2.625,0.8;#333]"
retval[#retval + 1] = "box[0,1.05;2.625,0.8;#333]"
retval[#retval + 1] = "box[0,2.1;2.625,0.8;#333]"
retval[#retval + 1] = "container_end[]"
end
retval[#retval + 1] = "container_end[]"
end
return table.concat(retval, "") .. "container_end[]"
end
local function main_button_handler(this, fields, name, tabdata)
@@ -254,8 +171,8 @@ local function main_button_handler(this, fields, name, tabdata)
return true
end
if fields["cb_server"] then
core.settings:set("enable_server", fields["cb_server"])
if fields["cb_enable_server"] then
core.settings:set("enable_server", fields["cb_enable_server"])
return true
end
@@ -268,36 +185,12 @@ local function main_button_handler(this, fields, name, tabdata)
return true
end
if fields["play"] ~= nil or world_doubleclick or fields["key_enter"] then
if fields["play"] ~= nil or world_doubleclick then
local selected = core.get_textlist_index("sp_worlds")
gamedata.selected_world = menudata.worldlist:get_raw_index(selected)
if selected == nil or gamedata.selected_world == 0 then
gamedata.errormessage =
fgettext("No world created or selected!")
return true
end
-- Update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
local game_obj
if world then
game_obj = pkgmgr.find_by_gameid(world.gameid)
core.settings:set("menu_last_game", game_obj.id)
end
local disabled_settings = get_disabled_settings(game_obj)
for k, _ in pairs(valid_disabled_settings) do
local v = disabled_settings[k]
if v ~= nil then
if k == "enable_server" and v == true then
error("Setting 'enable_server' cannot be force-enabled! The game.conf needs to be fixed.")
end
core.settings:set_bool(k, disabled_settings[k])
end
end
if core.settings:get_bool("enable_server") then
if selected ~= nil and gamedata.selected_world ~= 0 then
gamedata.playername = fields["te_playername"]
gamedata.password = fields["te_passwd"]
gamedata.port = fields["te_serverport"]
@@ -307,22 +200,31 @@ local function main_button_handler(this, fields, name, tabdata)
if fields["te_serveraddr"] ~= nil then
core.settings:set("bind_address",fields["te_serveraddr"])
end
else
gamedata.singleplayer = true
--update last game
local world = menudata.worldlist:get_raw_element(gamedata.selected_world)
if world then
local game, index = pkgmgr.find_by_gameid(world.gameid)
core.settings:set("menu_last_game", game.id)
end
core.start()
else
gamedata.errormessage =
fgettext("No world created or selected!")
end
else
if selected ~= nil and gamedata.selected_world ~= 0 then
gamedata.singleplayer = true
core.start()
else
gamedata.errormessage =
fgettext("No world created or selected!")
end
return true
end
end
if fields["world_create"] ~= nil then
local create_world_dlg = create_create_world_dlg()
create_world_dlg:set_parent(this)
this:hide()
create_world_dlg:show()
mm_game_theme.update("singleplayer", current_game())
return true
end
if fields["world_delete"] ~= nil then
local selected = core.get_textlist_index("sp_worlds")
@@ -337,7 +239,7 @@ local function main_button_handler(this, fields, name, tabdata)
delete_world_dlg:set_parent(this)
this:hide()
delete_world_dlg:show()
mm_game_theme.update("singleplayer",current_game())
mm_texture.update("singleplayer",current_game())
end
end
@@ -355,7 +257,7 @@ local function main_button_handler(this, fields, name, tabdata)
configdialog:set_parent(this)
this:hide()
configdialog:show()
mm_game_theme.update("singleplayer",current_game())
mm_texture.update("singleplayer",current_game())
end
end
@@ -364,29 +266,25 @@ local function main_button_handler(this, fields, name, tabdata)
end
local function on_change(type, old_tab, new_tab)
if (type == "ENTER") then
if type == "ENTER" then
local game = current_game()
if game then
apply_game(game)
end
singleplayer_refresh_gamebar()
ui.find_by_name("game_button_bar"):show()
if game then
menudata.worldlist:set_filtercriteria(game.id)
core.set_topleft_text(game.name)
mm_texture.update("singleplayer",game)
end
else
menudata.worldlist:set_filtercriteria(nil)
local gamebar = ui.find_by_name("game_button_bar")
if gamebar then
gamebar:hide()
end
core.set_topleft_text("")
mm_game_theme.update(new_tab,nil)
mm_texture.update(new_tab,nil)
end
end
--------------------------------------------------------------------------------
return {
name = "local",
caption = fgettext("Start Game"),
caption = fgettext("Load Game"),
cbf_formspec = get_formspec,
cbf_button_handler = main_button_handler,
on_change = on_change

View File

@@ -0,0 +1,185 @@
--Minetest
--Copyright (C) 2013 sapier
--
--This program is free software; you can redistribute it and/or modify
--it under the terms of the GNU Lesser General Public License as published by
--the Free Software Foundation; either version 2.1 of the License, or
--(at your option) any later version.
--
--This program is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU Lesser General Public License for more details.
--
--You should have received a copy of the GNU Lesser General Public License along
--with this program; if not, write to the Free Software Foundation, Inc.,
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
mm_texture = {}
--------------------------------------------------------------------------------
function mm_texture.init()
mm_texture.defaulttexturedir = core.get_texturepath() .. DIR_DELIM .. "base" ..
DIR_DELIM .. "pack" .. DIR_DELIM
mm_texture.basetexturedir = mm_texture.defaulttexturedir
mm_texture.texturepack = core.settings:get("texture_path")
mm_texture.gameid = nil
end
--------------------------------------------------------------------------------
function mm_texture.update(tab,gamedetails)
if tab ~= "singleplayer" then
mm_texture.reset()
return
end
if gamedetails == nil then
return
end
mm_texture.update_game(gamedetails)
end
--------------------------------------------------------------------------------
function mm_texture.reset()
mm_texture.gameid = nil
local have_bg = false
local have_overlay = mm_texture.set_generic("overlay")
if not have_overlay then
have_bg = mm_texture.set_generic("background")
end
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
mm_texture.set_generic("footer")
mm_texture.set_generic("header")
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_texture.set_dirt_bg()
end
end
end
--------------------------------------------------------------------------------
function mm_texture.update_game(gamedetails)
if mm_texture.gameid == gamedetails.id then
return
end
local have_bg = false
local have_overlay = mm_texture.set_game("overlay",gamedetails)
if not have_overlay then
have_bg = mm_texture.set_game("background",gamedetails)
end
mm_texture.clear("header")
mm_texture.clear("footer")
core.set_clouds(false)
if not have_bg then
if core.settings:get_bool("menu_clouds") then
core.set_clouds(true)
else
mm_texture.set_dirt_bg()
end
end
mm_texture.set_game("footer",gamedetails)
mm_texture.set_game("header",gamedetails)
mm_texture.gameid = gamedetails.id
end
--------------------------------------------------------------------------------
function mm_texture.clear(identifier)
core.set_background(identifier,"")
end
--------------------------------------------------------------------------------
function mm_texture.set_generic(identifier)
--try texture pack first
if mm_texture.texturepack ~= nil then
local path = mm_texture.texturepack .. DIR_DELIM .."menu_" ..
identifier .. ".png"
if core.set_background(identifier,path) then
return true
end
end
if mm_texture.defaulttexturedir ~= nil then
local path = mm_texture.defaulttexturedir .. DIR_DELIM .."menu_" ..
identifier .. ".png"
if core.set_background(identifier,path) then
return true
end
end
return false
end
--------------------------------------------------------------------------------
function mm_texture.set_game(identifier, gamedetails)
if gamedetails == nil then
return false
end
if mm_texture.texturepack ~= nil then
local path = mm_texture.texturepack .. DIR_DELIM ..
gamedetails.id .. "_menu_" .. identifier .. ".png"
if core.set_background(identifier, path) then
return true
end
end
-- Find out how many randomized textures the game provides
local n = 0
local filename
local menu_files = core.get_dir_list(gamedetails.path .. DIR_DELIM .. "menu", false)
for i = 1, #menu_files do
filename = identifier .. "." .. i .. ".png"
if table.indexof(menu_files, filename) == -1 then
n = i - 1
break
end
end
-- Select random texture, 0 means standard texture
n = math.random(0, n)
if n == 0 then
filename = identifier .. ".png"
else
filename = identifier .. "." .. n .. ".png"
end
local path = gamedetails.path .. DIR_DELIM .. "menu" ..
DIR_DELIM .. filename
if core.set_background(identifier, path) then
return true
end
return false
end
function mm_texture.set_dirt_bg()
if mm_texture.texturepack ~= nil then
local path = mm_texture.texturepack .. DIR_DELIM .."default_dirt.png"
if core.set_background("background", path, true, 128) then
return true
end
end
-- Use universal fallback texture in textures/base/pack
local minimalpath = defaulttexturedir .. "menu_bg.png"
core.set_background("background", minimalpath, true, 128)
end

View File

@@ -5,15 +5,15 @@
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>minetest</string>
<string>xtreemtest</string>
<key>CFBundleIconFile</key>
<string>minetest-icon.icns</string>
<string>xtreemtest-icon.icns</string>
<key>CFBundleName</key>
<string>Minetest</string>
<string>XtreemTest</string>
<key>CFBundleDisplayName</key>
<string>Minetest</string>
<string>XtreemTest</string>
<key>CFBundleIdentifier</key>
<string>net.minetest.minetest</string>
<string>info.sovnat.xtreemtest</string>
<key>NSHighResolutionCapable</key>
<false/>
</dict>

View File

@@ -0,0 +1,12 @@
[Desktop Entry]
Name=XtreemTest
GenericName=XtreemTest
Comment=Multiplayer infinite-world block sandbox
Exec=xtreemtest
Icon=xtreemtest
Terminal=false
PrefersNonDefaultGPU=true
Type=Application
Categories=Game;Simulation;
StartupNotify=false
Keywords=sandbox;world;mining;crafting;blocks;nodes;multiplayer;roleplaying;

View File

@@ -1,18 +0,0 @@
[Desktop Entry]
Name=Minetest
GenericName=Minetest
Comment=Multiplayer infinite-world block sandbox
Comment[de]=Mehrspieler-Sandkastenspiel mit unendlichen Blockwelten
Comment[es]=Juego sandbox multijugador con mundos infinitos
Comment[fr]=Jeu multijoueurs de type bac à sable avec des mondes infinis
Comment[ja]=マルチプレイに対応した、無限の世界のブロック型サンドボックスゲームです
Comment[ru]=Игра-песочница с безграничным миром, состоящим из блоков
Comment[tr]=Tek-Çok oyuncuyla küplerden sonsuz dünyalar inşa et
Exec=minetest
Icon=minetest
Terminal=false
PrefersNonDefaultGPU=true
Type=Application
Categories=Game;Simulation;
StartupNotify=false
Keywords=sandbox;world;mining;crafting;blocks;nodes;multiplayer;roleplaying;

View File

@@ -16,11 +16,11 @@
#endif
#ifdef __MINGW32__
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "minetest.exe.manifest"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "xtreemtest.exe.manifest"
#endif
LANGUAGE 0, SUBLANG_NEUTRAL
130 ICON "minetest-icon.ico"
130 ICON "xtreemtest-icon.ico"
/////////////////////////////////////////////////////////////////////////////
//
@@ -49,9 +49,8 @@ BEGIN
VALUE "FileDescription", PROJECT_NAME_C " engine"
VALUE "FileVersion", VERSION_STRING
VALUE "InternalName", PROJECT_NAME
VALUE "LegalCopyright", "(c) 2011-2015 celeron55"
VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!"
VALUE "OriginalFilename", "minetest.exe"
VALUE "LegalCopyright", "(c) 2011-2022 celeron55"
VALUE "OriginalFilename", "xtreemtest.exe"
VALUE "PrivateBuild", VERSION_EXTRA
VALUE "ProductName", PROJECT_NAME_C
VALUE "ProductVersion", PRODUCT_VERSION_STRING

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 828 B

BIN
misc/xtreemtest-icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -180,10 +180,10 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
g_menucloudsmgr = m_rendering_engine->get_scene_manager()->createNewSceneManager();
if (!g_menuclouds)
g_menuclouds = new Clouds(g_menucloudsmgr, -1, rand());
g_menuclouds->setHeight(100.0f);
g_menuclouds->setHeight(30.0f);
g_menuclouds->update(v3f(0, 0, 0), video::SColor(255, 240, 240, 255));
scene::ICameraSceneNode* camera;
camera = g_menucloudsmgr->addCameraSceneNode(NULL, v3f(0, 0, 0), v3f(0, 60, 100));
camera = g_menucloudsmgr->addCameraSceneNode(NULL, v3f(0, 0, 0), v3f(0, 10, 0));
camera->setFarValue(10000);
/*
@@ -208,7 +208,7 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
while (m_rendering_engine->run() && !*kill &&
!g_gamecallback->shutdown_requested) {
// Set the window caption
const wchar_t *text = wgettext("Main Menu");
const wchar_t *text = wgettext("Title Menu");
m_rendering_engine->get_raw_device()->
setWindowCaption((utf8_to_wide(PROJECT_NAME_C) +
L" " + utf8_to_wide(g_version_hash) +
@@ -224,11 +224,9 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
custom gui elements directly on the screen.
Otherwise they won't be automatically drawn.
*/
guiroot = m_rendering_engine->get_gui_env()->addStaticText(L"",
core::rect<s32>(0, 0, 10000, 10000));
guiroot = m_rendering_engine->get_gui_env()->addStaticText(L"", core::rect<s32>(0, 0, 10000, 10000));
bool game_has_run = launch_game(error_message, reconnect_requested,
start_data, cmd_args);
bool game_has_run = launch_game(error_message, reconnect_requested, start_data, cmd_args);
// Reset the reconnect_requested flag
reconnect_requested = false;

View File

@@ -106,8 +106,7 @@ void GUIBox::draw()
video::IVideoDriver *driver = Environment->getVideoDriver();
driver->draw2DRectangle(main_rect, m_colors[0], m_colors[1], m_colors[3],
m_colors[2], &AbsoluteClippingRect);
driver->draw2DRectangle(main_rect, m_colors[0], m_colors[1], m_colors[3], m_colors[2], &AbsoluteClippingRect);
for (size_t i = 0; i <= 3; i++)
driver->draw2DRectangle(m_bordercolors[i], border_rects[i],

View File

@@ -20,7 +20,7 @@ using namespace irr;
using namespace gui;
// Multiply with a color to get the default corresponding hovered color
#define COLOR_HOVERED_MOD 1.25f
#define COLOR_HOVERED_MOD 2.f
// Multiply with a color to get the default corresponding pressed color
#define COLOR_PRESSED_MOD 0.85f
@@ -46,6 +46,7 @@ GUIButton::GUIButton(IGUIEnvironment* environment, IGUIElement* parent,
// PATCH
for (size_t i = 0; i < 4; i++) {
Colors[i] = Environment->getSkin()->getColor((EGUI_DEFAULT_COLOR)i);
//Colors[i] = video::SColor(255, 0, 255, 255);
}
StaticText = gui::StaticText::add(Environment, Text.c_str(), core::rect<s32>(0,0,rectangle.getWidth(),rectangle.getHeight()), false, false, this, id);
StaticText->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
@@ -646,10 +647,9 @@ GUIButton* GUIButton::addButton(IGUIEnvironment *environment,
void GUIButton::setColor(video::SColor color)
{
BgColor = color;
float d = 0.65f;
for (size_t i = 0; i < 4; i++) {
video::SColor base = Environment->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
video::SColor base = video::SColor(255, 0, 255, 255); //Environment->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
Colors[i] = base.getInterpolated(color, d);
}
}
@@ -696,8 +696,7 @@ void GUIButton::setFromStyle(const StyleSpec& style)
} else {
BgColor = video::SColor(255, 255, 255, 255);
for (size_t i = 0; i < 4; i++) {
video::SColor base =
Environment->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i);
video::SColor base = Environment->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i); //video::SColor(255, 15 * i, 15 * i, 40 * i);
if (pressed) {
Colors[i] = multiplyColorValue(base, COLOR_PRESSED_MOD);
} else if (hovered) {

View File

@@ -417,7 +417,7 @@ void GUIEngine::drawBackground(video::IVideoDriver *driver)
/* If no texture, draw background of solid color */
if(!texture){
video::SColor color(255,80,58,37);
video::SColor color(255,50,58,87);
core::rect<s32> rect(0, 0, screensize.X, screensize.Y);
driver->draw2DRectangle(color, rect, NULL);
return;

View File

@@ -1021,6 +1021,9 @@ void GUIFormSpecMenu::parseButton(parserData* data, const std::string &element,
GUIButton *e = GUIButton::addButton(Environment, rect, m_tsrc,
data->current_parent, spec.fid, spec.flabel.c_str());
//just a test -- migdyn
e->setColor(video::SColor(255, 5, 255, 255));
auto style = getStyleForElement(type, name, (type != "button") ? "button" : "");
spec.sound = style[StyleSpec::STATE_DEFAULT].get(StyleSpec::Property::SOUND, "");

View File

@@ -27,30 +27,34 @@ GUISkin::GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
if ((Type == EGST_WINDOWS_CLASSIC) || (Type == EGST_WINDOWS_METALLIC))
{
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,50);
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,130);
Colors[EGDC_3D_FACE] = video::SColor(220,100,100,100);
Colors[0] = video::SColor(101, 250, 250, 200);
Colors[1] = video::SColor(101, 250, 250, 200);
Colors[2] = video::SColor(101, 250, 250, 200);
Colors[3] = video::SColor(101, 250, 250, 200);
Colors[EGDC_3D_DARK_SHADOW] = video::SColor(101,50,50,200);
Colors[EGDC_3D_SHADOW] = video::SColor(101,130,130,230);
Colors[EGDC_3D_FACE] = video::SColor(220,0,0,60);
Colors[EGDC_3D_HIGH_LIGHT] = video::SColor(101,255,255,255);
Colors[EGDC_3D_LIGHT] = video::SColor(101,210,210,210);
Colors[EGDC_3D_LIGHT] = video::SColor(101,110,110,255);
Colors[EGDC_ACTIVE_BORDER] = video::SColor(101,16,14,115);
Colors[EGDC_ACTIVE_CAPTION] = video::SColor(255,255,255,255);
Colors[EGDC_APP_WORKSPACE] = video::SColor(101,100,100,100);
Colors[EGDC_APP_WORKSPACE] = video::SColor(101,80,80,255);
Colors[EGDC_BUTTON_TEXT] = video::SColor(240,10,10,10);
Colors[EGDC_GRAY_TEXT] = video::SColor(240,130,130,130);
Colors[EGDC_HIGH_LIGHT] = video::SColor(101,8,36,107);
Colors[EGDC_HIGH_LIGHT] = video::SColor(101,8,36,207);
Colors[EGDC_HIGH_LIGHT_TEXT] = video::SColor(240,255,255,255);
Colors[EGDC_INACTIVE_BORDER] = video::SColor(101,165,165,165);
Colors[EGDC_INACTIVE_CAPTION] = video::SColor(255,30,30,30);
Colors[EGDC_TOOLTIP] = video::SColor(200,0,0,0);
Colors[EGDC_TOOLTIP_BACKGROUND] = video::SColor(200,255,255,225);
Colors[EGDC_SCROLLBAR] = video::SColor(101,230,230,230);
Colors[EGDC_WINDOW] = video::SColor(101,255,255,255);
Colors[EGDC_SCROLLBAR] = video::SColor(101,90,130,255);
Colors[EGDC_WINDOW] = video::SColor(101,25,5,255);
Colors[EGDC_WINDOW_SYMBOL] = video::SColor(200,10,10,10);
Colors[EGDC_ICON] = video::SColor(200,255,255,255);
Colors[EGDC_ICON_HIGH_LIGHT] = video::SColor(200,8,36,107);
Colors[EGDC_GRAY_WINDOW_SYMBOL] = video::SColor(240,100,100,100);
Colors[EGDC_EDITABLE] = video::SColor(255,255,255,255);
Colors[EGDC_GRAY_EDITABLE] = video::SColor(255,120,120,120);
Colors[EGDC_GRAY_EDITABLE] = video::SColor(255,250,250,250);
Colors[EGDC_FOCUSED_EDITABLE] = video::SColor(255,240,240,255);
@@ -72,13 +76,13 @@ GUISkin::GUISkin(EGUI_SKIN_TYPE type, video::IVideoDriver* driver)
else
{
//0x80a6a8af
Colors[EGDC_3D_DARK_SHADOW] = 0x60767982;
Colors[EGDC_3D_DARK_SHADOW] = 0x607679f2;
//Colors[EGDC_3D_FACE] = 0xc0c9ccd4; // tab background
Colors[EGDC_3D_FACE] = 0xc0cbd2d9; // tab background
Colors[EGDC_3D_FACE] = 0xc0cbd2f9; // tab background
Colors[EGDC_3D_SHADOW] = 0x50e4e8f1; // tab background, and left-top highlight
Colors[EGDC_3D_HIGH_LIGHT] = 0x40c7ccdc;
Colors[EGDC_3D_LIGHT] = 0x802e313a;
Colors[EGDC_ACTIVE_BORDER] = 0x80404040; // window title
Colors[EGDC_ACTIVE_BORDER] = 0x80808080; // window title
Colors[EGDC_ACTIVE_CAPTION] = 0xffd0d0d0;
Colors[EGDC_APP_WORKSPACE] = 0xc0646464; // unused
Colors[EGDC_BUTTON_TEXT] = 0xd0161616;

BIN
textures/base/pack/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB