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.

Show posts Menu

Topics - Hatonastick

Hi guys, I'm pretty much pulling my hair out at the moment.  Trying to find a simple text editor that has a Windows and a Linux version, has encryption and can run from a USB stick.  Any suggestions?  There's tons and tons of little editors out there, but trying to find one that fits that criteria has been a nightmare!  Any help appreciated, thanks.

Edit:  Ok, I can't find anything that does exactly what I want.  I think I might write a little program in GLB.  Hopefully the Linux side of things doesn't require too many extra libs.  I might be able to get away with making it a console app, so that should cut things down somewhat.  This isn't going to be an editor, simply something that encrypts and decrypts a file -- only input will be asking for the password.  I'll use whatever text editor is on the system to actually edit the text version of the file.  Can't really think of any other way to do this that doesn't involve writing a full-on program.  Hmm...  How hard would it be to write a really simple text editor in GLB using DD-GUI or equivalent?
Off Topic / Grimrock
Friend of mine bought me it on Steam.  Classic Dungeon Master/Eye of the Beholder/Knightmare (one of my favourites) etc.  Uses an actual 3D engine by the looks of it, but seems to work well enough.  Am really enjoying it so far although some of the puzzles are very, very hard.  Anyone else picked up this nostalgic gem yet?
music/sound / Sound buffers.
I'd really like some sort of access to sound buffers, or be able to make and mess with them like you can screen buffers (CREATESCREEN), but more with commands a bit like some of the file ones (READBYTE, READLONG etc.).  This is pretty essential for something I want to do that is along the lines of SFXR but in real-time (writing and reading temp files wont cut it) as part of a game idea.  To be honest theres lots of reasons why being able to mess with raw WAV data could be beneficial to GLB programmers -- for the same sort of reasons programmers want to be able to create and access screen buffers to mess with the screen.

I realise it depends on the sound library you are using, and it may not be terribly high priority given more recent events (such as your very unfortunate hard drive crash), but I'm hoping it might be possible one day.
This is driving me crazy.  I can't find anything via Google that seems to help either.  I've turned off a bunch of things that some people have suggested but it still hasn't solved the issue.

Basically when a program quits, it doesn't release straight away.  Seems to take time.  So if I compile and then run a program for the first time it all works fine.  However if I click on Start or Build in the editor it fails when it comes to replacing the old binary because windows hasn't released it yet -- and windows seems to take a minute each time to do so.

I never used to have this issue, but some update or other along the line it started.  It doesn't end (or start) with GLB though.  I've had many occasions where I've run a program, then gone to move or delete files in its directory and haven't been able to.  Every time I uninstall a program that has been running recently I have to reboot (even on a few occasions to Safe mode) to get rid of the darn thing.  I'm hoping someone who is more up to date on how Windows works these days than I am, can suggest something because I'm all out of ideas.  I'd rather not do a total reinstall of windows because I've got too many large programs I'd have to download/install again, but I'm starting to think that might be my only option -- assuming it wasn't an update that started this mess that is...
I recently bought a Toshiba Thrive 7" as I wanted something easier to lug about than my Netbook but which would allow me to do some of the same things -- including Google Docs (now known as Google Drive) as that's where I do all my word processing these days.  So I bought one of these as it was on special.  Nothing amazing, but a half decent Android tablet if you can get it cheap enough.  Certainly a massive upgrade from my clunky old ZTE tablet.  Anyway it got me interested in developing for Android again, but this time around I'd be doing it for me rather than some ethereal idea that I'd come up with some great game and make a fortune -- which quite frankly just led to my becoming disillusioned and doing easier things like play games (SWTOR Im looking at you) rather than make them.

So far hasn't been too hard to get connected to GLB.  Hardest bits were realising that I needed a cable that somehow got left out of the box (not uncommon with this model apparently according to a quick search on Google) -- thankfully I had a spare.  Then I had to get around Window 7's weird file lock situation that seems to happen sometimes even if you have UAC turned off.  Ended up having to update Android SDK in safe mode can you believe.  Then I had to track down working ADB drivers for the device.  For future reference should anyone else pick one of these up get them from:

