intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Dec 17, 2017 6:25 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: Found: Qt Glk
PostPosted: Tue Aug 29, 2017 12:12 pm 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 404
Location: USA
I used a newer Qt Creator 4.3.1, but only downloaded the Qt 5.6.2 library.

I had to strip out a bunch of things related to printing - as it seems Qt 5.6.2 to 5.9.1 the text-edit example app had been rewritten with newer printer API. Some of the text editing QCombBox stuff was also broken, 3 lines commented out. But once I got past that, it compiled and ran fine on Qt 5.6.2 on my Ubuntu 17.04 desktop. I was able to pick a Glulx story and run it. Here is the printing code deleted and QComboBox code commented out: https://github.com/WakeRealityDev/Thund ... 24320be9c3


All the QJsonObject QJsonArray and QProcess stuff worked perfectly fine on Qt 5.6.2

You want to try this hacked out-branch? https://github.com/WakeRealityDev/Thund ... hackedout0

_________________
Glulx interpreter Android apps are in open beta testing! Three apps to watch for: Incant!, Thunderword, and Thunderword enhanced Text Fiction.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Tue Aug 29, 2017 2:21 pm 
Offline

Joined: Tue Nov 29, 2016 8:56 am
Posts: 68
allensocket wrote:
I used a newer Qt Creator 4.3.1, but only downloaded the Qt 5.6.2 library.
[...]
All the QJsonObject QJsonArray and QProcess stuff worked perfectly fine on Qt 5.6.2

You want to try this hacked out-branch? https://github.com/WakeRealityDev/Thund ... hackedout0


Thank you a lot for your time.
I have tried the branch with same result. I'm puzzled why QJson* libraries doesn't work, as you said, the documentation says they're supported since version 5.0. Might be a thing of the Ubuntu SDK?
I'm downloading Qt Creator 4.3.1 with libraries 5.6, 5.7 and 9.* let's see if I can compile it or is my system.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Tue Aug 29, 2017 3:41 pm 
Offline

Joined: Tue Nov 29, 2016 8:56 am
Posts: 68
I have installed Qt Creator 4.3.1, with Qt 5.6.2 (on the system) and compiled with no problems. So, I can confirm that the error is with my configuration of Ubuntu SDK or with the Ubuntu SDK itself


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Tue Aug 29, 2017 3:42 pm 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 404
Location: USA
cibersheep wrote:
I have installed Qt Creator 4.3.1, with Qt 5.6.2 (on the system) and compiled with no problems. So, I can confirm that the error is with my configuration of Ubuntu SDK or with the Ubuntu SDK itself


Cool. Is the *.gblorb filename search working on your system OK?

_________________
Glulx interpreter Android apps are in open beta testing! Three apps to watch for: Incant!, Thunderword, and Thunderword enhanced Text Fiction.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Tue Aug 29, 2017 4:31 pm 
Offline

Joined: Tue Nov 29, 2016 8:56 am
Posts: 68
allensocket wrote:
cibersheep wrote:
I have installed Qt Creator 4.3.1, with Qt 5.6.2 (on the system) and compiled with no problems. So, I can confirm that the error is with my configuration of Ubuntu SDK or with the Ubuntu SDK itself


Cool. Is the *.gblorb filename search working on your system OK?

Yes it is. I browse and then find. It lists all the .gblorb in the folder.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Wed Aug 30, 2017 4:35 am 
Offline
User avatar

Joined: Sat Jun 25, 2016 12:13 pm
Posts: 159
just catching up with this. Had a go at building for Windows/mingw. Works with a few changes.

I have problems (in general) building remglk for windows, some functions need changes. i have added files local.h & local.c that fix this, unless there's a secret windows build option or define i have missed.

here are my diffs:

Code:
Left base folder: V:\sw\Thunderquake_Qt
Right base folder: I:\sw\Thunderquake_Qt
--- remglk_desktop_src\glulxe\Makefile   2017-08-29 23:58:00.000000000 +0100
+++ remglk_desktop_src\glulxe\Makefile   2017-08-29 23:56:15.000000000 +0100
@@ -28,13 +28,14 @@
 #GLKMAKEFILE = ../Make.gtkglk
 
 # Pick a C compiler.
 CC = cc
 #CC = gcc
 
-OPTIONS = -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-unused -DOS_UNIX
+# want this change conditional !!
+OPTIONS = -g -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-unused #-DOS_UNIX
 
 # Locate the libxml2 library. You only need these lines if you are using
 # the VM_DEBUGGER option. If so, uncomment these and set appropriately.
 #XMLLIB = -L/usr/local/lib -lxml2
 #XMLLIBINCLUDEDIR = -I/usr/local/include/libxml2
 
