| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- #include <File.h>
- #include <FileSystem.h>
- #include <Font.h>
- #include <GraphicsApi.h>
- #include <main.h>
- #include <Network.h>
- #include <RenderThread.h>
- #include <Screen.h>
- #include <Window.h>
- #include "CustomDX12API.h"
- #include "Globals.h"
- #include "Initialization.h"
- #include "World.h"
- int KSGStart Framework::Start(Framework::Startparam p)
- {
- Network::Start(20);
- initVariables();
- setDebugDX(1);
- #ifdef _DEBUG
- Logging::LoggingChannel* outputDebugLoggingChannel
- = new Framework::Logging::OutputDebugStringLoggingChannel();
- Framework::Logging::zLoggingHandler()->addChannel(
- Logging::LogLevel::Error, outputDebugLoggingChannel);
- Framework::Logging::zLoggingHandler()->addChannel(Logging::LogLevel::Debug,
- dynamic_cast<Logging::LoggingChannel*>(
- outputDebugLoggingChannel->getThis()));
- Framework::Logging::zLoggingHandler()->addChannel(Logging::LogLevel::Info,
- dynamic_cast<Logging::LoggingChannel*>(
- outputDebugLoggingChannel->getThis()));
- Framework::Logging::zLoggingHandler()->addChannel(
- Logging::LogLevel::Warning,
- dynamic_cast<Logging::LoggingChannel*>(
- outputDebugLoggingChannel->getThis()));
- Framework::Logging::zLoggingHandler()->addChannel(Logging::LogLevel::Trace,
- dynamic_cast<Logging::LoggingChannel*>(
- outputDebugLoggingChannel->getThis()));
- #endif
- File d;
- d.setFile("data/schriften");
- auto list = d.getFileList();
- for (Text* fontFile : *list)
- {
- LTDSFile dat;
- dat.setPfad(
- new Text(Text("data/schriften/").operator+(fontFile->getText())));
- dat.readData();
- Text* name = fontFile->getTeilText(0, fontFile->getLength() - 5);
- fontRegister->put(*name, RCPointer<Font>::of(dat.loadFont()));
- name->release();
- }
- list->release();
- NativeWindow window;
- ::window = &window;
- WNDCLASS wc = Framework::F_Normal(p.hinst);
- wc.lpszClassName = "Factory Craft";
- window.create(WS_POPUPWINDOW, wc);
- Monitor m = Framework::getMonitor(0);
- window.setBounds(Point(m.x, m.y), Point(m.width, m.height));
- window.setDisplayMode(SW_SHOWNORMAL);
- window.setPreCloseAction([&window](void* p, void* f) {
- StopMessageLoop(window.getWindowHandle());
- });
- window.setMouseAction(_ret1ME);
- window.setKeyboardAction(_ret1TE);
- Screen3D screen(
- dynamic_cast<NativeWindow*>(window.getThis()), new CustomDX12API());
- screen.setHandleUserInputsOnTick(0);
- window.setScreen(dynamic_cast<Screen*>(screen.getThis()));
- screen.setFillColor(0);
- screen.setTestRend(0);
- uiFactory = Framework::defaultUI(fontRegister->get("normal"), &screen);
- uiFactory.createButton = createButton;
- uiFactory.createTextField = createTextField;
- uiFactory.createCheckBox = createCheckBox;
- uiFactory.createObjTable = createObjTable;
- uiFactory.createWindow = createWindow;
- initMenus();
- RenderTh rTh;
- rTh.setMaxFps(-1);
- rTh.setQuiet(0);
- rTh.setScreen(dynamic_cast<Screen*>(screen.getThis()));
- rTh.setTickFunktion([](void* p, void* o, double time) {
- if (World::INSTANCE)
- {
- World::INSTANCE->onTick(time);
- }
- });
- renderThread = &rTh;
- rTh.beginn();
- StartMessageLoop();
- rTh.terminate();
- releaseVariables();
- Network::Exit();
- return 0;
- }
|