mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Combine Event.h/Events.h
This commit is contained in:
parent
c5c2e51b6f
commit
7dccf90f18
@ -36,7 +36,7 @@ namespace ClassicalSharp.Textures {
|
|||||||
string line;
|
string line;
|
||||||
while ((line = reader.ReadLine()) != null) {
|
while ((line = reader.ReadLine()) != null) {
|
||||||
line = line.Trim();
|
line = line.Trim();
|
||||||
if (line.Length == 0 || line[0] == '#') continue;
|
if (line.Length == 0) continue;
|
||||||
Entries.Add(line);
|
Entries.Add(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
|
|
||||||
GfxResourceID axisLines_vb;
|
GfxResourceID axisLines_vb;
|
||||||
#define axisLines_numVertices 12
|
#define axisLines_numVertices 12
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "GraphicsAPI.h"
|
#include "GraphicsAPI.h"
|
||||||
#include "GraphicsCommon.h"
|
#include "GraphicsCommon.h"
|
||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "TerrainAtlas.h"
|
#include "TerrainAtlas.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "GameStructs.h"
|
#include "GameStructs.h"
|
||||||
#include "VertexStructs.h"
|
#include "VertexStructs.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
/* Renders map sides and map edges (horizon) as large quads.
|
/* Renders map sides and map edges (horizon) as large quads.
|
||||||
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Stream.h"
|
#include "Stream.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ErrorHandler.h"
|
#include "ErrorHandler.h"
|
||||||
#include "ServerConnection.h"
|
#include "ServerConnection.h"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "ChunkUpdater.h"
|
#include "ChunkUpdater.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "FrustumCulling.h"
|
#include "FrustumCulling.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define CC_CHUNKUPDATER_H
|
#define CC_CHUNKUPDATER_H
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
/* Manages the process of building/deleting chunk meshes.
|
/* Manages the process of building/deleting chunk meshes.
|
||||||
Also sorts chunks so nearest chunks are ordered first, and calculates chunk visibility.
|
Also sorts chunks so nearest chunks are ordered first, and calculates chunk visibility.
|
||||||
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
|
@ -198,7 +198,6 @@
|
|||||||
<ClInclude Include="EnvRenderer.h" />
|
<ClInclude Include="EnvRenderer.h" />
|
||||||
<ClInclude Include="ErrorHandler.h" />
|
<ClInclude Include="ErrorHandler.h" />
|
||||||
<ClInclude Include="Event.h" />
|
<ClInclude Include="Event.h" />
|
||||||
<ClInclude Include="Events.h" />
|
|
||||||
<ClInclude Include="Formats.h" />
|
<ClInclude Include="Formats.h" />
|
||||||
<ClInclude Include="FrustumCulling.h" />
|
<ClInclude Include="FrustumCulling.h" />
|
||||||
<ClInclude Include="Deflate.h" />
|
<ClInclude Include="Deflate.h" />
|
||||||
|
@ -61,12 +61,6 @@
|
|||||||
<Filter Include="Source Files\Map">
|
<Filter Include="Source Files\Map">
|
||||||
<UniqueIdentifier>{cb26e83f-9153-4964-9dc2-13502fbb1d1b}</UniqueIdentifier>
|
<UniqueIdentifier>{cb26e83f-9153-4964-9dc2-13502fbb1d1b}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="Header Files\Events">
|
|
||||||
<UniqueIdentifier>{a912f0d5-3ceb-4e7e-ba4e-28170c634047}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files\Events">
|
|
||||||
<UniqueIdentifier>{03efa5de-9e49-4185-bb40-fa5e5a2846e6}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files\TexturePack">
|
<Filter Include="Header Files\TexturePack">
|
||||||
<UniqueIdentifier>{b5bd9aed-4b11-4f9f-86da-3187d3f4f260}</UniqueIdentifier>
|
<UniqueIdentifier>{b5bd9aed-4b11-4f9f-86da-3187d3f4f260}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
@ -318,12 +312,6 @@
|
|||||||
<ClInclude Include="DisplayDevice.h">
|
<ClInclude Include="DisplayDevice.h">
|
||||||
<Filter>Header Files\Platform\Window</Filter>
|
<Filter>Header Files\Platform\Window</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Event.h">
|
|
||||||
<Filter>Header Files\Events</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Events.h">
|
|
||||||
<Filter>Header Files\Events</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Window.h">
|
<ClInclude Include="Window.h">
|
||||||
<Filter>Header Files\Platform\Window</Filter>
|
<Filter>Header Files\Platform\Window</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@ -384,6 +372,9 @@
|
|||||||
<ClInclude Include="AsyncDownloader.h">
|
<ClInclude Include="AsyncDownloader.h">
|
||||||
<Filter>Header Files\Network</Filter>
|
<Filter>Header Files\Network</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Event.h">
|
||||||
|
<Filter>Header Files\Game</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="Noise.c">
|
<ClCompile Include="Noise.c">
|
||||||
@ -512,9 +503,6 @@
|
|||||||
<ClCompile Include="DisplayDevice.c">
|
<ClCompile Include="DisplayDevice.c">
|
||||||
<Filter>Source Files\Platform\Window</Filter>
|
<Filter>Source Files\Platform\Window</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="Event.c">
|
|
||||||
<Filter>Source Files\Events</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="WinWindow.c">
|
<ClCompile Include="WinWindow.c">
|
||||||
<Filter>Source Files\Platform</Filter>
|
<Filter>Source Files\Platform</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@ -593,5 +581,8 @@
|
|||||||
<ClCompile Include="ServerConnection.c">
|
<ClCompile Include="ServerConnection.c">
|
||||||
<Filter>Source Files\Network</Filter>
|
<Filter>Source Files\Network</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="Event.c">
|
||||||
|
<Filter>Source Files\Game</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -2,7 +2,7 @@
|
|||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "SkyboxRenderer.h"
|
#include "SkyboxRenderer.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
GfxResourceID env_cloudsVb, env_skyVb, env_cloudsTex;
|
GfxResourceID env_cloudsVb, env_skyVb, env_cloudsTex;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include "String.h"
|
#include "String.h"
|
||||||
#include "Stream.h"
|
#include "Stream.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
/* Helper method for managing events.
|
/* Helper method for managing events, and contains all events.
|
||||||
Copyright 2017 ClassicalSharp | Licensed under BSD-3
|
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Maximum number of event handlers that can be registered. */
|
/* Maximum number of event handlers that can be registered. */
|
||||||
@ -74,4 +74,72 @@ void Event_UnregisterBlock(Event_Block* handlers, Event_Block_Callback handler);
|
|||||||
void Event_RaiseMouseMove(Event_MouseMove* handlers, Int32 xDelta, Int32 yDelta);
|
void Event_RaiseMouseMove(Event_MouseMove* handlers, Int32 xDelta, Int32 yDelta);
|
||||||
void Event_RegisterMouseMove(Event_MouseMove* handlers, Event_MouseMove_Callback handler);
|
void Event_RegisterMouseMove(Event_MouseMove* handlers, Event_MouseMove_Callback handler);
|
||||||
void Event_UnregisterMouseMove(Event_MouseMove* handlers, Event_MouseMove_Callback handler);
|
void Event_UnregisterMouseMove(Event_MouseMove* handlers, Event_MouseMove_Callback handler);
|
||||||
|
|
||||||
|
|
||||||
|
Event_EntityID EntityEvents_Added; /* Entity is spawned in the current world. */
|
||||||
|
Event_EntityID EntityEvents_Removed; /* Entity is despawned from the current world. */
|
||||||
|
|
||||||
|
Event_EntityID TabListEvents_Added; /* Tab list entry is created. */
|
||||||
|
Event_EntityID TabListEvents_Changed; /* Tab list entry is modified. */
|
||||||
|
Event_EntityID TabListEvents_Removed; /* Tab list entry is removed. */
|
||||||
|
|
||||||
|
Event_Void TextureEvents_AtlasChanged; /* Terrain atlas (terrain.png) is changed. */
|
||||||
|
Event_Void TextureEvents_PackChanged; /* Texture pack is changed. */
|
||||||
|
Event_Stream TextureEvents_FileChanged; /* File in a texture pack is changed. (terrain.png, rain.png) */
|
||||||
|
|
||||||
|
Event_Void GfxEvents_ViewDistanceChanged; /* View/fog distance is changed. */
|
||||||
|
Event_Void GfxEvents_ProjectionChanged; /* Projection matrix has changed. */
|
||||||
|
Event_Void GfxEvents_ContextLost; /* Context is destroyed after having been previously created. */
|
||||||
|
Event_Void GfxEvents_ContextRecreated; /* context is recreated after having been previously lost. */
|
||||||
|
|
||||||
|
Event_Block UserEvents_BlockChanged; /* User changes a block. */
|
||||||
|
Event_Void UserEvents_HackPermissionsChanged; /* Hack permissions of the player changes. */
|
||||||
|
Event_Void UserEvents_HeldBlockChanged; /* Held block in hotbar changes. */
|
||||||
|
|
||||||
|
Event_Void BlockEvents_PermissionsChanged; /* Block permissions (can place/delete) for a block changes. */
|
||||||
|
Event_Void BlockEvents_BlockDefChanged; /* Block definition is changed or removed. */
|
||||||
|
|
||||||
|
Event_Void WorldEvents_NewMap; /* Player begins loading a new world. */
|
||||||
|
Event_Real32 WorldEvents_MapLoading; /* Portion of world is decompressed/generated. (Arg is progress from 0-1) */
|
||||||
|
Event_Void WorldEvents_MapLoaded; /* New world has finished loading, player can now interact with it. */
|
||||||
|
Event_Int32 WorldEvents_EnvVarChanged; /* World environment variable changed by player/CPE/WoM config. */
|
||||||
|
|
||||||
|
/* Environment variable identifiers*/
|
||||||
|
typedef Int32 EnvVar;
|
||||||
|
#define EnvVar_EdgeBlock 0
|
||||||
|
#define EnvVar_SidesBlock 1
|
||||||
|
#define EnvVar_EdgeHeight 2
|
||||||
|
#define EnvVar_SidesOffset 3
|
||||||
|
#define EnvVar_CloudsHeight 4
|
||||||
|
#define EnvVar_CloudsSpeed 5
|
||||||
|
#define EnvVar_WeatherSpeed 6
|
||||||
|
#define EnvVar_WeatherFade 7
|
||||||
|
#define EnvVar_Weather 8
|
||||||
|
#define EnvVar_ExpFog 9
|
||||||
|
#define EnvVar_SkyboxHorSpeed 10
|
||||||
|
#define EnvVar_SkyboxVerSpeed 11
|
||||||
|
#define EnvVar_SkyCol 12
|
||||||
|
#define EnvVar_CloudsCol 13
|
||||||
|
#define EnvVar_FogCol 14
|
||||||
|
#define EnvVar_SunCol 15
|
||||||
|
#define EnvVar_ShadowCol 16
|
||||||
|
|
||||||
|
Event_Void WindowEvents_Moved; /* Window is moved. */
|
||||||
|
Event_Void WindowEvents_Resized; /* Window is resized. */
|
||||||
|
Event_Void WindowEvents_Closing; /* Window is about to close. */
|
||||||
|
Event_Void WindowEvents_Closed; /* Window has closed. */
|
||||||
|
Event_Void WindowEvents_VisibilityChanged; /* Visibility of the window changes. */
|
||||||
|
Event_Void WindowEvents_FocusChanged; /* Focus of the window changes. */
|
||||||
|
Event_Void WindowEvents_WindowStateChanged; /* WindowState of the window changes. */
|
||||||
|
Event_Void WindowEvents_MouseLeave; /* Mouse cursor leaves window bounds. */
|
||||||
|
Event_Void WindowEvents_MouseEnter; /* Mouse cursor re-enters window bounds. */
|
||||||
|
|
||||||
|
Event_Int32 KeyEvents_Press; /* Raised when a character is typed. Arg is a character. */
|
||||||
|
Event_Int32 KeyEvents_Down; /* Raised when a key is pressed. Arg is a member of Key enumeration. */
|
||||||
|
Event_Int32 KeyEvents_Up; /* Raised when a key is released. Arg is a member of Key enumeration. */
|
||||||
|
|
||||||
|
Event_MouseMove MouseEvents_Moved; /* Mouse position is changed. (Arg is delta from last position) */
|
||||||
|
Event_Int32 MouseEvents_Down; /* Mouse button is pressed. (Arg is MouseButton member) */
|
||||||
|
Event_Int32 MouseEvents_Up; /* Mouse button is released. (Arg is MouseButton member) */
|
||||||
|
Event_Real32 MouseEvents_Wheel; /* Mouse wheel is moved/scrolled. (Arg is wheel delta) */
|
||||||
#endif
|
#endif
|
@ -1,143 +0,0 @@
|
|||||||
#ifndef CC_EVENTS_H
|
|
||||||
#define CC_EVENTS_H
|
|
||||||
#include "Event.h"
|
|
||||||
#include "Typedefs.h"
|
|
||||||
/* Contains the various events that are raised by the client.
|
|
||||||
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Raised when an entity is spawned in the current world. */
|
|
||||||
Event_EntityID EntityEvents_Added;
|
|
||||||
/* Raised when an entity is despawned from the current world. */
|
|
||||||
Event_EntityID EntityEvents_Removed;
|
|
||||||
|
|
||||||
/* Raised when a tab list entry is created. */
|
|
||||||
Event_EntityID TabListEvents_Added;
|
|
||||||
/* Raised when a tab list entry is modified. */
|
|
||||||
Event_EntityID TabListEvents_Changed;
|
|
||||||
/* Raised when a tab list entry is removed. */
|
|
||||||
Event_EntityID TabListEvents_Removed;
|
|
||||||
|
|
||||||
/* Raised when the terrain atlas ("terrain.png") is changed. */
|
|
||||||
Event_Void TextureEvents_AtlasChanged;
|
|
||||||
/* Raised when the texture pack is changed. */
|
|
||||||
Event_Void TextureEvents_PackChanged;
|
|
||||||
/* Raised when a file in a texture pack is changed. (such as "terrain.png", "rain.png") */
|
|
||||||
Event_Stream TextureEvents_FileChanged;
|
|
||||||
|
|
||||||
/* Raised when the user changed their view/fog distance. */
|
|
||||||
Event_Void GfxEvents_ViewDistanceChanged;
|
|
||||||
/* Raised when the projection matrix changes. */
|
|
||||||
Event_Void GfxEvents_ProjectionChanged;
|
|
||||||
/* Event raised when a context is destroyed after having been previously lost. */
|
|
||||||
Event_Void GfxEvents_ContextLost;
|
|
||||||
/* Event raised when a context is recreated after having been previously lost. */
|
|
||||||
Event_Void GfxEvents_ContextRecreated;
|
|
||||||
|
|
||||||
/* Raised when the user changes a block. */
|
|
||||||
Event_Block UserEvents_BlockChanged;
|
|
||||||
/* Raised when when the hack permissions of the player changes. */
|
|
||||||
Event_Void UserEvents_HackPermissionsChanged;
|
|
||||||
/* Raised when when the held block in hotbar changes. */
|
|
||||||
Event_Void UserEvents_HeldBlockChanged;
|
|
||||||
|
|
||||||
/* Raised when the block permissions(can place or delete a block) for the player changes. */
|
|
||||||
Event_Void BlockEvents_PermissionsChanged;
|
|
||||||
/* Raised when a block definition is changed. */
|
|
||||||
Event_Void BlockEvents_BlockDefChanged;
|
|
||||||
|
|
||||||
/* Raised when the player joins and begins loading a new world. */
|
|
||||||
Event_Void WorldEvents_NewMap;
|
|
||||||
/* Raised when a portion of the world is read and decompressed, or generated.
|
|
||||||
The floating point argument is progress (from 0 to 1). */
|
|
||||||
Event_Real32 WorldEvents_MapLoading;
|
|
||||||
/* Raised when new world has finished loading and the player can now interact with it. */
|
|
||||||
Event_Void WorldEvents_MapLoaded;
|
|
||||||
/* Raised when an environment variable of the world is changed by the user, CPE, or WoM config. */
|
|
||||||
Event_Int32 WorldEvents_EnvVarChanged;
|
|
||||||
|
|
||||||
/* Environment variable identifiers*/
|
|
||||||
typedef Int32 EnvVar;
|
|
||||||
#define EnvVar_EdgeBlock 0
|
|
||||||
#define EnvVar_SidesBlock 1
|
|
||||||
#define EnvVar_EdgeHeight 2
|
|
||||||
#define EnvVar_SidesOffset 3
|
|
||||||
#define EnvVar_CloudsHeight 4
|
|
||||||
#define EnvVar_CloudsSpeed 5
|
|
||||||
|
|
||||||
#define EnvVar_WeatherSpeed 6
|
|
||||||
#define EnvVar_WeatherFade 7
|
|
||||||
#define EnvVar_Weather 8
|
|
||||||
#define EnvVar_ExpFog 9
|
|
||||||
#define EnvVar_SkyboxHorSpeed 10
|
|
||||||
#define EnvVar_SkyboxVerSpeed 11
|
|
||||||
|
|
||||||
#define EnvVar_SkyCol 12
|
|
||||||
#define EnvVar_CloudsCol 13
|
|
||||||
#define EnvVar_FogCol 14
|
|
||||||
#define EnvVar_SunCol 15
|
|
||||||
#define EnvVar_ShadowCol 16
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
The Open Toolkit Library License
|
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009 the Open Toolkit library.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Raised when the window is moved. */
|
|
||||||
Event_Void WindowEvents_OnMove;
|
|
||||||
/* Raised whene the window is resized. */
|
|
||||||
Event_Void WindowEvents_OnResize;
|
|
||||||
/* Raised when the window is about to close. */
|
|
||||||
Event_Void WindowEvents_OnClosing;
|
|
||||||
/* Raised after the window has closed. */
|
|
||||||
Event_Void WindowEvents_OnClosed;
|
|
||||||
/* Raised the visibility of the window changes. */
|
|
||||||
Event_Void WindowEvents_OnVisibleChanged;
|
|
||||||
/* Raised when the focus of the window changes. */
|
|
||||||
Event_Void WindowEvents_OnFocusedChanged;
|
|
||||||
/* Raised when the WindowState of the window changes. */
|
|
||||||
Event_Void WindowEvents_OnWindowStateChanged;
|
|
||||||
/* Raised whenever the mouse cursor leaves the bounds of the window. */
|
|
||||||
Event_Void WindowEvents_OnMouseLeave;
|
|
||||||
/* Raised whenever the mouse cursor enters the bounds of the window. */
|
|
||||||
Event_Void WindowEvents_OnMouseEnter;
|
|
||||||
|
|
||||||
/* Raised when a character is typed. Arg is a character. */
|
|
||||||
Event_Int32 KeyEvents_KeyPress;
|
|
||||||
/* Raised when a key is pressed. Arg is a member of Key enumeration. */
|
|
||||||
Event_Int32 KeyEvents_KeyDown;
|
|
||||||
/* Raised when a key is released. Arg is a member of Key enumeration. */
|
|
||||||
Event_Int32 KeyEvents_KeyUp;
|
|
||||||
|
|
||||||
/*Raised when mouse position is changed. Arg is delta from last position. */
|
|
||||||
Event_MouseMove MouseEvents_Move;
|
|
||||||
/* Raised when a button is pressed. Arg is a member of MouseButton enum. */
|
|
||||||
Event_Int32 MouseEvents_ButtonDown;
|
|
||||||
/* Raised when a button is released. Arg is a member of MouseButton enum. */
|
|
||||||
Event_Int32 MouseEvents_ButtonUp;
|
|
||||||
/* Raised when mouse wheel is moved / scrolled. Arg is wheel delta. */
|
|
||||||
Event_Real32 MouseEvents_WheelChanged;
|
|
||||||
#endif
|
|
@ -4,7 +4,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Screens.h"
|
#include "Screens.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
|
|
||||||
void GameMode_Init(void) {
|
void GameMode_Init(void) {
|
||||||
BlockID* inv = Inventory_Table;
|
BlockID* inv = Inventory_Table;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GraphicsCommon.h"
|
#include "GraphicsCommon.h"
|
||||||
#include "GraphicsAPI.h"
|
#include "GraphicsAPI.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Drawer2D.h"
|
#include "Drawer2D.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "Options.h"
|
#include "Options.h"
|
||||||
|
|
||||||
@ -55,16 +55,16 @@ const UInt8* Key_Names[Key_Count] = {
|
|||||||
};*/
|
};*/
|
||||||
|
|
||||||
bool Key_States[Key_Count];
|
bool Key_States[Key_Count];
|
||||||
bool Key_GetPressed(Key key) { return Key_States[key]; }
|
bool Key_IsPressed(Key key) { return Key_States[key]; }
|
||||||
|
|
||||||
void Key_SetPressed(Key key, bool pressed) {
|
void Key_SetPressed(Key key, bool pressed) {
|
||||||
if (Key_States[key] != pressed || Key_KeyRepeat) {
|
if (Key_States[key] != pressed || Key_KeyRepeat) {
|
||||||
Key_States[key] = pressed;
|
Key_States[key] = pressed;
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
Event_RaiseInt32(&KeyEvents_KeyDown, key);
|
Event_RaiseInt32(&KeyEvents_Down, key);
|
||||||
} else {
|
} else {
|
||||||
Event_RaiseInt32(&KeyEvents_KeyUp, key);
|
Event_RaiseInt32(&KeyEvents_Up, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,16 +78,16 @@ void Key_Clear(void) {
|
|||||||
|
|
||||||
|
|
||||||
bool MouseButton_States[MouseButton_Count];
|
bool MouseButton_States[MouseButton_Count];
|
||||||
bool Mouse_GetPressed(MouseButton btn) { return MouseButton_States[btn]; }
|
bool Mouse_IsPressed(MouseButton btn) { return MouseButton_States[btn]; }
|
||||||
|
|
||||||
void Mouse_SetPressed(MouseButton btn, bool pressed) {
|
void Mouse_SetPressed(MouseButton btn, bool pressed) {
|
||||||
if (MouseButton_States[btn] != pressed) {
|
if (MouseButton_States[btn] != pressed) {
|
||||||
MouseButton_States[btn] = pressed;
|
MouseButton_States[btn] = pressed;
|
||||||
|
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
Event_RaiseInt32(&MouseEvents_ButtonDown, btn);
|
Event_RaiseInt32(&MouseEvents_Down, btn);
|
||||||
} else {
|
} else {
|
||||||
Event_RaiseInt32(&MouseEvents_ButtonUp, btn);
|
Event_RaiseInt32(&MouseEvents_Up, btn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,13 +95,13 @@ void Mouse_SetPressed(MouseButton btn, bool pressed) {
|
|||||||
void Mouse_SetWheel(Real32 wheel) {
|
void Mouse_SetWheel(Real32 wheel) {
|
||||||
Real32 delta = wheel - Mouse_Wheel;
|
Real32 delta = wheel - Mouse_Wheel;
|
||||||
Mouse_Wheel = wheel;
|
Mouse_Wheel = wheel;
|
||||||
Event_RaiseReal32(&MouseEvents_WheelChanged, delta);
|
Event_RaiseReal32(&MouseEvents_Wheel, delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mouse_SetPosition(Int32 x, Int32 y) {
|
void Mouse_SetPosition(Int32 x, Int32 y) {
|
||||||
Int32 deltaX = x - Mouse_X, deltaY = y - Mouse_Y;
|
Int32 deltaX = x - Mouse_X, deltaY = y - Mouse_Y;
|
||||||
Mouse_X = x; Mouse_Y = y;
|
Mouse_X = x; Mouse_Y = y;
|
||||||
Event_RaiseMouseMove(&MouseEvents_Move, deltaX, deltaY);
|
Event_RaiseMouseMove(&MouseEvents_Moved, deltaX, deltaY);
|
||||||
}
|
}
|
||||||
|
|
||||||
Key KeyBind_Keys[KeyBind_Count];
|
Key KeyBind_Keys[KeyBind_Count];
|
||||||
@ -130,7 +130,7 @@ const UInt8* KeyBind_Names[KeyBind_Count] = {
|
|||||||
|
|
||||||
Key KeyBind_Get(KeyBind binding) { return KeyBind_Keys[binding]; }
|
Key KeyBind_Get(KeyBind binding) { return KeyBind_Keys[binding]; }
|
||||||
Key KeyBind_GetDefault(KeyBind binding) { return KeyBind_Defaults[binding]; }
|
Key KeyBind_GetDefault(KeyBind binding) { return KeyBind_Defaults[binding]; }
|
||||||
bool KeyBind_GetPressed(KeyBind binding) { return Key_States[KeyBind_Keys[binding]]; }
|
bool KeyBind_IsPressed(KeyBind binding) { return Key_States[KeyBind_Keys[binding]]; }
|
||||||
|
|
||||||
#define KeyBind_MakeName(name) String_Clear(&name); String_AppendConst(&name, "key-"); String_AppendConst(&name, KeyBind_Names[i]);
|
#define KeyBind_MakeName(name) String_Clear(&name); String_AppendConst(&name, "key-"); String_AppendConst(&name, KeyBind_Names[i]);
|
||||||
|
|
||||||
|
@ -31,98 +31,66 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
typedef enum Key_ {
|
typedef enum Key_ {
|
||||||
/* Key outside the known keys */
|
Key_Unknown, /* Key outside the known keys */
|
||||||
Key_Unknown,
|
|
||||||
|
|
||||||
/* Modifiers */
|
|
||||||
Key_ShiftLeft, Key_ShiftRight, Key_ControlLeft, Key_ControlRight,
|
Key_ShiftLeft, Key_ShiftRight, Key_ControlLeft, Key_ControlRight,
|
||||||
Key_AltLeft, Key_AltRight, Key_WinLeft, Key_WinRight, Key_Menu,
|
Key_AltLeft, Key_AltRight, Key_WinLeft, Key_WinRight, Key_Menu,
|
||||||
|
|
||||||
/* Function keys (hopefully enough for most keyboards - mine has 26)
|
|
||||||
/ <keysymdef.h> on X11 reports up to 35 function keys. */
|
|
||||||
Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
|
Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
|
||||||
Key_F11, Key_F12, Key_F13, Key_F14, Key_F15, Key_F16, Key_F17, Key_F18, Key_F19, Key_F20,
|
Key_F11, Key_F12, Key_F13, Key_F14, Key_F15, Key_F16, Key_F17, Key_F18, Key_F19, Key_F20,
|
||||||
Key_F21, Key_F22, Key_F23, Key_F24, Key_F25, Key_F26, Key_F27, Key_F28, Key_F29, Key_F30,
|
Key_F21, Key_F22, Key_F23, Key_F24, Key_F25, Key_F26, Key_F27, Key_F28, Key_F29, Key_F30,
|
||||||
Key_F31, Key_F32, Key_F33, Key_F34, Key_F35,
|
Key_F31, Key_F32, Key_F33, Key_F34, Key_F35,
|
||||||
|
|
||||||
/* Direction arrows */
|
|
||||||
Key_Up, Key_Down, Key_Left, Key_Right,
|
Key_Up, Key_Down, Key_Left, Key_Right,
|
||||||
|
|
||||||
/* Action keys */
|
|
||||||
Key_Enter, Key_Escape, Key_Space, Key_Tab, Key_BackSpace, Key_Insert,
|
Key_Enter, Key_Escape, Key_Space, Key_Tab, Key_BackSpace, Key_Insert,
|
||||||
Key_Delete, Key_PageUp, Key_PageDown, Key_Home, Key_End, Key_CapsLock,
|
Key_Delete, Key_PageUp, Key_PageDown, Key_Home, Key_End, Key_CapsLock,
|
||||||
Key_ScrollLock, Key_PrintScreen, Key_Pause, Key_NumLock,
|
Key_ScrollLock, Key_PrintScreen, Key_Pause, Key_NumLock,
|
||||||
|
|
||||||
/* Keypad keys */
|
|
||||||
Key_Keypad0, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Keypad4,
|
Key_Keypad0, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Keypad4,
|
||||||
Key_Keypad5, Key_Keypad6, Key_Keypad7, Key_Keypad8, Key_Keypad9,
|
Key_Keypad5, Key_Keypad6, Key_Keypad7, Key_Keypad8, Key_Keypad9,
|
||||||
Key_KeypadDivide, Key_KeypadMultiply, Key_KeypadSubtract,
|
Key_KeypadDivide, Key_KeypadMultiply, Key_KeypadSubtract,
|
||||||
Key_KeypadAdd, Key_KeypadDecimal, Key_KeypadEnter,
|
Key_KeypadAdd, Key_KeypadDecimal, Key_KeypadEnter,
|
||||||
|
|
||||||
/* Letters */
|
|
||||||
Key_A, Key_B, Key_C, Key_D, Key_E, Key_F, Key_G, Key_H, Key_I, Key_J,
|
Key_A, Key_B, Key_C, Key_D, Key_E, Key_F, Key_G, Key_H, Key_I, Key_J,
|
||||||
Key_K, Key_L, Key_M, Key_N, Key_O, Key_P, Key_Q, Key_R, Key_S, Key_T,
|
Key_K, Key_L, Key_M, Key_N, Key_O, Key_P, Key_Q, Key_R, Key_S, Key_T,
|
||||||
Key_U, Key_V, Key_W, Key_X, Key_Y, Key_Z,
|
Key_U, Key_V, Key_W, Key_X, Key_Y, Key_Z,
|
||||||
|
|
||||||
/* Numbers */
|
|
||||||
Key_0, Key_1, Key_2, Key_3, Key_4,
|
Key_0, Key_1, Key_2, Key_3, Key_4,
|
||||||
Key_5, Key_6, Key_7, Key_8, Key_9,
|
Key_5, Key_6, Key_7, Key_8, Key_9,
|
||||||
|
|
||||||
/* Symbols */
|
|
||||||
Key_Tilde, Key_Minus, Key_Plus, Key_BracketLeft, Key_BracketRight,
|
Key_Tilde, Key_Minus, Key_Plus, Key_BracketLeft, Key_BracketRight,
|
||||||
Key_Semicolon, Key_Quote, Key_Comma, Key_Period, Key_Slash, Key_BackSlash,
|
Key_Semicolon, Key_Quote, Key_Comma, Key_Period, Key_Slash, Key_BackSlash,
|
||||||
|
|
||||||
Key_Count,
|
Key_Count,
|
||||||
} Key;
|
} Key;
|
||||||
|
|
||||||
/* Gets whether the given key is currently being pressed. */
|
|
||||||
bool Key_GetPressed(Key key);
|
|
||||||
/* Sets whether the given key is currently being pressed. */
|
|
||||||
void Key_SetPressed(Key key, bool pressed);
|
|
||||||
|
|
||||||
#define Key_IsAltPressed() (Key_GetPressed(Key_AltLeft) || Key_GetPressed(Key_AltRight))
|
|
||||||
#define Key_IsControlPressed() (Key_GetPressed(Key_ControlLeft) || Key_GetPressed(Key_ControlRight))
|
|
||||||
#define Key_IsShiftPressed() (Key_GetPressed(Key_ShiftLeft) || Key_GetPressed(Key_ShiftRight))
|
|
||||||
#define Key_IsWinPressed() (Key_GetPressed(Key_WinLeft) || Key_GetPressed(Key_WinRight))
|
|
||||||
|
|
||||||
/* Gets whether key repeating is on or not. If on (desirable for text input), multiple KeyDowns (varies by OS)
|
/* Gets whether key repeating is on or not. If on (desirable for text input), multiple KeyDowns (varies by OS)
|
||||||
are generated for the same key when it is held down for a period of time. Should be off for game input. */
|
are generated for the same key when it is held down for a period of time. Should be off for game input. */
|
||||||
bool Key_KeyRepeat;
|
bool Key_KeyRepeat;
|
||||||
/* Names for each key. */
|
|
||||||
extern const UInt8* Key_Names[Key_Count];
|
extern const UInt8* Key_Names[Key_Count];
|
||||||
|
|
||||||
/* Unpresses all keys that were previously pressed. */
|
#define Key_IsAltPressed() (Key_IsPressed(Key_AltLeft) || Key_IsPressed(Key_AltRight))
|
||||||
|
#define Key_IsControlPressed() (Key_IsPressed(Key_ControlLeft) || Key_IsPressed(Key_ControlRight))
|
||||||
|
#define Key_IsShiftPressed() (Key_IsPressed(Key_ShiftLeft) || Key_IsPressed(Key_ShiftRight))
|
||||||
|
#define Key_IsWinPressed() (Key_IsPressed(Key_WinLeft) || Key_IsPressed(Key_WinRight))
|
||||||
|
bool Key_IsPressed(Key key);
|
||||||
|
void Key_SetPressed(Key key, bool pressed);
|
||||||
void Key_Clear(void);
|
void Key_Clear(void);
|
||||||
|
|
||||||
|
|
||||||
typedef enum MouseButton_ {
|
typedef enum MouseButton_ {
|
||||||
/* The left mouse button. */
|
MouseButton_Left, MouseButton_Right, MouseButton_Middle,
|
||||||
MouseButton_Left,
|
MouseButton_Button1, MouseButton_Button2,
|
||||||
/* The right mouse button. */
|
|
||||||
MouseButton_Right,
|
|
||||||
/* The middle mouse button. */
|
|
||||||
MouseButton_Middle,
|
|
||||||
/* The first extra mouse button. */
|
|
||||||
MouseButton_Button1,
|
|
||||||
/* The second extra mouse button. */
|
|
||||||
MouseButton_Button2,
|
|
||||||
|
|
||||||
MouseButton_Count,
|
MouseButton_Count,
|
||||||
} MouseButton;
|
} MouseButton;
|
||||||
|
|
||||||
/* Gets whether the given mouse button is currently being pressed. */
|
|
||||||
bool Mouse_GetPressed(MouseButton btn);
|
|
||||||
/* Sets whether the given mouse button is currently being pressed. */
|
|
||||||
void Mouse_SetPressed(MouseButton btn, bool pressed);
|
|
||||||
|
|
||||||
/* Gets the current wheel value of the mouse. */
|
|
||||||
Real32 Mouse_Wheel;
|
Real32 Mouse_Wheel;
|
||||||
/* Gets the current position of the mouse. */
|
|
||||||
Int32 Mouse_X, Mouse_Y;
|
Int32 Mouse_X, Mouse_Y;
|
||||||
|
|
||||||
/* Sets the current wheel value of the mouse. */
|
bool Mouse_IsPressed(MouseButton btn);
|
||||||
|
void Mouse_SetPressed(MouseButton btn, bool pressed);
|
||||||
void Mouse_SetWheel(Real32 wheel);
|
void Mouse_SetWheel(Real32 wheel);
|
||||||
/* Sets the current position of the mouse. */
|
|
||||||
void Mouse_SetPosition(Int32 x, Int32 y);
|
void Mouse_SetPosition(Int32 x, Int32 y);
|
||||||
|
|
||||||
|
|
||||||
@ -140,13 +108,9 @@ typedef enum KeyBind_ {
|
|||||||
KeyBind_Count
|
KeyBind_Count
|
||||||
} KeyBind;
|
} KeyBind;
|
||||||
|
|
||||||
/* Gets the keyboard key that the given binding maps to. */
|
|
||||||
Key KeyBind_Get(KeyBind binding);
|
Key KeyBind_Get(KeyBind binding);
|
||||||
/* Gets the default keyboard key that the given binding maps to. */
|
|
||||||
Key KeyBind_GetDefault(KeyBind binding);
|
Key KeyBind_GetDefault(KeyBind binding);
|
||||||
/* Gets whether the keyboard key that the given maps to is currently pressed. */
|
bool KeyBind_IsPressed(KeyBind binding);
|
||||||
bool KeyBind_GetPressed(KeyBind binding);
|
|
||||||
/* Sets the keyboard key that the given binding maps to. */
|
|
||||||
void KeyBind_Set(KeyBind binding, Key key);
|
void KeyBind_Set(KeyBind binding, Key key);
|
||||||
/* Initalises and loads key bindings. */
|
/* Initalises and loads key bindings. */
|
||||||
void KeyBind_Init(void);
|
void KeyBind_Init(void);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
|
|
||||||
bool Inventory_CanChangeSelected(void) {
|
bool Inventory_CanChangeSelected(void) {
|
||||||
if (!Inventory_CanChangeHeldBlock) {
|
if (!Inventory_CanChangeHeldBlock) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define CC_WORLDLIGHTING_H
|
#define CC_WORLDLIGHTING_H
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "GameStructs.h"
|
#include "GameStructs.h"
|
||||||
/* Manages lighting of blocks in the world.
|
/* Manages lighting of blocks in the world.
|
||||||
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "ModelCache.h"
|
#include "ModelCache.h"
|
||||||
#include "GraphicsAPI.h"
|
#include "GraphicsAPI.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "IModel.h"
|
#include "IModel.h"
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Lighting.h"
|
#include "Lighting.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
#include "GraphicsCommon.h"
|
#include "GraphicsCommon.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
|
|
||||||
GfxResourceID pickedPos_vb;
|
GfxResourceID pickedPos_vb;
|
||||||
PackedCol pickedPos_col;
|
PackedCol pickedPos_col;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "Screens.h"
|
#include "Screens.h"
|
||||||
#include "Widgets.h"
|
#include "Widgets.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "GraphicsCommon.h"
|
#include "GraphicsCommon.h"
|
||||||
|
|
||||||
void Screen_FreeWidgets(Widget** widgets, UInt32 widgetsCount) {
|
void Screen_FreeWidgets(Widget** widgets, UInt32 widgetsCount) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "AsyncDownloader.h"
|
#include "AsyncDownloader.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
#include "SkyboxRenderer.h"
|
#include "SkyboxRenderer.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GraphicsAPI.h"
|
#include "GraphicsAPI.h"
|
||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
#include "Events.h"
|
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "2DStructs.h"
|
#include "2DStructs.h"
|
||||||
#include "VertexStructs.h"
|
#include "VertexStructs.h"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define CC_SKYBOXRENDERER_H
|
#define CC_SKYBOXRENDERER_H
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
#include "Stream.h"
|
#include "Stream.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "GameStructs.h"
|
#include "GameStructs.h"
|
||||||
/* Renders a skybox.
|
/* Renders a skybox.
|
||||||
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
Copyright 2014-2017 ClassicalSharp | Licensed under BSD-3
|
||||||
|
@ -2,12 +2,11 @@
|
|||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "GraphicsAPI.h"
|
#include "GraphicsAPI.h"
|
||||||
#include "GraphicsEnums.h"
|
#include "GraphicsEnums.h"
|
||||||
#include "GraphicsCommon.h"
|
#include "GraphicsCommon.h"
|
||||||
#include "Events.h"
|
|
||||||
#include "PackedCol.h"
|
#include "PackedCol.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Vectors.h"
|
#include "Vectors.h"
|
||||||
|
@ -405,7 +405,7 @@ void HotbarWidget_Free(GuiElement* elem) { }
|
|||||||
bool HotbarWidget_HandlesKeyDown(GuiElement* elem, Key key) {
|
bool HotbarWidget_HandlesKeyDown(GuiElement* elem, Key key) {
|
||||||
if (key >= Key_1 && key <= Key_9) {
|
if (key >= Key_1 && key <= Key_9) {
|
||||||
Int32 index = key - Key_1;
|
Int32 index = key - Key_1;
|
||||||
if (KeyBind_GetPressed(KeyBind_HotbarSwitching)) {
|
if (KeyBind_IsPressed(KeyBind_HotbarSwitching)) {
|
||||||
/* Pick from first to ninth row */
|
/* Pick from first to ninth row */
|
||||||
Inventory_SetOffset(index * INVENTORY_BLOCKS_PER_HOTBAR);
|
Inventory_SetOffset(index * INVENTORY_BLOCKS_PER_HOTBAR);
|
||||||
HotbarWidget* widget = (HotbarWidget*)elem;
|
HotbarWidget* widget = (HotbarWidget*)elem;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Input.h"
|
#include "Input.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
|
|
||||||
#define win_Style WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
|
#define win_Style WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN
|
||||||
@ -192,7 +192,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
new_focused_state = LOWORD(wParam) != 0;
|
new_focused_state = LOWORD(wParam) != 0;
|
||||||
if (new_focused_state != win_Focused) {
|
if (new_focused_state != win_Focused) {
|
||||||
win_Focused = new_focused_state;
|
win_Focused = new_focused_state;
|
||||||
Event_RaiseVoid(&WindowEvents_OnFocusedChanged);
|
Event_RaiseVoid(&WindowEvents_FocusChanged);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -211,7 +211,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
Point2D new_location = Point2D_Make(pos->x, pos->y);
|
Point2D new_location = Point2D_Make(pos->x, pos->y);
|
||||||
if (!Point2D_Equals(Window_GetLocation(), new_location)) {
|
if (!Point2D_Equals(Window_GetLocation(), new_location)) {
|
||||||
win_Bounds.X = pos->x; win_Bounds.Y = pos->y;
|
win_Bounds.X = pos->x; win_Bounds.Y = pos->y;
|
||||||
Event_RaiseVoid(&WindowEvents_OnMove);
|
Event_RaiseVoid(&WindowEvents_Moved);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size2D new_size = Size2D_Make(pos->cx, pos->cy);
|
Size2D new_size = Size2D_Make(pos->cx, pos->cy);
|
||||||
@ -227,7 +227,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
|
||||||
|
|
||||||
if (suppress_resize <= 0) {
|
if (suppress_resize <= 0) {
|
||||||
Event_RaiseVoid(&WindowEvents_OnResize);
|
Event_RaiseVoid(&WindowEvents_Resized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,14 +254,14 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
|
|
||||||
if (new_state != win_State) {
|
if (new_state != win_State) {
|
||||||
win_State = new_state;
|
win_State = new_state;
|
||||||
Event_RaiseVoid(&WindowEvents_OnWindowStateChanged);
|
Event_RaiseVoid(&WindowEvents_WindowStateChanged);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
keyChar = Convert_UnicodeToCP437((UInt16)wParam);
|
keyChar = Convert_UnicodeToCP437((UInt16)wParam);
|
||||||
Event_RaiseInt32(&KeyEvents_KeyPress, keyChar);
|
Event_RaiseInt32(&KeyEvents_Press, keyChar);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
@ -273,14 +273,14 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
/* Once we receive a mouse move event, it means that the mouse has re-entered the window. */
|
/* Once we receive a mouse move event, it means that the mouse has re-entered the window. */
|
||||||
mouse_outside_window = false;
|
mouse_outside_window = false;
|
||||||
Window_EnableMouseTracking();
|
Window_EnableMouseTracking();
|
||||||
Event_RaiseVoid(&WindowEvents_OnMouseEnter);
|
Event_RaiseVoid(&WindowEvents_MouseEnter);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_MOUSELEAVE:
|
case WM_MOUSELEAVE:
|
||||||
mouse_outside_window = true;
|
mouse_outside_window = true;
|
||||||
/* Mouse tracking is disabled automatically by the OS */
|
/* Mouse tracking is disabled automatically by the OS */
|
||||||
Event_RaiseVoid(&WindowEvents_OnMouseLeave);
|
Event_RaiseVoid(&WindowEvents_MouseLeave);
|
||||||
|
|
||||||
/* Set all mouse buttons to off when user leaves window, prevents them being stuck down. */
|
/* Set all mouse buttons to off when user leaves window, prevents them being stuck down. */
|
||||||
for (btn = 0; btn < MouseButton_Count; btn++) {
|
for (btn = 0; btn < MouseButton_Count; btn++) {
|
||||||
@ -402,7 +402,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
Event_RaiseVoid(&WindowEvents_OnClosing);
|
Event_RaiseVoid(&WindowEvents_Closing);
|
||||||
Window_Destroy();
|
Window_Destroy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -410,7 +410,7 @@ LRESULT CALLBACK Window_Procedure(HWND handle, UINT message, WPARAM wParam, LPAR
|
|||||||
win_Exists = false;
|
win_Exists = false;
|
||||||
UnregisterClassA(win_ClassName, win_Instance);
|
UnregisterClassA(win_ClassName, win_Instance);
|
||||||
if (win_DC != NULL) ReleaseDC(win_Handle, win_DC);
|
if (win_DC != NULL) ReleaseDC(win_Handle, win_DC);
|
||||||
Event_RaiseVoid(&WindowEvents_OnClosed);
|
Event_RaiseVoid(&WindowEvents_Closed);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return DefWindowProcA(handle, message, wParam, lParam);
|
return DefWindowProcA(handle, message, wParam, lParam);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "ErrorHandler.h"
|
#include "ErrorHandler.h"
|
||||||
#include "String.h"
|
#include "String.h"
|
||||||
#include "Platform.h"
|
#include "Platform.h"
|
||||||
#include "Events.h"
|
#include "Event.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "Block.h"
|
#include "Block.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user