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

added light block #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
29 changes: 29 additions & 0 deletions deps/glfw/src/glfw3Config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# - Config file for the glfw3 package
# It defines the following variables
# GLFW3_INCLUDE_DIR, the path where GLFW headers are located
# GLFW3_LIBRARY_DIR, folder in which the GLFW library is located
# GLFW3_LIBRARY, library to link against to use GLFW

set(GLFW3_VERSION "3.1.2")


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was glfw3Config.cmake.in ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()

####################################################################################

set_and_check(GLFW3_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")
set_and_check(GLFW3_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/lib")

find_library(GLFW3_LIBRARY "glfw3" HINTS ${GLFW3_LIBRARY_DIR})

51 changes: 51 additions & 0 deletions deps/glfw/src/glfw3ConfigVersion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
# but only if the requested major version is the same as the current one.
# The variable CVF_VERSION must be set before calling configure_file().


set(PACKAGE_VERSION "3.1.2")

if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()

if("3.1.2" MATCHES "^([0-9]+)\\.")
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
else()
set(CVF_VERSION_MAJOR "3.1.2")
endif()

if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()

if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()


# if the installed project requested no architecture check, don't perform the check
if("FALSE")
return()
endif()

# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()

# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
81 changes: 81 additions & 0 deletions deps/glfw/src/glfw_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//========================================================================
// GLFW 3.1 - www.glfw.org
//------------------------------------------------------------------------
// Copyright (c) 2010 Camilla Berglund <elmindreda@elmindreda.org>
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would
// be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not
// be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source
// distribution.
//
//========================================================================
// As glfw_config.h.in, this file is used by CMake to produce the
// glfw_config.h configuration header file. If you are adding a feature
// requiring conditional compilation, this is where to add the macro.
//========================================================================
// As glfw_config.h, this file defines compile-time option macros for a
// specific platform and development environment. If you are using the
// GLFW CMake files, modify glfw_config.h.in instead of this file. If you
// are using your own build system, make this file define the appropriate
// macros in whatever way is suitable.
//========================================================================

// Define this to 1 if building GLFW for X11
/* #undef _GLFW_X11 */
// Define this to 1 if building GLFW for Win32
/* #undef _GLFW_WIN32 */
// Define this to 1 if building GLFW for Cocoa
#define _GLFW_COCOA
// Define this to 1 if building GLFW for Wayland
/* #undef _GLFW_WAYLAND */
// Define this to 1 if building GLFW for Mir
/* #undef _GLFW_MIR */

// Define this to 1 if building GLFW for EGL
/* #undef _GLFW_EGL */
// Define this to 1 if building GLFW for GLX
/* #undef _GLFW_GLX */
// Define this to 1 if building GLFW for WGL
/* #undef _GLFW_WGL */
// Define this to 1 if building GLFW for NSGL
#define _GLFW_NSGL

// Define this to 1 if building as a shared library / dynamic library / DLL
/* #undef _GLFW_BUILD_DLL */

// Define this to 1 to force use of high-performance GPU on hybrid systems
/* #undef _GLFW_USE_HYBRID_HPG */

// Define this to 1 if the XInput X11 extension is available
/* #undef _GLFW_HAS_XINPUT */
// Define this to 1 if the Xxf86vm X11 extension is available
/* #undef _GLFW_HAS_XF86VM */

// Define this to 1 if glfwInit should change the current directory
#define _GLFW_USE_CHDIR
// Define this to 1 if glfwCreateWindow should populate the menu bar
#define _GLFW_USE_MENUBAR
// Define this to 1 if windows should use full resolution on Retina displays
#define _GLFW_USE_RETINA

// Define this to 1 if using OpenGL as the client library
#define _GLFW_USE_OPENGL
// Define this to 1 if using OpenGL ES 1.1 as the client library
/* #undef _GLFW_USE_GLESV1 */
// Define this to 1 if using OpenGL ES 2.0 as the client library
/* #undef _GLFW_USE_GLESV2 */

Binary file added deps/glfw/tests/cursor
Binary file not shown.
Binary file added deps/glfw/tests/monitors
Binary file not shown.
Binary file added deps/glfw/tests/msaa
Binary file not shown.
13 changes: 12 additions & 1 deletion src/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const int items[] = {
COLOR_28,
COLOR_29,
COLOR_30,
COLOR_31
COLOR_31,
LANTERN,
};

const int item_count = sizeof(items) / sizeof(int);
Expand Down Expand Up @@ -127,6 +128,7 @@ const int blocks[256][6] = {
{205, 205, 205, 205, 205, 205}, // 61
{206, 206, 206, 206, 206, 206}, // 62
{207, 207, 207, 207, 207, 207}, // 63
{15, 15, 15, 15, 15, 15}, // 64 -- bright white
};

const int plants[256] = {
Expand Down Expand Up @@ -197,3 +199,12 @@ int is_destructable(int w) {
return 1;
}
}

int is_lantern(int w) {
switch (w) {
case LANTERN:
return 10;
default:
return 0;
}
}
2 changes: 2 additions & 0 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#define COLOR_29 61
#define COLOR_30 62
#define COLOR_31 63
#define LANTERN 64

extern const int items[];
extern const int item_count;
Expand All @@ -67,5 +68,6 @@ int is_plant(int w);
int is_obstacle(int w);
int is_transparent(int w);
int is_destructable(int w);
int is_lantern(int w);

#endif
3 changes: 3 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,9 @@ void set_block(int x, int y, int z, int w) {
}
}
client_block(x, y, z, w);
if (is_lantern(w)) {
set_light(p, q, x, y,z, is_lantern(w));
}
}

void record_block(int x, int y, int z, int w) {
Expand Down