Commit graph

700 commits

Author SHA1 Message Date
Bill Currie
ad83422c56 [qwaq] Adapt startup code for use in a game engine
Until now, the new qwaq startup was used only in command-line tools and
console applications where things like Ruamoko security and having a
hunk were not an issue. Now the start up code (qwaq-*.c) can specify
that Ruamoko is to be secured and provide a hunk on a per-thread basis,
and the thread data is passed into the progs code via a progs resource.
2021-12-24 06:45:13 +09:00
Bill Currie
d3853a2430 [qwaq] Update qwaq-x11's initialization
It now uses the advanced command line parsing used by qwaq-curses and
qwaq-cmd, but currently disables multi-threading (I don't want to deal
with threading in the engine just yet). The int file is -graphics
because qwaq-x11 is really just the X11 target, qwaq-win is built for
windows, but they use the same basic startup (I hope).
2021-12-24 06:45:13 +09:00
Bill Currie
0e7e88815c [qwaq] Fix up file headers 2021-12-24 06:45:13 +09:00
Bill Currie
97c3cbf719 [qwaq] Rename input.c
It's very specialized toward terminal input (ie, for qwaq-curses).
2021-12-24 06:45:13 +09:00
Bill Currie
7892382639 [qwaq] Remove obsolete file
I don't remember when it was last used, and deleting it saves me the
hassle of sorting out its header :P
2021-12-24 06:45:13 +09:00
Bill Currie
2086125e0b [quakefs] Take in the pointer to the global hunk
This is needed for cleaning up excess memsets when loading files because
Hunk_RawAllocName has nonnull on its hunk pointer (as the rest of the
hunk functions really should, but not just yet).
2021-12-24 06:45:13 +09:00
Bill Currie
84a24dbb34 [renderer] Make R_RenderView private
This is actually a better solution to the renderer directly accessing
client code than provided by 7e078c7f9c.

Essentially, V_RenderView should not have been calling R_RenderView, and
CL_UpdateScreen should have been calling V_RenderView directly. The
issue was that the renderers expected the world entity model to be valid
at all times. Now, R_RenderView checks the world entity model's validity
and immediately bails if it is not, and R_ClearState (which is called
whenever the client disconnects and thus no longer has a world to
render) clears the world entity model. Thus R_RenderView can (and is)
now called unconditionally from within the renderer, simplifying
renderer-specific variants.
2021-12-24 06:45:12 +09:00
Bill Currie
d8a836e9da [input] Add broadcast events for app focus gain/loss
These are for when the application itself gains or loses focus, rather
than individual event handlers.
2021-11-22 14:59:32 +09:00
Bill Currie
3ac6d2aa22 [x11] Use barriers to trap the pointer in the window
This should be a much friendlier way of "grabbing" input, though I
suspect that using raw keyboard events will result in a keyboard grab,
which is part of the reason for wanting a friendly grab.

There does seem to be a problem with the mouse sneaking out of the
top-right and bottom-left corners. I currently suspect a bug in the X
server, but further investigation is needed.
2021-11-22 14:59:27 +09:00
Bill Currie
52c5f0545b [input] Add broadcast event for application window changes
This is the first step in the long-sought goal of allowing the window
size to change, but is required for passing on getting window position
and size information (though size is in viddef, it makes sense to pass
both together).
2021-11-22 13:20:13 +09:00
Bill Currie
e45d19835c [x11] Add initial support for XInput2
Right now, only raw pointer motion and button events are handled, and
the mouse escapes the window, and there are some issues with focus in
focus-follows-mouse environments. However, this should be a much nicer
setup than DGA.
2021-11-21 23:42:33 +09:00
Bill Currie
b892ce637a [input] Nuke IN_Move from orbit
gotta be sure :)