---
+++ remglk_desktop_src\remglk\local.c   2017-08-29 23:08:53.000000000 +0100
@@ -0,0 +1,23 @@
+#include "local.h"
+
+#include <time.h>
+
+#ifdef _WIN32
+
+/* should be this, but bug in mingw it is missing from lib */
+time_t _mkgmtime(struct tm * a_tm)
+{
+    time_t ltime = mktime(a_tm);
+    struct tm tm_val;
+    gmtime_s(&tm_val, &ltime);
+    int offset = (tm_val.tm_hour - a_tm->tm_hour);
+    if (offset > 12)
+    {
+        offset = 24 - offset;
+    }
+    time_t utc = mktime(a_tm) - offset * 3600;
+    return utc;
+}
+
+#endif
+
---
+++ remglk_desktop_src\remglk\local.h   2017-08-29 23:08:38.000000000 +0100
@@ -0,0 +1,13 @@
+#pragma once
+
+#define bzero(_a, _b) memset(_a, 0, _b)
+
+#ifdef _WIN32
+
+/* should be this, but bug in mingw it is missing from lib */
+#define timegm _mkgmtime
+
+#define srandom srand
+#define random rand
+
+#endif
--- remglk_desktop_src\remglk\Makefile   2017-08-29 22:44:25.000000000 +0100
+++ remglk_desktop_src\remglk\Makefile   2017-08-29 23:57:20.000000000 +0100
@@ -8,28 +8,29 @@
 # and glk.h, glkstart.h, and Make.remglk in the include directory.
 
 # Pick a C compiler.
 #CC = cc
 CC = gcc -ansi
 
-OPTIONS = -g -Wall
+## want this option conditional on mingw
+OPTIONS = -g -Wall -D_POSIX_C_SOURCE
 
 CFLAGS = $(OPTIONS) $(INCLUDEDIRS)
 
 GLKLIB = libremglk.a
 
 REMGLK_OBJS = \
   main.o rgevent.o rgfref.o rggestal.o \
   rgdata.o rgmisc.o rgstream.o rgstyle.o \
   rgwin_blank.o rgwin_buf.o rgwin_grid.o rgwin_pair.o rgwin_graph.o \
   rgwindow.o rgschan.o rgblorb.o \
-  cgunicod.o cgdate.o gi_dispa.o gi_debug.o gi_blorb.o
+  cgunicod.o cgdate.o gi_dispa.o gi_debug.o gi_blorb.o local.o
 
 REMGLK_HEADERS = \
   remglk.h rgdata.h rgwin_blank.h rgwin_buf.h \
-  rgwin_grid.h rgwin_graph.h rgwin_pair.h gi_debug.h gi_dispa.h
+  rgwin_grid.h rgwin_graph.h rgwin_pair.h gi_debug.h gi_dispa.h local.h
 
 all: $(GLKLIB) Make.remglk
 
 cgunicod.o: cgunigen.c
 
 $(GLKLIB): $(REMGLK_OBJS)
--- remglk_desktop_src\remglk\remglk.h   2017-08-29 22:44:25.000000000 +0100
+++ remglk_desktop_src\remglk\remglk.h   2017-08-29 23:01:55.000000000 +0100
@@ -297,7 +297,9 @@
     )
 
 #ifdef NO_MEMMOVE
     extern void *memmove(void *dest, void *src, int n);
 #endif /* NO_MEMMOVE */
 
+#include "local.h"
+
 #endif /* REMGLK_H */
--- remglkprocess.cpp   2017-08-29 22:38:41.000000000 +0100
+++ remglkprocess.cpp   2017-08-29 23:49:06.000000000 +0100
@@ -108,13 +108,17 @@
 }
 
 void RemGlkProcess::setRemGlkEngine(int engineCode)
 {
     switch (enginePickA) {
     case 0:
+#ifdef Q_OS_WIN
+        appRemGlkBinaryPath = "./remglk_glulxe.exe";
+#else
         appRemGlkBinaryPath = "./remglk_glulxe";
+#endif       
         break;
     case 1:
         // if inside this APK use:
         appRemGlkBinaryPath = "../lib/lib_app_git.so";
         // if inside the Thunderfall APK, use this (or modify to be -2 APK variation)
         // NOTE: this needs to distinguish x86 vs arm CPU, currently does not
--- Thunderquake_Qt_GitHub.pro   2017-08-29 22:38:41.000000000 +0100
+++ Thunderquake_Qt_GitHub.pro   2017-08-29 23:25:14.000000000 +0100
@@ -14,12 +14,16 @@
 }
 equals(QT_ARCH,"x86_64") {
     DEFINES += HOST_ANDROID_X86
     CONFIG += android_x86
 }
 
+CONFIG(debug, debug|release) {
+    CONFIG += console
+}
+
 DEFINES += APPDEV_TEST_SETA=yes
 
 # developers working on the JSON Glk formatting can comment this out to get a full idea of the available output formatting options.
 DEFINES += HIDE_TEXT_EDIT_TOOLBARS=yes
 
 HEADERS         = \


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Wed Aug 30, 2017 5:28 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 404
Location: USA
jkj yuio wrote:
just catching up with this. Had a go at building for Windows/mingw. Works with a few changes.

I have problems (in general) building remglk for windows, some functions need changes.


On the topic of building RemGlk - and terps in general: there is an entirely new build system to try :) I'm in the process of updating this Qt examples (Thunderquake) and my Android Studio examples with it, but you can go directly to the source, Chris did all the work.

