Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
vs (Very Simple) GUI
#11
(07-16-2022, 05:38 PM)SierraKen Wrote: I might have found the problem, it probably has to do with the fact that I keep all my QB64 apps in a completely different directory than QB64. I started doing that recently so I wouldn't lose them when I update QB64. But I just opened the .BI file inside QB64 and the error was that it couldn't locate direntry.h  I tried to put that in the same directory as your game but no luck. Then I tried putting it outside of the directory but still no luck. I also tried putting it in its own directory in both locations and no luck. But the strange thing is, I also tried your game inside my QB64 folder and it still wouldn't find it. I might be using the wrong direntry.h file or just don't have the right one. Your BI file says to look at your GUI.txt file but that wasn't included in your zip so I don't have it.

Oh nutz, I forgot the BI/BM uses direntry.h, I am sorry, thanks for providing more details. 

The download zip was supposed to be a self contained project Folder you could put anywhere, direct the QB64 IDE to that folder select the bas and Run... but the BI/BM does need direntry.h either in the folder or a one time only addition to your QB64.exe Folder.

OK direntry.h is just this:
Code: (Select All)
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>

const int IS_DIR_FLAG = 1, IS_FILE_FLAG = 2;

DIR *pdir;
struct dirent *next_entry;
struct stat statbuf1;

char current_dir[FILENAME_MAX];
#ifdef QB64_WINDOWS
  #define GetCurrentDir _getcwd
#else
  #define GetCurrentDir getcwd
#endif

int load_dir (char * path) {
  struct dirent *pent;
  struct stat statbuf1;
//Open current directory
pdir = opendir(path);
if (!pdir) {
return 0; //Didn't open
}
return -1;
}

int has_next_entry () {
  next_entry = readdir(pdir);
  if (next_entry == NULL) return -1;
 
  stat(next_entry->d_name, &statbuf1);
  return strlen(next_entry->d_name);
}

void get_next_entry (char * nam, int * flags, int * file_size) {
  strcpy(nam, next_entry->d_name);
  if (S_ISDIR(statbuf1.st_mode)) {
    *flags = IS_DIR_FLAG;
  } else {
    *flags = IS_FILE_FLAG;
  }
  *file_size = statbuf1.st_size;
  return ;
}

void close_dir () {
  closedir(pdir);
  pdir = NULL;
  return ;
}

int current_dir_length () {
  GetCurrentDir(current_dir, sizeof(current_dir));
  return strlen(current_dir);
}

void get_current_dir(char *dir) {
  memcpy(dir, current_dir, strlen(current_dir));
  return ;
}

Copy/Paste into txt editor, save as direntry.h in your QB64.exe folder.
I will try and remember to add it to zips for the GUI stuff.

Thanks for staying with this Ken.  TTT doesn't even use the Files Folders function so it slipped my mind that you still need drientry.h.

It should work either in the Project Folder or in the QB64.exe Folder and having it in both places should do no harm.


Attached Files
.h   direntry.h (Size: 1.21 KB / Downloads: 47)
b = b + ...
Reply
#12
OK Here is the repacked zip for GUI TTT with AI, with the direntry.h file, AND the compiled exe's for Widows users.

No excuses now to get beat or tie with GUI TTT with AI!


Attached Files
.zip   vs GUI Tic Tac Toe with AI.zip (Size: 1.95 MB / Downloads: 49)
b = b + ...
Reply
#13
Works perfect now B+! Thanks! Your Tic-Tac-Toe is impossible of course Smile. A few years ago I made one too but didn't make it impossible. But I like your GUI, very sweet, I might use it someday for something.  B+ I have no idea how you made it so you can't win, it seems almost impossible!
Reply
#14
@SierraKen since I see no downloads of the repacked zip, I assume you got it working with a copy of a direntry.h file? Just out of curiosity did you put it in the TTT project folder or the QB64.exe folder (or something else)?

I just tested again and direntry.h file will work from the folder with the BI/BM that calls it, ie the project folder.

Update: I didn't remember your game as 3D like, plays well!
b = b + ...
Reply
#15
I made the direntry.h file using Notepad with your code that you posted. Then I put it in 2 places, my QB64 folder and also the folder with the game, in a completely separate C: folder. So I don't know which one it uses, either the QB64 one or the game one, but it works now. Smile
Reply
#16
That is also where I put the BI and BM files.
Reply
#17
I just removed all the new files from my QB64 folder and left them in just the game folder and it still works fine. Smile
Reply
#18
(07-16-2022, 09:18 PM)SierraKen Wrote: I just removed all the new files from my QB64 folder and left them in just the game folder and it still works fine. Smile

Good! Thankyou for your feedback.
b = b + ...
Reply
#19
ARB start your own thread on Tic Tac Toe this thread is for vs GUI apps. Though one app is GUI TTT it's not a showcase for your TTT programs.
b = b + ...
Reply
#20
ARB plenty of other places to post your opinions at this forum.
b = b + ...
Reply




Users browsing this thread: 1 Guest(s)