~ Formatting
This commit is contained in:
parent
ef791e2f3c
commit
96ea792656
|
|
@ -1,15 +0,0 @@
|
|||
EXAMPLE.Name = "Textarea"
|
||||
|
||||
EXAMPLE.EnableConsole = true
|
||||
|
||||
EXAMPLE.Files = {
|
||||
"main.cpp"
|
||||
}
|
||||
|
||||
EXAMPLE.Libraries = {
|
||||
"NazaraSDK"
|
||||
}
|
||||
|
||||
if Config.PlatformSDL2 then
|
||||
table.insert(EXAMPLE.Defines, "NAZARA_PLATFORM_SDL2")
|
||||
end
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
// Sources pour https://github.com/DigitalPulseSoftware/NazaraEngine/wiki/(FR)-Tutoriel:-%5B01%5D-Hello-World
|
||||
|
||||
#include <Nazara/Graphics.hpp>
|
||||
#include <Nazara/Renderer.hpp>
|
||||
#include <Nazara/Utility.hpp>
|
||||
#include <NDK/Application.hpp>
|
||||
#include <NDK/Components.hpp>
|
||||
#include <NDK/Systems.hpp>
|
||||
#include <NDK/World.hpp>
|
||||
#include <NDK/Canvas.hpp>
|
||||
#include <NDK/Widgets/TextAreaWidget.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Ndk::Application application(argc, argv);
|
||||
|
||||
Nz::RenderWindow& mainWindow = application.AddWindow<Nz::RenderWindow>();
|
||||
mainWindow.Create(Nz::VideoMode(800, 600, 32), "Test");
|
||||
|
||||
|
||||
Ndk::World& world = application.AddWorld();
|
||||
world.GetSystem<Ndk::RenderSystem>().SetGlobalUp(Nz::Vector3f::Down());
|
||||
world.GetSystem<Ndk::RenderSystem>().SetDefaultBackground(Nz::ColorBackground::New(Nz::Color(117, 122, 214)));
|
||||
|
||||
|
||||
Ndk::EntityHandle viewEntity = world.CreateEntity();
|
||||
viewEntity->AddComponent<Ndk::NodeComponent>();
|
||||
|
||||
Ndk::CameraComponent& viewer = viewEntity->AddComponent<Ndk::CameraComponent>();
|
||||
viewer.SetTarget(&mainWindow);
|
||||
viewer.SetProjectionType(Nz::ProjectionType_Orthogonal);
|
||||
|
||||
Ndk::EntityHandle text = world.CreateEntity();
|
||||
Ndk::NodeComponent& nodeComponent = text->AddComponent<Ndk::NodeComponent>();
|
||||
|
||||
Ndk::Canvas canvas(world.CreateHandle(), mainWindow.GetEventHandler(), mainWindow.GetCursorController().CreateHandle());
|
||||
canvas.SetFixedSize(Nz::Vector2f(mainWindow.GetSize()));
|
||||
|
||||
auto textarea = canvas.Add<Ndk::TextAreaWidget>();
|
||||
textarea->EnableBackground(true);
|
||||
textarea->SetBackgroundColor(Nz::Color(0, 0, 0, 150));
|
||||
textarea->SetTextColor(Nz::Color::White);
|
||||
textarea->EnableMultiline();
|
||||
|
||||
textarea->SetFixedSize(canvas.GetSize()/2);
|
||||
|
||||
/*Nz::Boxf textBox = mainWindow.GetSize();
|
||||
Nz::Vector2ui windowSize = mainWindow.GetSize();
|
||||
nodeComponent.SetPosition(windowSize.x / 2 - textBox.width / 2, windowSize.y / 2 - textBox.height / 2);*/
|
||||
|
||||
while (application.Run())
|
||||
{
|
||||
mainWindow.Display();
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
@ -2,8 +2,6 @@
|
|||
// This file is part of the "Nazara Engine - Platform module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
// Un grand merci à Laurent Gomila pour la SFML qui m'aura bien aidé à réaliser cette implémentation
|
||||
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <Nazara/Core/ConditionVariable.hpp>
|
||||
|
|
@ -392,9 +390,7 @@ namespace Nz
|
|||
case Nz::Keyboard::VKey::NumpadReturn:
|
||||
case Nz::Keyboard::VKey::Return:
|
||||
if (window->m_lastEditEventLength != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
window->m_parent->PushEvent(evt);
|
||||
|
||||
evt.type = WindowEventType_TextEntered;
|
||||
|
|
@ -445,7 +441,7 @@ namespace Nz
|
|||
evt.type = WindowEventType_TextEntered;
|
||||
evt.text.repeated = false;
|
||||
|
||||
for (decltype(evt.text.character)codepoint : String::Unicode(event->text.text).Simplify().GetUtf32String())
|
||||
for (decltype(evt.text.character) codepoint : String::Unicode(event->text.text).Simplify().GetUtf32String())
|
||||
{
|
||||
evt.text.character = codepoint;
|
||||
|
||||
|
|
|
|||
|
|
@ -745,9 +745,8 @@ namespace Nz
|
|||
|
||||
#if defined(NAZARA_PLATFORM_SDL2)
|
||||
if (SDL_VideoInit(NULL) != 0)
|
||||
{
|
||||
NazaraError(SDL_GetError());
|
||||
}
|
||||
|
||||
#elif defined(NAZARA_PLATFORM_GLX)
|
||||
Initializer<X11> display;
|
||||
if (!display)
|
||||
|
|
|
|||
Loading…
Reference in New Issue