intfiction.org

The Interactive Fiction Community Forum
It is currently Sun Nov 19, 2017 8:51 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Oct 19, 2017 8:03 am 
Offline

Joined: Wed Oct 18, 2017 7:54 pm
Posts: 2
Hello everyone, my name is Fran and I like interactive fiction.

I just started learning how to use the GWINDOWS library, but I can not change the colors in the text buffer type windows, I tried:

glk_window_set_background_color (MainWin.winid, $ 110101);
glk_window_clear (MainWin.winid);
grapw1.setimage (PIC1);

But the colors do not change, could anyone help me?


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 20, 2017 6:55 am 
Offline

Joined: Wed Aug 26, 2015 11:18 am
Posts: 87
Location: The Netherlands
glk_window_set_background_color() is for graphics windows only.

This is what's in the Glk spec about glk_window_set_background_color():

Quote:
[This function may only be used with graphics windows. To set background
colors in a text window, use text styles with color hints; see section 5.5,
"Styles".]

You can set the initial color for a tekst buffer window before you create it, I don't know if and how you can change it for an existing window.

Here's how I do it:

To set the initial color:

Use the glk_stylehint-set() function to set the initial values.

Example: glk_stylehint_set(wintype_TextBuffer, style_Normal, stylehint_Backcolor, 0x00000084) sets the background color to blue for style normal.

Then create the tekst buffer window with mainwin = glk_window_open(0, 0, 0, wintype_TextBuffer, 1)
(function parameters are from my own code, you may need other parameters)

Hope this helps.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Oct 20, 2017 7:59 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2432
You can't change colours (or any other styles) once a window has been created.

The normal approach is to run a loop to set the background colour for all the styles. If you only set it for style_Normal then other styles won't have the background colour.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 9:27 am 
Offline

Joined: Wed Oct 18, 2017 7:54 pm
Posts: 2
thanks for the answers and sorry for taking a long time to respond, I'm practicing, if I get something I'll share the results,
Greetings.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


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