Just tested an old build of my never-finished-despite-being-years-old Time Pilot wannabe and it ran at a rock solid 60FPS.  Might be the Nvidia Tegra which my old ZTE definitely did not have.

So now that I'm 40, which supposedly means I'm older and wiser (HAHAHAHAHA!), I need to do something that excites the little grey cells before it all turns into mush.  =D
Allows you to create a scrolling starfield in any direction and within a restricted area on the screen (bit like a window).  Created for my Time Pilot style game.  Thought I'd lost it, but just found it hiding in an archive.  Mostly useful as an example (not the best, see Mr TA Toads for that) of simple OOP-like usage of types.

Code (glbasic) Select
GLOBAL Stars AS Starfield
GLOBAL Dir = 90
GLOBAL sx, sy
Stars.Setup(sx, sy, 4, 8, 100)

  Stars.Draw(0, 0, Dir)

FUNCTION HandleKeys:
  // Left cursor key.
  IF KEY(203) = TRUE
    Dir = Dir + 4
  // Right cursor key.
    Dir = Dir - 4

  IF a < 0
    a = 360 + a
  ELSEIF a > 359
    a = a - 360

// Star structure.

// Define our starfield.  This isn't really necessary to be honest, I've just
// done it this way to make it possible for a game to have more than one
// starfield defined.
TYPE Starfield
  Table[] AS Star

  // Create the initial starfield.
  // Where:
  // width, height = dimensions of the 'window' the starfield is being drawn in.
  // minspeed, maxspeed = the minimum and maximum speed stars can move at.
  // number = number of stars to draw.
  FUNCTION Setup: width, height, minspeed, maxspeed, number
    LOCAL i, c

    // Initialize starfield data.
    self.Width = width
    self.Height = height
    self.MinSpeed = minspeed
    self.MaxSpeed = maxspeed
    self.Number = number
    DIM self.Table[number]

    // Initialize the starfield array.
    FOREACH i IN self.Table[]
      // Randomize the stars starting position.
      i.X = RND(self.Width - 1)
      i.Y = RND(self.Height - 1)
      i.Speed = RND(self.MaxSpeed - self.MinSpeed) + self.MinSpeed
      // Grayscale the stars.
      c = 100 + RND(100)
      i.Color = RGB(c,c,c)

  // Draws and generates a starfield 'window'.
  // Where:
  // x, y = the top left corner of the starfield 'window' that we will be
  //        drawing.
  // direction = the direction in which the starfield will be moving.
  FUNCTION Draw: x, y, direction
    LOCAL i, tx, ty

    // Only carry this out if the starfield is turned on.
    IF self.Active = FALSE THEN RETURN

    FOREACH i IN self.Table[]
      // Scroll starfield in given direction.
      i.X = i.X - (i.Speed * COS(direction))
      i.Y = i.Y + (i.Speed * SIN(direction))

      // Star is off the screen, relocate back to the beginning
      // and randomise its new position.
      IF i.X < 0
        i.X = self.Width - 1
        i.Y = RND(self.Height - 1)
      ELSEIF i.X >= self.Width
        i.X = 0
        i.Y = RND(self.Height - 1)

      IF i.Y < 0
        i.Y = self.Height - 1
        i.X = RND(self.Width - 1)
      ELSEIF i.Y >= self.Height
        i.Y = 0
        i.X = RND(self.Width - 1)

      // Draw the star, but only if it is on the screen.
      tx = x + i.X
      ty = y + i.Y
      IF tx > 0 AND tx < self.Width AND ty > 0 AND ty < self.Height
        SETPIXEL tx, ty, i.Color

  // Toggle starfield on.
    self.Active = TRUE

  // Turn starfield off.
    self.Active = FALSE

  // Returns TRUE if starfield is on or FALSE if starfield is off.
  FUNCTION Status:
    RETURN self.Active
Basically I run through a string one character at a time and copy only the characters 0-9, a-z, A-Z to the new string.  Everything else is removed/ignored.  Generally flag strings will be quite short (probably < 10 characters), but I still can't help thinking there's a better way to do this.

