Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: MultiScroll - dfhack plugin [OS X]  (Read 7008 times)

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
MultiScroll - dfhack plugin [OS X]
« on: May 26, 2014, 03:14:07 am »

Another tiny plugin to make life better. Multitouch (two-finger) map scrolling with touchpad or Magic Mouse on OS X. I'll probably later add some settings/modifiers for z and secondary scroll, so that most navigation can be done without moving right hand between touchpad and z-scroll/secondary scroll keys all the time.

Home Page / Sources -- Latest Release -- Report an Issue

lethosor

  • Bay Watcher
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #1 on: May 26, 2014, 08:41:30 pm »

Trying to compile this for r4 by adding it to plugins/CMakeLists.txt gives me a lot of strange, Objective C-related errors such as:
Code: [Select]
In file included from /System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:6:0,
                 from /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:5,
                 from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:10,
                 from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12,
                 from dfhack/plugins/multiscroll.mm:9:
/usr/include/objc/NSObject.h:41:1: error: stray '@' in program
I'm assuming this is because GCC is trying to compile it as C++. What additional flags did you set to compile it as Objective-C?

Also, it would be nice to include this in DFHack releases, although the "All rights reserved" at the top makes it unclear if this is possible. (It also claims to be "twbt.cpp" ;) )

This works really well on r3, though. Nice work!
« Last Edit: May 26, 2014, 08:46:41 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: MultiScroll - dfhack plugin [OS X]
« Reply #2 on: May 26, 2014, 09:09:13 pm »

Are you using GCC from MacPorts as per dfhack compilation instructions? Maybe it doesn't install Obj-C support (however that's strange). So I don't know - I haven't yet tried to compile these plugins as part of dfhack (and check my Makefile for flags to compile separately), and also I use system llvm/clang to build dfhack anyway.
But what if you just use my Makefile and change dfhack version in it (and paths)?

Oh that's automatically generated header, then I copied twbt to make this one, so never mind. However I don't know dfhack developers' position regarding platform-specific code or plugins.

lethosor

  • Bay Watcher
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #3 on: May 26, 2014, 10:04:49 pm »

I'm surprised that DFHack even builds with Clang. I'm using Homebrew's gcc, although I made sure to enable objective-c support. Apparently I failed to notice the makefile, so I'll try that (and see if I can make cmake work with it somehow).
I think the main concern with plugins is making them compatible with as many platforms as possible, but since this depends on an OS X feature, it's not as important here as with other plugins. Granted, it would be nice to support this on other platforms with the required hardware, but maintaining compatibility with all of them would be a nightmare.

Edit: Using the makefile works, although it seems to require gcc 4.2 (4.5 and up don't seem to recognize -std=gnu++11, -stdlib=libstdc++, or -Wno-ignored-attributes). I'll look into compatibility with gcc 4.5/cmake more when I get a chance.
« Last Edit: May 26, 2014, 10:27:56 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: MultiScroll - dfhack plugin [OS X]
« Reply #4 on: May 26, 2014, 10:30:17 pm »

Why not.. as far as I remember I only had to fix couple things in protobuf related to include names, and in dfhack tthread::* classes conflicted with something when used without namespace specified. It's all because of a different c++ stdlib.
I'm using only macs for a long time so I personally have no idea what multitouch hardware exists for Win/Linux is and how to work with it.

Not surprising, the Makefile is for clang as well:)

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #5 on: May 26, 2014, 11:30:35 pm »

Oh that's automatically generated header, then I copied twbt to make this one, so never mind. However I don't know dfhack developers' position regarding platform-specific code or plugins.
It's usually (in other projects as far as i know) frowned upon on copying pregenerated stuff (because it WILL change and then everything breaks), but nobody in df has yet to build plugins outside of dfhack library (you are the first :) ). Platform specific code is okay, specially for features like this, that don't really exist on other platforms.
However not sure about compiler specific code, if your plugin only builds on clang, and everything is built on gcc ver (some-old-version) there might be problems. For best results we are tied down to specific compilers on each platform.
Logged
My stuff (i'm working/thinking about):
Mini mod collection
pretty lights
Multiplayer

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: MultiScroll - dfhack plugin [OS X]
« Reply #7 on: June 20, 2014, 08:42:59 am »

Package updated to include a binary for dfhack r5.

Anybody using this?
Just in case somebody missed it. I find it a completely new experience being able to smoothly and quickly scroll the map in any direction. Sad Windows users can't try it.

lethosor

  • Bay Watcher
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #8 on: June 20, 2014, 09:08:14 am »

I use it. :) I think Fricy included it in the MacNewbie pack too, although I haven't checked.

One minor issue: when the screen is taller than the map, scrolling sideways causes the map to jump between the top and bottom of the screen (I notice this the most with x-by-1 embarks).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: MultiScroll - dfhack plugin [OS X]
« Reply #9 on: June 20, 2014, 09:09:01 am »

I use it. :) I think Fricy included it in the MacNewbie pack too, although I haven't checked.

One minor issue: when the screen is taller than the map, scrolling sideways causes the map to jump between the top and bottom of the screen (I notice this the most with x-by-1 embarks).

Yep, "known issue" :)

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #10 on: June 20, 2014, 02:52:29 pm »

Package updated to include a binary for dfhack r5.

Anybody using this?
Just in case somebody missed it. I find it a completely new experience being able to smoothly and quickly scroll the map in any direction. Sad Windows users can't try it.

To tell you the truth, not really, tried it, but haven't noticed anything on my old macbook, so I didn't bother up to now...
The reason for this post is that I'm testing dfhack-r5, but can't get it to load. I'm trying the new version from today, should be r5, but:
Code: [Select]
Can't load plugin /Users/fricy/Applications/Macnewbie_8.6/Macnewbie/Dwarf Fortress/hack/plugins/multiscroll.plug.soaaaaand:
No need to build anything, just update -r3 to -r5 with any hex editor ;)
I love you for this. :)

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: MultiScroll - dfhack plugin [OS X]
« Reply #11 on: June 20, 2014, 05:50:06 pm »

The reason for this post is that I'm testing dfhack-r5, but can't get it to load. I'm trying the new version from today, should be r5, but:

Hm.. I'll check if it references some non-standard libraries or something..
What OS X version do you have?

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #12 on: June 21, 2014, 02:01:30 am »

Hm.. I'll check if it references some non-standard libraries or something..
What OS X version do you have?
10.7.5

lethosor

  • Bay Watcher
    • View Profile
Re: MultiScroll - dfhack plugin [OS X]
« Reply #13 on: June 24, 2014, 07:27:09 pm »

Does stderr.log include anything about multiscroll? Plugins failing to load because of a version incompatibility should give a more detailed message than that in the DFHack console.
« Last Edit: June 24, 2014, 07:29:04 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.
Pages: [1] 2