Basically the new build system takes all the terps from the long-standing Gargoyle project and splits them out into their own GitHub project - with a freshly written set of CMake makefiles. It also has a CMake makefile for each of the major Glk libraries - including RemGlk. Chris did a great job on this, and it's far better than all the stuff I've worked with for the past 12 months. This works very well with cross-compiling (Raspberry Pi, OpenWrt, Android, etc) and eliminates a lot of confusion with 6 year old Makefiles that reference obsolete tips about gcc 2.95, etc.

Here it is: https://github.com/cspiegel/terps - the project README has the steps you need to do - you will need to populate the RemGlk directory with the RemGlk source files - but all the other source files are there in the terps project.

I do have a Windows 10 system handy, so if you get stuck with this, I will try to help you. Comment back and tell us how it goes.

_________________
Glulx interpreter Android apps are in open beta testing! Three apps to watch for: Incant!, Thunderword, and Thunderword enhanced Text Fiction.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Wed Aug 30, 2017 6:32 am 
Offline

Joined: Tue Nov 29, 2016 8:56 am
Posts: 68
I'm starting to learn conditional cases in the building... So, you coud adapt the code if the os is windows for example.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Wed Aug 30, 2017 8:47 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 404
Location: USA
I'm glad two people tried it out so quickly. I was looking over the code on GitHub this morning and I know the code is pretty messy with comments and unused functions, but I'm fine with that because I've already seen a couple people get it up and running by just changing a few lines of code to adapt to Windows, etc.

I encourage you to comment the DEFINES += HIDE_TEXT_EDIT_TOOLBARS=yes and look at how this was assembled.

1. The Qt 5.9.1 Example Project "Text Edit" was opened.
2. A QProcess class is created to run the RemGlk process and exchange JSON.
3. A class was created to unwrap the JSON and put text into the QTextEdit body. A robot typing into the text editor.
4. I did add a file searcher thread that kicks off on app start to locate game data files. But mostly I did that to get a sense of programming background threads in Qt.

I encourage you to play around with the QTextEdit example app, in it's original state. Do what it says "If you are viewing this document in the textedit example, you can edit this document to explore Qt's rich text editing features. We have included some comments in each of the following sections to encourage you to experiment." That's your modern terminal, isn't it? Right there you can bold, italic, font change, indent, bullet list. I mean for mostly-text Interactive Fiction, this has got it all. And the code is simple, reasonably cross-platform, and it's quirks are well know as there are hundreds of active projects out there built around this.

RemGlk's JSON can be hand-read for the most-part. You can see the story text and get a sense of the story right with raw RemGlk. You can see the structure changes. The Qt QJsonArray and QJsonObject classes are easy to work with and are similar to libraries in Java and other languages. Now you are dealing with the story itself. Throw this code away if you want, start from scratch.

I encourage you to look at the Qt 5.9.1 example "WebEngine Markdown Editor Example", it has two window elements side-by side with source on the left and formatted HTML output on the right. Think JSON on the left, output on the right. Wire in a QProcess, start looping the QJsonObject and QJsonArray elements - you have another basic structure to work with. Is it fun enough we can get a decent app together? GlkOte could be brought into that "WebEngine Markdown Editor Example" app if you wanted - as it already knows how to talk to RemGlk and the dozen interpreters that RemGlk can link to: https://github.com/cspiegel/terps . Who is going to code that?

_________________
Glulx interpreter Android apps are in open beta testing! Three apps to watch for: Incant!, Thunderword, and Thunderword enhanced Text Fiction.


Top
 Profile Send private message  
Reply with quote  
 Post subject: Re: Found: Qt Glk
PostPosted: Thu Aug 31, 2017 9:21 am 
Offline
User avatar

Joined: Fri Sep 30, 2016 7:02 pm
Posts: 404
Location: USA
Anyone adding code? I hooked up the Qt WebView from MarkdownEdtior example to RemGlk backend and it seems to work fine. Will try to get an app together.

EDIT: Good News! I got GlkOte running with RemGlk in the Qt code. I'll put up on GitHub soon.

_________________
Glulx interpreter Android apps are in open beta testing! Three apps to watch for: Incant!, Thunderword, and Thunderword enhanced Text Fiction.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 64 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group