On a serious note, it was always a problem in that it had
client-specific code and concepts embedded in the libraries.
2021-11-19 08:58:02 +09:00
Bill Currie
b95c749438 [input] Add a per-device event data pointer
This might pose a problem with multiple event targets (we'll see), but
it will make connecting input devices to bindings much easier.
2021-11-10 13:22:10 +09:00
Bill Currie
4898a44263 [console] Hook up new input system
This has smashed the keydest handling for many things, and bindings, but
seems to be a good start with the new input system: the console in
qw-client-x11 is usable (keyboard-only).

The button and axis values have been removed from the knum_t enum as
mouse events are separate from key events, and other button and axis
inputs will be handled separately.

keys.c has been disabled in the build as it is obsolute (thus much of
the breakage).
2021-11-08 11:20:04 +09:00
Bill Currie
825d8b7a49 [input] Make a start on the new binding system
Input Mapping Tables are still at the core as they are a good concept,
however they include both axis and button mappings, and the size is not
hard-coded, but dependent on the known devices. Not much actually works
yet (nq segfaults when a key is pressed).
2021-11-03 19:02:39 +09:00
Bill Currie
09e3e62a0a [input] Move in_event.h and binding defs
They now live in the include QF/input directory. This cleans up include/QF
a little, and input.h as well.
2021-11-01 13:05:05 +09:00
Bill Currie
665790f562 [video] Remove libQFjs
It is now redundant with the libQFinput, though nothing actually works yet.
2021-11-01 12:30:45 +09:00
Bill Currie
abe77523ae [qwaq] Disable xterm mouse handling on shutdown
Getting mouse escape codes on the command line is not very pleasant
(even if display-only).
2021-10-29 10:16:42 +09:00
Bill Currie
cacf0be7f6 [util] Wrap fd_set
While select itself is reasonably portable, it turns out that including
the declaration for fd_set makes a bit of a mess for QF's clean headers.
2021-09-28 10:53:51 +09:00
Bill Currie
7f408351b9 [input] Use a single select call for all drivers
For drivers that support it. Polling is still supported and forces the
select timeout to 0 if any driver requires polling. For now, the default
timeout when all drivers use select is 10ms.
2021-09-26 15:11:07 +09:00
Bill Currie
1d86a18eb1 [qwaq] Be paranoid about memcpy and null pointers
Although I suspect memcpy does the right thing when the byte count is 0,
the man page wasn't explicit and this is more portable.
2021-09-26 12:05:16 +09:00
Bill Currie
ac25d9f1c1 [qwaq] Fix window closure
Now the device windows close properly when an input device is removed.
2021-09-26 10:35:24 +09:00
Bill Currie
13bc38a55b [input,ruamoko,qwaq] Fix incorrect use of PR_RESMAP
I had forgotten that _size was the number of rows in the map, not the
number of objects (1024 objects per row). This fixes the missed device
removal messages. And probably a slew of other bugs I'd yet to encounter
:P
2021-09-25 15:50:16 +09:00
Bill Currie
4057500acc [qwaq] Implement device management for input-app
Currently shows only the axes (along with dev "path" and name), but it
has done a good job of pushing dev of other bits of code :)
2021-09-25 14:22:19 +09:00
Bill Currie
1a5cce4374 [qwaq] Set table cell size in the correct place
I have no idea why I made LocalsData set the size instead of TableView,
but now the cells are correctly sized automatically.
2021-09-25 13:27:55 +09:00
Bill Currie
0df16fb210 [qwaq] Fix TableView's scrolling 2021-09-25 10:53:39 +09:00
Bill Currie
0a60f46a64 [qwaq] Implement more debugger def views
Structs and arrays now work (though could be better, eg collapsible).
2021-09-25 01:42:36 +09:00
Bill Currie
6f71ef6657 [qwaq] Separate out mouse (de)init code
This is the simplest fix for the curses/input initialization order
issue. The terminal io code should still be moved to its own file,
really, but I think it can wait.
2021-09-23 13:14:42 +09:00
Bill Currie
72900fd16b [qwaq] Move input handling to its own thread
As it is now a completely separate sub-system, there is a bit of trouble
with mouse handling in that curses must be initialized before input for
the mouse to work properly, but the basic scheme seems to be working
nicely. I suspect the solution to the init order issue is to make have
the curses sub-system initialize the terminal input driver, at least for
mouse input (ie, maybe just enable/disable mouse handing).
2021-09-22 16:22:11 +09:00
Bill Currie
e942fe6528 [qwaq] Add input test app
The queues in the curses resources struct have been cleaned up and the
threading support code (including for the queues (pipes, really)) has
been moved to its own file.

The input test app currently just prints the devices and the events as
they come in, but demonstrates the new input system working in a
separate thread (though it is currently in with the curses thread).
2021-09-21 12:58:10 +09:00
Bill Currie
106ab86c3e [qwaq] Move the ui code into a library 2021-09-20 15:31:50 +09:00
Bill Currie
5d1e515e9e [qwaq] Hook up input to a certain extent
Really, just enough to show that the initialization process and hotplug
are working. The qwaq input driver is not yet properly integrated.
2021-08-30 09:59:30 +09:00
Bill Currie
a91dac60d9 [input] Start work on improved input system
The common input code (input outer loop and event handling) has been
moved into libQFinput, and modified to have the concept of input drivers
that are registered by the appropriate system-level code (x11, win,
etc).

