Skip to content

Commit

Permalink
sdlconsole: fix compile
Browse files Browse the repository at this point in the history
  • Loading branch information
dhthwy committed Nov 15, 2024
1 parent 9537846 commit 2e9432b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions library/Console-sdl-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <ranges>
#include <condition_variable>
#include <cmath>
#include <cwctype>
//#include <cuchar>

#include "modules/DFSDL.h"
Expand Down Expand Up @@ -1220,7 +1221,7 @@ struct BMPFontLoader : public FontLoader {
}
};

struct MainWindow;
class MainWindow;

/*
* Shared context object for a window and its children, includes
Expand Down Expand Up @@ -2710,11 +2711,11 @@ class ExternalEventQueue {
ExternalEventQueue(const ExternalEventQueue&) = delete;
ExternalEventQueue& operator=(const ExternalEventQueue&) = delete;

using ApiTask = std::function<void()>;
Queue<ApiTask> api_task;

private:
std::mutex mutex;
public:
using ApiTask = std::function<void()>;
Queue<ApiTask> api_task;
};

void render_texture(
Expand All @@ -2733,11 +2734,12 @@ int set_draw_color(SDL_Renderer* renderer, const SDL_Color& color)
struct SDLConsole_pshare {
Property props;
std::weak_ptr<SDLConsole_impl> impl_weak;
std::thread::id render_thread_id{0};
//std::thread::id render_thread_id{0};
};

//static Uint32 render_frame_event_id{(Uint32)-1)};
struct SDLConsole_impl : public std::enable_shared_from_this<SDLConsole_impl> {
class SDLConsole_impl : public std::enable_shared_from_this<SDLConsole_impl> {
public:
Property& props;
SDLConsole::State& state;
SDLConsole_pshare& pshare;
Expand Down Expand Up @@ -2855,7 +2857,7 @@ bool SDLConsole::init()
if (!state.is_inactive()) return true;
bool success = true;
std::cerr << "SDLConsole: init() from thread: " << std::this_thread::get_id() << std::endl;
pshare->render_thread_id = std::this_thread::get_id();
//pshare->render_thread_id = std::this_thread::get_id();
try {
impl = std::make_shared<SDLConsole_impl>(this);
pshare->impl_weak = impl;
Expand Down
5 changes: 3 additions & 2 deletions library/Console-sdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,9 @@ int Console::lineedit(const std::string & prompt, std::string & output, CommandH

void Console::msleep (unsigned int msec)
{
if (msec > 1000) sleep(msec/1000000);
usleep((msec % 1000000) * 1000);
// FIXME: temporarily removed
//if (msec > 1000) sleep(msec/1000000);
//usleep((msec % 1000000) * 1000);
}

bool Console::hide()
Expand Down

0 comments on commit 2e9432b

Please sign in to comment.