Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Text Edit box

Author
Message
3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 3rd Feb 2010 14:34
I made a text edit box and have some of the following problems resizeing the box, and moving the text box. The box I can copy and paste a link list of chars. I also got it where you can use the arrow keys to move around the text, and have the mouse able to select certain areas of text. I dont really want to post the hole code but I just want sugestions on how i can make text appear over a sprite. How I can move the text and resize the text box.

Go through yourself at a wall.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Feb 2010 15:55 Edited at: 3rd Feb 2010 15:56
text appear over a sprite:



resizing box:

you can make a little sprite ( can be hidden ) at the edges of the box, so check collision between it and the mouse, if they are colliding and the mouse is clicked, sclae the box sprite and the text appearing position according to the new size

arrow keys? you mean like, scroll up and down? well i have made a simple box before and i did this:

first, i stored the text messages in a 2d array:

then, i made something like a view area of the box :

so, an int array containing the number of lines in a box, and in each element of the array, you store a line number, for example, the number of lines = 10, so you can view 10 lines at once, and you want to view lines number 35-45, viewArea should be { 35, 36, 37 .... 45 } so you can show messages in a for loop:


as for the links in chat, im not pretty sure, but i think you can make a hidden sprite over a specific area of the box ( the link place ), and check mouse clicks and collision between mouse and that sprite, so like, you store in a structure or something some variables like the link position and the line it is at, and then re-position the boxes when the chat scrolls

hope that helps

helpfull programmer
15
Years of Service
User Offline
Joined: 30th Jul 2009
Location:
Posted: 3rd Feb 2010 16:58
just to change one thing the above poster said (no offence intended), instead of all that mess with pasting a sprite use:

dbDrawSpritesFirst();

This will draw the sprites and THEN draw the text.

Hope that helped
from helpfullprogrammer
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Feb 2010 17:55 Edited at: 3rd Feb 2010 17:55
drawspritesfirst makes some problems, forgot what the problem was, i think t was...not showing objects? not sure..

3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 3rd Feb 2010 18:10 Edited at: 3rd Feb 2010 18:12
Well this will mess up my highlighting scem of how i highlighted text. i used a link list of chars. and made a start pos and end pos of where I selected. using dbBox to select the chars. I didn't use sprites i used dark gdk text, because I dont like the way sprites made letters look bigger. I did sprites before and one sentence filled my hole screen. Then i decided them mem block images where better to write. The mathmatics was to crazy to do this because I had to compute a new length for the mem block for each char that was pressed. This is why I went back to dbtext because it is not as big as sprites. If I could get mem blocks to work this would be better. Just make a char of mem blocks and each char that was pressed would represent an image.

Go through yourself at a wall.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 3rd Feb 2010 18:34
none above mentioned using sprites instead of text

Tweety J
14
Years of Service
User Offline
Joined: 28th Jan 2010
Location:
Posted: 13th Feb 2010 20:38
Draw Letters on a bitmap, set up animated sprites, then set the priority higher than the box's priority Then forget the dbText function.

Login to post a reply

Server time is: 2024-11-20 05:40:19
Your offset time is: 2024-11-20 05:40:19