Adding commands for menus and whatnot + project setup for GMTK 2025

This commit is contained in:
Safariminer 2025-07-30 15:21:26 -04:00
parent d8dc877da6
commit b33ddd47ca
26 changed files with 272 additions and 6 deletions

View File

@ -0,0 +1,24 @@
<!-- Test window for MPFW IMGUI impl -->
<window>
<title>Test Window 2</title>
<menubar>
<menu>
<title>File</title>
<item>
<title>Load Test Map</title>
<command mode="1">map "data/maps/testmpfw.bsp"</command>
</item>
<item>
<title>Quit game</title>
<command mode="0">quit</command>
</item>
</menu>
<menu>
<title>E1M2</title>
<item>
<title>Play</title>
<command mode="1">map "data/maps/fullquake/e1m2.bsp"</command>
</item>
</menu>
</menubar>
</window>

View File

@ -0,0 +1,5 @@
echo "GMTK 2025"
echo "Made with MPFW"
echo ""
show_cursor
ui_create_window "data/menus/mainmenu.wnd"

View File

@ -0,0 +1,91 @@
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,22 @@
<window>
<title>GMTK 2025</title>
<menubar>
<menu>
<title>File</title>
<item>
<title>New game</title>
<command mode="0">echo "this should be a new game"</command>
</item>
<item>
<title>Quit</title>
<command mode="0">quit</command>
</item>
</menu>
</menubar>
</window>

BIN
gmtk2025/data/palette.lmp Normal file

Binary file not shown.

View File

@ -11,6 +11,32 @@ MPFW_ConsoleCommand(echo) {
*logStr += "\n";
}
MPFW_ConsoleCommand(ui_create_window) {
if(cmd.size() != 1){
*logStr += "'ui_create_window' command usage:\n ui_create_window <path to window file>\n";
return;
}
try{
MPFW::UI::Window wnd(cmd[0]);
ctx->ui->windows.push_back(wnd);
}
catch (std::exception& e) {
*logStr += "Error on window creation: ";
*logStr += e.what();
*logStr += "\n";
}
catch (...) {
*logStr += "Unknown error on window creation\n";
}
}
MPFW_ConsoleCommand(ui_delete_window) {
if (cmd.size() != 1) {
}
}
MPFW_ConsoleCommand(quit) {
exit(0); // some day there'll be proper unloading :3
}
@ -96,6 +122,11 @@ MPFW::Console::CommandHandler::CommandHandler(CommandHandlerResources* c)
CommandID quakeMap = { QUAKE, "map" };
functionMap[quakeMap] = map_quake;
CommandID uiCreateWindow = { MPFW, "ui_create_window" };
functionMap[uiCreateWindow] = ui_create_window;
#pragma endregion System Commands
}

9
mpfw/MPFW_Net.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "MPFW_Net.h"
void MPFW::Net::AppLevel::Auth::AuthServer::ConnectToAuthServer(::MPFW::Net::System::Address address, UserInfo user)
{
}
void MPFW::Net::System::Socket::Connect(SocketInfo __info)
{
}

75
mpfw/MPFW_Net.h Normal file
View File

@ -0,0 +1,75 @@
#pragma once
// net module for MPFW
#include <iostream>
#include <vector>
#include <map>
#include <functional>
#define MPFW_NetCallback(x) void x(std::string packet, Socket* socket)
namespace MPFW {
namespace Net {
// low-level operations for addresses, protocols, sockets, etc.,
// basically a raylib-compatible asio wrapper for windows compiling purposes.
// mpfw works on a system of relay servers and auth'd apps through an external
// auth server. these functions aren't going to be used very often outside of
// predefined engine declarations.
namespace System {
struct Address {
std::string ip; // human-readable internet address(domain name or internet protocol address(v4))
int port;
};
using NetCallback = std::function<void >;
enum SocketType {
TCP, UDP
};
struct SocketInfo {
SocketType type;
Address address;
};
class Socket {
SocketInfo info;
public:
Socket() {}
Socket(SocketInfo __info) { Connect(__info); }
void Connect(SocketInfo __info);
std::function<void(std::string, Socket*)> connectCallback;
std::function<void(std::string, Socket*)> receiveCallback;
std::function<void(std::string, Socket*)> disconnectCallback;
~Socket() {}
};
}
namespace AppLevel {
namespace Auth {
struct UserInfo {
std::string username, password;
};
class AuthServer {
public:
AuthServer() {}
AuthServer(::MPFW::Net::System::Address address, UserInfo user) { ConnectToAuthServer(address, user); }
void ConnectToAuthServer(::MPFW::Net::System::Address address, UserInfo user);
};
}
class AppInterface {
public:
void Connect(::MPFW::Net::System::Address address, ::MPFW::Net::AppLevel::Auth::AuthServer auth);
};
}
}
}

View File

@ -202,9 +202,9 @@ int main() {
uiRenderer.cmh = &cmdH;
MPFW::UI::Window wndw("data/menus/test.wnd");
// MPFW::UI::Window wndw("data/menus/test.wnd");
uiRenderer.windows.push_back(wndw);
// uiRenderer.windows.push_back(wndw);
// rlSetClipPlanes(1, INFINITY);
camera.position = { 0,5,0 };
@ -256,9 +256,10 @@ int main() {
camera.position.y = 5;
velocity.y = 0;
if(IsKeyPressed(KEY_SPACE)){
velocity.y += 320*GetFrameTime();
velocity.y += wishSpeed*0.5*GetFrameTime();
}
Accelerate();
}
else {
AirAccelerate(wishVel);
@ -269,6 +270,7 @@ int main() {
if (IsKeyPressed(KEY_F)) indivFaceMode = !indivFaceMode;
velocity *= {GetFrameTime(), 1, GetFrameTime()};
}
if (IsKeyPressed(KEY_ESCAPE)) {
@ -282,7 +284,6 @@ int main() {
}
}
velocity *= {GetFrameTime(), 1, GetFrameTime()};
camera.position += velocity;
camera.target = camera.position + rotation;
BeginDrawing();

View File

@ -148,6 +148,7 @@
<ClCompile Include="MPFW_Console.cpp" />
<ClCompile Include="MPFW_CVars.cpp" />
<ClCompile Include="MPFW_HL.cpp" />
<ClCompile Include="MPFW_Net.cpp" />
<ClCompile Include="MPFW_Quake.cpp" />
<ClCompile Include="MPFW_UI.cpp" />
<ClCompile Include="MPFW_Utils.cpp" />
@ -157,6 +158,7 @@
<ClInclude Include="MPFW_CVars.h" />
<ClInclude Include="MPFW_HL.h" />
<ClInclude Include="MPFW_MPFWMF.h" />
<ClInclude Include="MPFW_Net.h" />
<ClInclude Include="MPFW_Quake.h" />
<ClInclude Include="MPFW_UI.h" />
<ClInclude Include="MPFW_Utils.h" />

View File

@ -60,6 +60,9 @@
<ClCompile Include="..\deps\include\rlImGui.cpp">
<Filter>ext.</Filter>
</ClCompile>
<ClCompile Include="MPFW_Net.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="MPFW_HL.h">
@ -83,5 +86,8 @@
<ClInclude Include="MPFW_UI.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MPFW_Net.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)/gameenv</LocalDebuggerWorkingDirectory>
<LocalDebuggerWorkingDirectory>$(SolutionDir)/gmtk2025</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)/gameenv</LocalDebuggerWorkingDirectory>
<LocalDebuggerWorkingDirectory>$(SolutionDir)/gmtk2025</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>