Comments (14)
works fine on my end
https://gyazo.com/ea0db6fa854c25978772442132ced106
you'll need to modify some of the form stuff though, so you can still move the window around as usual.
explicit Window(HINSTANCE inst, const std::string& class_name, const std::string& window_name = "") : m_wnd_class{ 0 } , m_hwnd{ nullptr } {
m_wnd_class.hInstance = inst;
m_wnd_class.lpszClassName = class_name.c_str();
// allocate only one device context for all windows.
m_wnd_class.style = CS_CLASSDC;
// ptr to wndproc.
m_wnd_class.lpfnWndProc = window_proc;
m_wnd_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
if (!RegisterClassA(&m_wnd_class))
return;
m_hwnd = CreateWindowA(class_name.c_str(), window_name.c_str(), WS_POPUP, 300, 300, 392, 356, GetDesktopWindow(), nullptr, m_wnd_class.hInstance, nullptr);
if (!m_hwnd)
return;
}
void ui_work(HINSTANCE inst) {
Window window(inst, Utils::random_string(10));
Device device(window.m_hwnd);
// don't call SetWindowLong( window.m_hwnd, GWL_STYLE, WS_POPUP );
ShowWindow(window.m_hwnd, SW_SHOW);
UpdateWindow(window.m_hwnd);
MSG msg;
ZeroMemory(&msg, sizeof msg);
if (!IsWindowVisible(window.m_hwnd))
break;
if (PeekMessageA(&msg, nullptr, 0, 0, PM_REMOVE)) {
if (!input.ProcessMessage(&msg)) {
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
}
else {
render(device.m_device);
}
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
from deadcell-oshgui.
i also need help with this
@EternityX any solutions please?
from deadcell-oshgui.
I've never had this issue but I'll look into it.
from deadcell-oshgui.
I've never had this issue but I'll look into it.
it's not really an issue just an eye challenging thing since default deadcell oshgui / oshgui has this so you can move around the window:
https://imgur.com/a/ToR2lHk
if you replace the window flag from WS_OVERLAPPED to WS_POPUP that thing will go away but as soon you try to move the gui this will happen: (if you move the gui the black thing doesn't follow it)
https://imgur.com/a/MWGhSxh
from deadcell-oshgui.
thank you! :)
from deadcell-oshgui.
Thank you :P
from deadcell-oshgui.
doesn't seem to work :\
from deadcell-oshgui.
You need to call MoveWindow when moving the form.
void Form::CaptionBar::OnMouseMove(const MouseMessage &mouse)
something like this (bad way of doing it but you get the point)
if (drag_) {
POINT p;
RECT pr;
GetCursorPos(&p);
int x = GetParent()->GetLocation().X + (p.x - dragStart_.X);
int y = GetParent()->GetLocation().Y + (p.y - dragStart_.Y);
GetWindowRect(GetActiveWindow(), &pr);
MoveWindow(GetActiveWindow(), x - 6, y - 10, pr.right - pr.left, pr.bottom - pr.top, true);
GetParent()->SetLocation(GetParent()->GetLocation() + (mouse.GetLocation() - dragStart_));
dragStart_ = mouse.GetLocation();
}
from deadcell-oshgui.
thank you worked perfectly!
from deadcell-oshgui.
also do you know anything about the cpu usage? since it's at around 30-40 without even touching anything.
@EternityX
from deadcell-oshgui.
you can just sleep for 1ms at the end of your thread
from deadcell-oshgui.
thank you!
from deadcell-oshgui.
hi @EternityX today i got around making slider float but i got some problems with it:
cpu usage goes + 10 if in the tab im using it theres a sliderfloat
and also it prints random value insteand of 5.5 5.6: example: got the slider on 3.2 but if i print the value it's: 3.18987 but i just want it to be default 3.2
maybe i'm doing something wrong
std::once_flag once_flag;
std::call_once( once_flag, [&] {
*value = default_value;
} );
TrackBar* track = new TrackBar( );
track->SetFont( fontBold );
track->SetPrecision( 1 );
track->SetLocation( location );
track->SetText( text );
track->SetMinimum( min );
track->SetMaximum( max );
auto *timer = new OSHGui::Timer( );
timer->SetInterval( 5 );
timer->Start( );
parent->AddControl( timer );
parent->AddControl( track );
timer->GetTickEvent( ) += OSHGui::TickEventHandler( [track, value, color]( Control *sender ) {
track->SetBackColor( Color::FromARGB( color ) );
track->SetValue( *value );
} );
track->GetValueChangedEvent( ) += OSHGui::ValueChangedEventHandler( [track, value]( Control *sender ) {
*value = track->GetValue( );
} );
}
from deadcell-oshgui.
any reply @EternityX ? sorry for being annoying
from deadcell-oshgui.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deadcell-oshgui.