KeenQuill
-
- Posts: 69
- Joined: Sat Sep 26, 2009 10:49 pm
- Location: Mississippi, USA
KeenQuill
Hey guys! I'm working on a utility called KeenQuill, which will let the user edit the STORYTXT.CKxx files in a user-friendly way.
What I need it to do is display the ASCII file as Keenxx.exe would.
Then, the user could edit the text file and KeenQuill would refresh the window every time the user pressed a key.
Could anyone give me some help with this? I'm writing it in Python, because QBASIC just isn't working for me.
Unless someone could help me on the QBASIC front..
SO, to recap, I need the code that Keen:Vorticons uses to parse the STORYTXT.CKxx files.
What I need it to do is display the ASCII file as Keenxx.exe would.
Then, the user could edit the text file and KeenQuill would refresh the window every time the user pressed a key.
Could anyone give me some help with this? I'm writing it in Python, because QBASIC just isn't working for me.
Unless someone could help me on the QBASIC front..
SO, to recap, I need the code that Keen:Vorticons uses to parse the STORYTXT.CKxx files.
-
- Posts: 120
- Joined: Wed Dec 16, 2009 5:20 pm
The character values correspond directly to rows and columns in xFON0000.bmp. For example, the bullet point 0x09 is row 0, column 9 in the bitmap. The black on white characters correspond with standard ASCII and the red on gray ones are ASCII+0x80. The status screen patch works the same way but with the two halves swapped so that the pizza is at 0x00 and the black square is 0x80.
The special case for STORYTXT is that '~' appears to add 0x80 all characters between it and the line break. Also character 0x1F/0x9F seems to get replaced with a space for no apparent reason.
The special case for STORYTXT is that '~' appears to add 0x80 all characters between it and the line break. Also character 0x1F/0x9F seems to get replaced with a space for no apparent reason.
-
- Posts: 69
- Joined: Sat Sep 26, 2009 10:49 pm
- Location: Mississippi, USA
-
- Posts: 120
- Joined: Wed Dec 16, 2009 5:20 pm
You need a graphics library. Rendering the font the way Keen does it is trivial for any decent graphics system. I know for a fact SDL can do it, and bindings for Python are available. Trying to do this in a text-mode app isn't going to be much better than a standard text-editor.
Edit: Are you using text-mode? or are you using a GUI toolkit? Most GUI toolkits support custom drawing routines which should be just as good as SDL for this.
Edit: Are you using text-mode? or are you using a GUI toolkit? Most GUI toolkits support custom drawing routines which should be just as good as SDL for this.
-
- Posts: 69
- Joined: Sat Sep 26, 2009 10:49 pm
- Location: Mississippi, USA
Well, my Python setup includes Wxpython, with which I am not very familiar. Could you give me some bindings for that? Tkinter is OK too.
EDIT: Here's what I have so far:
EDIT: Here's what I have so far:
Code: Select all
import wx
from wx.lib.wordwrap import wordwrap
class MyApp(wx.App):
def __init__(self, redirect=False, filename=None):
wx.App.__init__(self, redirect, filename)
self.frame = wx.Frame(None, wx.ID_ANY, title='KeenQuill BETA')
self.panel = wx.Panel(self.frame, wx.ID_ANY)
# copy the code for the AboutBox
# change the button's parent to refer to my panel
b = wx.Button(self.panel, -1, "About KeenQuill", (0,10))
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
self.frame.Show()
def OnButton(self, evt):
# First we create and fill the info object
info = wx.AboutDialogInfo()
info.Name = "KeenQuill"
info.Version = "BETA"
info.Copyright = "(C) 2009 Raymond Patrick"
info.Description = wordwrap(
"KeenQuill is a utility that modifies the story text in Keen:Vorticons."
"Eventually it will be expanded to modify the Help and Previews screens"
"as well. Please note, this beta is not a stable release, and I am not "
"liable for any damage that this program may cause to your computer. ",
# change the wx.ClientDC to use self.panel instead of self
350, wx.ClientDC(self.panel))
info.WebSite = ("http://keenmodding.org", "The Keen:Modding site")
info.Developers = [ "Ray Patrick (thehackercat)",
"The folks at K:M",
"The folks at the PCKF" ]
# change the wx.ClientDC to use self.panel instead of self
info.License = wordwrap(licenseText, 500, wx.ClientDC(self.panel))
# Then we call wx.AboutBox giving it that info object
wx.AboutBox(info)
overview = """<html><body>
<h2><center>wx.AboutBox</center></h2>
This function shows the native standard about dialog containing the
information specified in info. If the current platform has a native
about dialog which is capable of showing all the fields in info, the
native dialog is used, otherwise the function falls back to the
generic wxWidgets version of the dialog.
</body></html>
"""
licenseText = "This program can be freely distributed. Do not distribute this program commercially and be sure to give me credit if you make changes to the source code."
if __name__ == '__main__':
app = MyApp()
app.MainLoop()
-
- Posts: 69
- Joined: Sat Sep 26, 2009 10:49 pm
- Location: Mississippi, USA
-
- Posts: 69
- Joined: Sat Sep 26, 2009 10:49 pm
- Location: Mississippi, USA
If you want to use SDL you might be using C/C++. There are ports for other languages, but I doubt, that they are as solid. The documentation of SDL is not even the best. I learned a lot of things by trail and error.
A good tutorial is here:
http://lazyfoo.net/SDL_tutorials/index.php
A good tutorial is here:
http://lazyfoo.net/SDL_tutorials/index.php