Josh Posted May 28, 2021 Share Posted May 28, 2021 Windows GDI has some built-in text wrapping features but these are not available on Linux or in a 3D viewport. I did some additional work on my own textwrap fallback and now it seems faster than GDI's implementation. Reworked the slider behavior so the vertical area is strictly divided into lines. One nudge on the slider moves the text one full line. Holding the mouse button on the slider buttons won't generate a mouse repeat event because I am still doing some work on mutexes. The engine will use "fc-match" to try to determine the default system font. TextArea.zip 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted May 28, 2021 Share Posted May 28, 2021 Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted May 28, 2021 Author Share Posted May 28, 2021 How fast is the redraw when you resize the window quickly? I have only run it in a VM but it seems fast. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 28, 2021 Author Share Posted May 28, 2021 I updated the download above with a new build that support mouse repeat events. If you hold down on a slider arrow button the slider will keep scrolling until it reaches the end. I reworked the timer system to use the newer fdtimer system instead of horrible POSIX timers. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2021 Author Share Posted May 29, 2021 Code: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root, TEXTAREA_WORDWRAP); WString s = L"Night was falling now, and as I recalled what Akeley had written me about those earlier nights I shuddered to think there would be no moon. Nor did I like the way the farmhouse nestled in the lee of that colossal forested slope leading up to the Dark Mountains unvisited crest. With Akeleys permission I lighted a small oil lamp, turned it low, and set it on a distant bookcase beside the ghostly bust of Milton; but afterward I was sorry I had done so, for it made my hosts strained, immobile face and listless hands look damnably abnormal and corpselike. He seemed half-incapable of motion, though I saw him nod stiffly once in a while."; s = s + "\n\n" + s + "\n\n" + s; textarea->SetText(s); textarea->SetLayout(1,1,1,1); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
aiaf Posted May 29, 2021 Share Posted May 29, 2021 Redraw seems fast . When i maximize window and restore it back: there is for a split second some very large text shown on the window. Just click maximize restore couple of times and will see what i talk about. Quote I made this with Leadwerks/UAK: Structura | Stacky Desktop Edition Website: Binary Station Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2021 Author Share Posted May 29, 2021 I think Linux does a cross-fade when a window is maximized and minimized. Instead of doing a bunch of redraws at different sizes it stretches and fades the window contents. You can see the same thing in other applications. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2021 Author Share Posted May 29, 2021 If you want to disable this you can install Gnome Tweaks and turn off animations, BTW. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 29, 2021 Author Share Posted May 29, 2021 More code I am pasting here so I can grab it later: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE | WINDOW_CENTER); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root);//, TEXTAREA_WORDWRAP); //auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root, TEXTAREA_WORDWRAP); // WString s = L"HereISALONGLINEOFTEXTTHISGOESONAREALLYLONGTIMEOKLOL and here is some more!"; //WString s = L"Night was falling now, and as I recalled what Akeley had written me about those earlier nights I shuddered to think there would be no moon. Nor did I like the way the farmhouse nestled in the lee of that colossal forested slope leading up to the Dark Mountains unvisited crest. With Akeleys permission I lighted a small oil lamp, turned it low, and set it on a distant bookcase beside the ghostly bust of Milton; but afterward I was sorry I had done so, for it made my hosts strained, immobile face and listless hands look damnably abnormal and corpselike. He seemed half-incapable of motion, though I saw him nod stiffly once in a while."; WString s = L"I can't remember anything\n" "Can't tell if this is true or dream\n" "Deep down inside I feel to scream\n" "This terrible silence stops me\n" "Now that the war is through with me\n" "I'm waking up, I cannot see\n" "That there's not much left of me\n" "Nothing is real but pain now\n\n" "Hold my breath as I wish for death\n" "Oh please God, wake me\n\n" "Back in the womb, it's much too real\n" "In pumps life that I must feel\n" "But can't look forward to reveal\n" "Look to the time when I'll live\n" "Fed through the tube that sticks in me\n" "Just like a wartime novelty\n" "Tied to machines that make me be\n" "Cut this life off from me\n\n" "Hold my breath as I wish for death\n" "Oh please God, wake me\n\n" "Now the world is gone, I'm just one\n" "Oh God, help me\n\n" "Hold my breath as I wish for death\n" "Oh please God, help me\n\n" "Darkness imprisoning me\n" "All that I see\n" "Absolute horror\n" "I cannot live\n" "I cannot die\n" "Trapped in myself\n" "Body my holding cell\n\n" "Landmine has taken my sight\n" "Taken my speech\n" "Taken my hearing\n" "Taken my arms\n" "Taken my legs\n" "Taken my soul\n" "Left me with life in hell"; // s = s + "\n\n" + s + "\n\n" + s; textarea->SetText(s); textarea->SetLayout(1,1,1,1); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted May 30, 2021 Author Share Posted May 30, 2021 Makes a good demo: #include "UltraEngine.h" using namespace UltraEngine; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 640, 480, displays[0], WINDOW_TITLEBAR | WINDOW_RESIZABLE); //Create User Interface auto ui = CreateInterface(window); //Create widget auto sz = ui->root->ClientSize(); auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root, TEXTAREA_WORDWRAP); WString s = L"The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents. We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far. The sciences, each straining in its own direction, have hitherto harmed us little; but some day the piecing together of dissociated knowledge will open up such terrifying vistas of reality, and of our frightful position therein, that we shall either go mad from the revelation or flee from the deadly light into the peace and safety of a new dark age." "\n\nTheosophists have guessed at the awesome grandeur of the cosmic cycle wherein our world and human race form transient incidents. They have hinted at strange survivals in terms which would freeze the blood if not masked by a bland optimism. But it is not from them that there came the single glimpse of forbidden aeons which chills me when I think of it and maddens me when I dream of it. That glimpse, like all dread glimpses of truth, flashed out from an accidental piecing together of separated things, in this case an old newspaper item and the notes of a dead professor. I hope that no one else will accomplish this piecing out; certainly, if I live, I shall never knowingly supply a link in so hideous a chain. I think that the professor, too, intended to keep silent regarding the part he knew, and that he would have destroyed his notes had not sudden death seized him." "\n\nMy knowledge of the thing began in the winter of 1926-27 with the death of my grand-uncle George Gammell Angell, Professor Emeritus of Semitic Languages in Brown University, Providence, Rhode Island. Professor Angell was widely known as an authority on ancient inscriptions, and had frequently been resorted to by the heads of prominent museums; so that his passing at the age of ninety-two may be recalled by many. Locally, interest was intensified by the obscurity of the cause of death. The professor had been stricken whilst returning from the Newport boat; falling suddenly, as witnesses said, after having been jostled by a nautical-looking negro who had come from one of the queer dark courts on the precipitous hillside which formed a short cut from the waterfront to the deceased's home in Williams Street. Physicians were unable to find any visible disorder, but concluded after perplexed debate that some obscure lesion of the heart, induced by the brisk ascent of so steep a hill by so elderly a man, was responsible for the end. At the time I saw no reason to dissent from this dictum, but latterly I am inclined to wonder, and more than wonder." "\n\nAs my grand-uncle's heir and executor, for he died a childless widower, I was expected to go over his papers with some thoroughness; and for that purpose moved his entire set of files and boxes to my quarters in Boston. Much of the material which I correlated will be later published by the American Archaeological Society, but there was one box which I found exceedingly puzzling, and which I felt much averse from shewing to other eyes. It had been locked, and I did not find the key till it occurred to me to examine the personal ring which the professor carried always in his pocket. Then indeed I succeeded in opening it, but when I did so seemed only to be confronted by a greater and more closely locked barrier. For what could be the meaning of the queer clay bas-relief and the disjointed jottings, ramblings, and cuttings which I found Had my uncle, in his latter years, become credulous of the most superficial impostures? I resolved to search out the eccentric sculptor responsible for this apparent disturbance of an old man's peace of mind."; textarea->SetText(s); textarea->SetLayout(1,1,1,1); while (true) { const Event ev = WaitEvent(); switch (ev.id) { case EVENT_WINDOWCLOSE: return 0; break; } } return 0; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.