As well, my evdev input library code (with hotplug support) has been
added, but is not yet fully functional. However, the idea is that it
will be available on all systems that support evdev (Linux, and from
what I've read, FreeBSD).
2021-08-27 09:10:21 +09:00
Bill Currie
54604d9aa2 [util] Make hunk (optionally) thread-safe
For now, the functions check for a null hunk pointer and use the global
hunk (initialized via Memory_Init) if necessary. However, Hunk_Init is
available (and used by Memory_Init) to create a hunk from any arbitrary
memory block. So long as that block is 64-byte aligned, allocations
within the hunk will remain 64-byte aligned.
2021-07-29 11:43:27 +09:00
Bill Currie
49c3dacbbc [util] Rename set_size to set_count
After seeing set_size and thinking it redundant (thought it returned the
capacity of the set until I checked), I realized set_count would be a
much better name (set_count (node->successors) in qfcc does make much
more sense).
2021-07-27 11:52:21 +09:00
Bill Currie
40a26e4bc8 [scene] Rename libQFentity to libQFscene
And start working on scene management.
2021-07-24 14:20:59 +09:00
Bill Currie
e799a7ae45 [qwaq] Readd libQFruamoko_client to qwaq-x11
Turned out it was needed after all (bad build test)
2021-07-22 18:08:13 +09:00
Bill Currie
e089234f38 [console] Link against libQFruamoko_console
Fixes shared plugin not loading due to missing symbol.
2021-07-22 18:01:18 +09:00
Bill Currie
34dd434147 [qwaq] Fix missing gib library references
Not sure why static builds worked and dynamic didn't, but...
2021-07-10 18:31:22 +09:00
Bill Currie
f18e1366ba [vulkan] Silence vkgen's debug output
It was hidden by qwaq-curses, but the switch to using qwaq-cmd made it
pretty obvious.
2021-07-06 12:27:21 +09:00
Bill Currie
ae58a8ba5d [qwaq] Create a commandline-only version of qwaq
qwaq-curses has its place, but its use for running vkgen was really a
placeholder because I didn't feel like sorting out the different
initialization requirements at the time. qwaq-cmd has the (currently
unnecessary) threading power of qwaq-curses, but doesn't include any UI
stuff and thus doesn't need curses. The work also paves the way for
qwaq-x11 to become a proper engine (though sorting out its init will be
taken care of later).

Fixes #15.
2021-07-06 12:25:24 +09:00
Bill Currie
e81d690b51 [input] Create QF input library using keys.c
This refactors (as such) keys.c so that it no longer depends on console
or gib, and pulls keys out of video targets. The eventual plan is to
move all high-level general input handling into libQFinput, and probably
low-level (eg, /dev/input handling for joysticks etc on Linux).

Fixes #8
2021-07-05 16:26:07 +09:00
Bill Currie
12ab283c22 [qwaq] Add a little z-transform program
And fix an error in floatview.

The z-transform program is so I can test out my math and eventually
develop some hopefully interesting sound generators.
2021-06-19 11:25:05 +09:00
Bill Currie
8db1957452 [ruamoko] Add bindings for exp() 2021-06-19 11:23:51 +09:00
Bill Currie
813497a1aa [ui] Create library for UI support code
Currently this has text buffer, input line, vrect and view code.
2021-06-12 22:50:51 +09:00
Bill Currie
2572011a4b [qwaq] Fix various scrollbar related issues
The editor now uses the vertical scrollbar for handling mouse wheel
scrolling, thus keeping the scrollbar in sync.

Scrollbar index can now cover the full range (not sure why I had that
-1), and the potential divide by zero is avoided properly.

Thumb-tab now positioned properly when the range is 0.
2021-06-12 01:30:44 +09:00
Bill Currie
f09810b595 [qwaq] Implement the remaining basic cursor motion
This gets all the basic cursor motion from my old editor working.
arrow keys: left/right/up/down char/line
home/end: beginning/end of line
page up/down

and ctrl versions where left/right are prev/next work, up/down skip over
indents, home/end are beginning/end of screen, and page up/down are
beginning/end of text.
2021-06-11 23:34:43 +09:00
Bill Currie
3cd0d68774 [qwaq] Implement word left and right
The word boundaries are currently vary simple, just transitions from
alnum_ (as it was in my old editor and in Borland's editors), but the
basic logic is working.
2021-06-11 10:14:07 +09:00
Bill Currie
75ce07a14c [qwaq] Implement home and end
Currently, home always moves the cursor to the very first column, but
I'm considering making it move the cursor to the first non-space
character of the line if it's not already there, otherwise to the first
column (ie, the cursor will toggle between the two positions if it's in
one of them).
2021-06-10 14:29:32 +09:00
Bill Currie
055ea46337 [qwaq] Fix page up/down and deal with tabs 2021-06-10 12:13:55 +09:00