Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Elronnd

Pages: [1] 2
1
Programming / Re: Help me find a better language than C++
« on: October 29, 2017, 11:19:25 PM »
> "Compiling" to C sounds super safe, we all know C is such a great language in that.

And compiling DIRECTLY TO BINARY that runs STRAIGHT ON THE CPU is SAFER?

> It is kind of funny that we still have to use programming languages that were developed mainly in 1970's when for example graphical displays were quite rare and everything was text and command line based. As in linux development style today. I really think we need something better than anything we have today, with new kind of thinking that would remove all those tedious procedures we have in programming. Most of my problems in programming are technical problems that could have been solved by using more advanced built-in algorithms than what we have

If it ain't broke, don't fix it?  Can you give me something TANGIBLY wrong with all of programming, in general, today?  Anyway, it sounds like you're dismissing languages for no very good reason (nim compiles to c, it must be trash, I hate java like everyone else, d fails at fixing c++, I "have" to use c#).  Why don't you go and write your own programming language that completely fixes everything that's wrong with all these programming languages and is perfect and easy to work with and remakes all of modern programming first ;)

Oh, also, take a look at lisp first.

2
Programming / Re: Help me find a better language than C++
« on: August 09, 2017, 08:40:37 AM »
Try D (https://dlang.org/).  Among other things, it fixes a lot of the problems in c++.  Things that in c++ are cludges, feel native in D.  Also, it's the only language I know of that has a c++ FFI, meaning it can use (some) c++ libraries -- the FFI isn't perfect.  And like all languages, it has a (perfect) CFFI so you can trivially use any C library.

Someone else mentioned nim, that's a good language too.  I haven't found the fact that it compiles to c to be a problem, why would it?

3
Quote from: Elronnd
Is there a way to underline text or make it blink?  I can sort of make stuff underline by switching to another layer and printing ___, but there's a small gap in between them, and sometimes they overlap with the text in a way that's less than pleasing.
No, currently there is no such functionality. Underlining is theoretically possible (truetype fonts have some information and for bitmap fonts the library might try to do an educated guess).

Awww.  In that case, how does the cursor blink work?

4
Is there a way to underline text or make it blink?  I can sort of make stuff underline by switching to another layer and printing ___, but there's a small gap in between them, and sometimes they overlap with the text in a way that's less than pleasing.  Also, is there a way to get bold or italic text other than loading an alternate font?

5
Programming / Re: Roguelike graphics project
« on: March 26, 2017, 10:55:00 PM »
Looks like you need an invitation for this?

6
Alright, I set the log level right after terminal_open() and got this:


14:16:50.451 [info] Trying to set "window.fullscreen = true"
14:16:50.451 [debug] Group "window":
14:16:50.451 [debug] * "fullscreen" = "true"


Interestingly enough, if I alt+enter while within the window, it fullscreens fine.  Even more interestingly, if I set window.fullscreen = true, while the window doesn't get fullscreened, I can then resize it even though I haven't set window.resizeable to true.  I'm on 64-bit arch linux, fvwm, I get the same output on both gcc and clang.  If it's relevant, my command line is gcc -std=c11 -LLinux64/ -lBearLibTerminal -o test test.c.

7
Setting log.level = trace still didn't produce any output.  I'm on linux, btw.  Here's my snippet:


#include "Include/C/BearLibTerminal.h"

int main(void) {
        terminal_open();
        terminal_set("window.fullscreen = true");
        terminal_set("log.level = trace");
        terminal_refresh();
        terminal_read();
        terminal_close();
}


Here's my env:


FVWM_DATADIR=/usr/share/fvwm
_=/usr/bin/env
LANG=en_US.UTF-8
DISPLAY=:0
OLDPWD=/home/elronnd
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
XDG_VTNR=1
HG=/usr/bin/hg
XDG_SESSION_ID=c1
USER=elronnd
PWD=/home/elronnd/BearLibTerminal_0.15.1
MANPAGER=less
HOME=/home/elronnd
GTK_MODULES=canberra-gtk-module
MAIL=/var/spool/mail/elronnd
WINDOWPATH=1
TERM=xterm-256color
SHELL=/usr/bin/zsh
HOSTDISPLAY=localhost:0
SHLVL=4
XDG_SEAT=seat0
MAVEN_OPTS=-Xmx512m
LOGNAME=elronnd
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
FVWM_USERDIR=/home/elronnd/.fvwm
PATH=/home/elronnd/.cargo/bin:/home/elronnd/bin:/home/elronnd/.cargo/bin:/home/elronnd/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
FVWM_MODULEDIR=/usr/lib/fvwm/2.6.7
LD_LIBRARY_PATH=Linux64

8
It would probably make a lot more sense to use something like sdl-ttf -- https://www.libsdl.org/projects/SDL_ttf/docs/SDL_ttf.html -- which can handle that for you.  You have access to a lot more glyphs, and you don't have to do as much by hand.  https://github.com/Elronnd/roguelike-with-no-name/blob/master/interface/sdl-ttf.cc here's my sdl-ttf code.  It's kind of ugly, but it should give you the hang of how it works.  Be aware that if you do use sdl-ttf, you will have to do a lot of extra annoying work converting between sdl1 and sdl2 types -- sdl_ttf uses sdl1 types.

9
I'm experiencing a couple of problems.  First is that setting terminal_set("window.fullscreen = true"); doesn't do anything.  The second is that although if you set the window to be resizeable, you can resize it, if you try to get the terminal size you just get the original size.  Any workaround?  Are these known problems?

10
Is there a way to make blt interpret keyups as their own events?  The C header suggests that this is already the case by default, that when you press 'a', you get two events: 'a' and 'a'|TK_KEY_RELEASED:


/*
 * If key was released instead of pressed, it's code will be OR'ed with TK_KEY_RELEASED:
 * a) pressed 'A': 0x04
 * b) released 'A': 0x04|VK_KEY_RELEASED = 0x104
 */
#define TK_KEY_RELEASED     0x100


However, pressing and releasing 'a' seems to just be one event, and I can't find anything about it on the configuration page.  I ask specifically because I'm writing key-reading code, and basically I want to get the keypress into a struct like struct KeyPress { bool ctrl, alt; char ch; }.  Here's my current code http://vpaste.net/U2ZeG, but it doesn't work well, obviously.  I think I need to read keyup and keydown events separately, unless there's a better way.  How do?

11
Quote from: Elronnd
I made a set of D bindings! Now guaranteed not to segfault
Ah, in the end I was not fast enough =|. Good in any case!

Heh.  Yeah, it turned out that I just didn't know how to allocate memory properly.  I was going to write an sfml gui for my game, but then I decided I'd take just *one* more shot at getting bearlibterminal to work...and it did!

12
I made a set of D bindings!  Now guaranteed not to segfault: http://code.dlang.org/packages/bearlibterminal

13
Hi, is it possible to make it so that the cursor doesn't blink at all?  I tried setting terminal.set("input.cursor-blink-rate=0");, but that only made the cursor blink as fast as it could.  Can you special-case 0 so that the cursor doesn't blink at all when you set the cursor-blink-rate to 0; or set another boolean value, input.cursor-blink?

14
Some unicode doesn't seem to be supported.  The ╱ character, for example, which is supported by the font I'm using (I've verified this with SDL-TTF) just shows up as a black box in bearlibterminal.  Any fix?

15
It seems that bearlibterm leaks memory?  Just running the example C program, valgrind reports:

definitely lost: 520 bytes in 2 blocks
indirectly lost: 1,661 bytes in 14 blocks

Full valgrind log: http://lpaste.net/350473

Pages: [1] 2