Code (glbasic) Select
// Make sure given flag string contains only letters and numbers.
// Wish I could think of a faster, more efficient way to do this.  One that
// didn't rely on going through the string one character at a time.
FUNCTION FlagMakeAlpha: BYREF flag$
  LOCAL l, i, temp$, c$
  // Get the length of the given string.
  l = LEN(flag$)
  // Make sure the string isn't zero in length and process it.
  IF l > 0
    // Run through the string one character at a time.
    FOR i = 0 TO (l - 1)
      c$ = MID$(flag$, i, 1)
      // Remove anything that doesn't fall in the range of 0-9, a-z, A-Z.
      IF (ASC(c$) >= 48 AND ASC(c$) <= 57) OR (ASC(c$) >= 65 AND ASC(c$) <= 90) OR (ASC(c$) >= 97 AND ASC(c$) <= 122)
        temp$ = temp$ + c$
    flag$ = temp$
Just curious, is there any reason why INIOPEN seems to ignore whatever directory I've chosen using SETCURRENTDIR$?  Main reason why I wish INIOPEN didn't ignore SETCURRENTDIR$ is I'm using the INI system as a sort of limited ASCII database system and it's annoying to have to include the directory as part of the path. :)
GLBasic - en / Android JNI.
Quick question: Does GLB use JNI to compile?  If so, can we access JNI using inline C++?  Asking because I'd like to incorporate Androids Text to Speech engine into a simple game I'm making.

Edit: Guess the answer is to test it myself.  ;/
1) How do I set screen orientation?  Not too fussed about other peoples devices yet, but trying to work out how to get mine into Landscape mode at the moment. Ugh... Reading comprehension FTW...

2) How do I input text?  Do we have access to Androids on-screen keyboard or do you have to come up with your own workaround?

3) Do we have access to native buttons or do we make our own system?  I'm guessing we just draw something on screen and detect whether a mouse/touch clicked within its coordinates.

4) With pre-processor commands is there an entry for Android in the platforms section?  Might just be missing from the help.  Anyway am hoping to make this MUD server compile for more than one platform with as little mucking about as possible so am going to be using such commands a lot.  Mostly because I don't want to spend more time on this project than I have to as I've got games I want to make. :)

5) Is CATCH/FINISH etc. similar to the following C:
Code (glbasic) Select

  signal(SIGINT, SignalCapture);
  signal(SIGTERM, SignalCapture);
void SignalCapture(int signum)
  switch (signum) {
    case SIGINT:
      signal(SIGINT, SignalCapture);
    case SIGTERM:

Basically the above allows you to capture certain exceptions and then do certain things before the program exits.  eg. control-C being used to kill a running program.

Warning: I'm going to use this thread a lot to ask questions as I go about making my first Android application, so I apologise for being annoying in advance. :)
I have a webserver with PHP and SQL, so I suspect this is possible, but not sure where to start.  Actually I'm even having trouble describing what I want to do...

Basically (for fun) I'm writing a MUD server.  I would like to find a way that allows this server when running on a machine that is on a non-static IP (ie. they reboot their modem or reconnect their modem, their ISP gives them another IP number) to enable people to connect to it using a client.  So basically the server would contact the webserver and say 'Here is my IP' and 'MUD Server is up and running', and the webserver would have a page that updates and allows people to see a list of servers running and the IP and Port they need to connect to it.

Of course it would probably be better to also write my own client and have all this done 'invisibly' on the webserver.  That would allow me to do the other thing I'd like and that is for (if configured to do so) MUD servers to contact each other and allow players to move between them.

In the end I guess the easiest option is simply report the external IP address on the screen of the MUD server when it is run and leave it up to whoever is running it to record it somewhere publicly so people (or just friends) can connect, or give to friends also running servers to allow them to "talk" to each other.  Going the webserver route would be pretty much writing a complete game lobby system with user created accounts, password protection and the rest I suspect.
GLBasic - en / Media.
Maybe I'm forgetting something, but I always thought when you compiled a GLB program, it copied the relevant media into the application folder.  Or am I meant to do it by hand?

By hand is ok, I'm just wondering if I'm getting mixed up is all. :)
Ignoring questions like "Why would you want to?", I'm curious as to whether or not I could write a simple MUD server for Android devices.  Mostly for my own fun.  You can blame my discovering the large number of MUD clients for Android as being the catalyst. :)

a) Can you have a program run as a server under Android without "rooting" the device?  If I have to use higher port numbers that's fine eg. 8080.

b) Is there a built-in database system or would I have to make my own (limited) system?  I'm guessing I'd have to read/write memory cards or provide a way to change where the game data directory is...

c) Is there anything else that might make the whole idea impossible?  Ignoring device speed, this isn't going to be much of a MUD server.  Think very, very simplistic.
Do you have to register as a developer etc. before you can test anything on an Android device?  See the last two days have been interesting for me.  I scored an Android tablet for free (it's going to run really, really badly if at all -- I have no illusions since it's obviously Chinese in manufacture) and today I got a Galaxy Mini mobile phone (again low-end, I want an Android phone with an external physical keyboard but they are hard to get here) as my Nokia C6-00 is kaput already.  So I'm thinking I'd like to give this whole Android development thing a go.  I wasn't planning on ever programming again, but this could be an interesting opportunity.  Even if it's going to cost me to register as a developer with Google or whatever first.
Off Topic / Android phones.
Quick question:  Anyone know of an Android mobile phone that has a built-in physical (not touch screen) keyboard?  I really loathe touch screen keyboards (like the one on my iPod), but unfortunately it seems all phones are heading that way.  Even the newer Blackberry and newer Nokia look like iOS/Android rip-offs (the Nokia one might even use Android, I don't know).  Just I really like the keyboard on my Nokia C6...

Edit: I guess I should add why I'm thinking of getting another phone.  Despite the fact I like the C6, it is slow and doesn't have enough RAM so even web browsing can bring it to its knees.  On top of which there is very little useful software (I'm not interested in noise generators or a program that claims to turn my phone into a torch) for the C6 on the Nokia store -- and I have no interest in going back to C++ to write my own.
Installed the latest version of Ubuntu on my Samsung N150 Plus netbook (there used to be a Netbook specific download but now you use the same as the desktop as they merged the two streams together) yesterday and so far it works like a dream.  Not 100% about their claim of it being faster than Windows 7 Starter as you'd probably need to run two identical netbooks side by side each with one OS to really tell, but it does seem to run a bit faster at least.  Was impressed that there was almost no work on my part to get it up and running.  Even the wireless networking was easy.  Things like Linux have come a long way in ease of install and use since I was last into that sort of thing (which was a looooong time ago).

Now I just have to try compiling something using GLB for Windows and then Linux and see how it goes under each.

PS Mr Moderator: I forgot I could delete and repost.  So the one I posted accidentally in the 3rd Party area no longer exists.  :whistle:
Is it possible to manipulate/move/delete vertices in a generated model (created using X_OBJADDVERTEX etc.) using GLB or will I have to create all of my (simple geometric shapes) models in a 3D drawing program (AC3D) and every single frame of animation by hand?
As I wasn't sure where to put this exactly, I thought maybe off topic was best.

For a while now I've wanted to do an effect a bit like the retro one used in Darwinia for a simple 3D game I'm working on.   I know I've talked about the effect before and someone came up with a sort of (well, ok it was pretty good really just very CPU intensive) solution.  Anyway it occurred to me that it might (as I'm guessing the original is) be done via a shader.

Basically the way I see it is you split whatever graphic you want to have this effect up into 4x4 pixel blocks, then average the colors in those blocks and paint a 4x4 pixel block of a single color (which you got from averaging the original 4x4 colors).

eg. (I'm going to use a 2x2 block here to save time typing :))

Assuming for a moment we are only using 256 colors in RGB format (although I'd really want true color or what-have-you if it was possible) a sample 2x2 block could be:
1.1) 0:0:0               1.2) 255:179:010
2.1) 150:070:155   2.2) 255:255:134

R average = 0 + 255 + 150 + 255 / 4 = 165
G average = 0 + 179 + 70 + 255 / 4 = 126
B average = 0 + 10 + 155 + 134 / 4 = 74.75 (round to 75)

So paint a 2x2 block with color RGB 165:126:75 over the top.

Making sense?  If so any tips on where to start or whether this is even possible with Open GL shaders?  Shaders are a new fangled thing as far as I'm concerned. :)