1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Tutorial Setting up Code::Blocks

Discussion in 'Tutorials' started by Erwin Lindemann, Apr 25, 2009.

  1. Erwin Lindemann

    Erwin Lindemann Landlubber Storm Modder

    Joined:
    Apr 18, 2009
    Messages:
    49
    I don't know who here still actually works via Notepad++ or other text editors, but just in case: Here's a very easy solution to get something approximating a development environment in 10 minutes.

    What you get:

    - A source editor that is basically the same as Notepad++, and can be customized in much the same way
    - A list of all functions and global variables/defines, either "All in project" or "All in file"
    - Auto-Completion functionality for functions and global variables
    - The ability to right-click functions and global variables and "Go to declaration" or "Find occurences of"
    - Full text search over the whole project, you get a hit list and can double-click to get directly to the right spots
    - Right-click anywhere and you can add To-Do-Items, which are basically comments formatted in a certain way that show up on a clickable list
    - Right-click on the project name and you can add "virtual folders", arrange (drag-and-drop) your files into those without changing their place on the drive

    ... and more. Just play around.


    What you need to do:

    1) Get the latest release of "Code::Blocks" here (it's only 8mb and free of course): Downloads
    2) Install & Start
    3) Go to File->New->Project , select "Empty Project", give it a title and select a save folder, then "Next" and "Finish"
    4) Right-Click on the Project Name in the tree on the left and select "Add files recursively", select the POTC "PROGRAM" folder and click "OK"
    5) You should now see the directory structure of the PROGRAM folder under your project name (divided into "Headers" and "Sources")
    6) Play around and customize to your heart's content

    CodeBlocks.png
     
    Last edited by a moderator: Nov 19, 2016
  2. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    I like it. I'll let you know if it wears well. <img src="style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

    Hook
     
  3. Erwin Lindemann

    Erwin Lindemann Landlubber Storm Modder

    Joined:
    Apr 18, 2009
    Messages:
    49
    I got really tired of working with Notepad and the Windows search function. It makes figuring out what's where and how it works really tedious.

    I'm adding the native functions as dummy definitions to an .c extra file as I go along and stumble upon them, so the Auto-Completion can pick them up and to get an overview over what's there. I'm also probably going to add fake .h files for some of the attribute arrays, just for quick reference.
     
  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    This sounds interesting. I should give this a try if I find the time. <img src="style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" />
    Once you're "done" with those definition files, is it possible to upload those for use by others too?
     
  5. Erwin Lindemann

    Erwin Lindemann Landlubber Storm Modder

    Joined:
    Apr 18, 2009
    Messages:
    49
    <!--quoteo(post=315745:date=Apr 25 2009, 01:25 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Apr 25 2009, 01:25 PM) <a href="index.php?act=findpost&pid=315745"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->This sounds interesting. I should give this a try if I find the time. <img src="style_emoticons/<#EMO_DIR#>/yes.gif" style="vertical-align:middle" emoid=":yes" border="0" alt="yes.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->

    It's really only 10 minutes. Maybe 20 if you want to mess around with the configuration a bit, like adding "aref" and "ref" as keywords for syntax highlighting and such.

    <!--quoteo(post=315745:date=Apr 25 2009, 01:25 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ Apr 25 2009, 01:25 PM) <a href="index.php?act=findpost&pid=315745"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Once you're "done" with those definition files, is it possible to upload those for use by others too?<!--QuoteEnd--></div><!--QuoteEEnd-->

    Sure.
     
  6. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    <!--quoteo(post=315736:date=Apr 25 2009, 05:48 AM:name=Erwin Lindemann)--><div class='quotetop'>QUOTE (Erwin Lindemann @ Apr 25 2009, 05:48 AM) <a href="index.php?act=findpost&pid=315736"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I got really tired of working with Notepad and the Windows search function. It makes figuring out what's where and how it works really tedious.

    I'm adding the native functions as dummy definitions to an .c extra file as I go along and stumble upon them, so the Auto-Completion can pick them up and to get an overview over what's there. I'm also probably going to add fake .h files for some of the attribute arrays, just for quick reference.<!--QuoteEnd--></div><!--QuoteEEnd-->
    I'm using Microsoft VC++ for my editor. It has some good functions, but this is well organized.

    See if you have a copy of Keywords.c in one of your buildinfo folders. That has a lot of native functions defined.

    Hook
     
  7. Erwin Lindemann

    Erwin Lindemann Landlubber Storm Modder

    Joined:
    Apr 18, 2009
    Messages:
    49
    <!--quoteo(post=315785:date=Apr 25 2009, 05:34 PM:name=Hook)--><div class='quotetop'>QUOTE (Hook @ Apr 25 2009, 05:34 PM) <a href="index.php?act=findpost&pid=315785"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->See if you have a copy of Keywords.c in one of your buildinfo folders. That has a lot of native functions defined.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Yes I have. Thanks.

    I guess I wasted a bit of time there <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />

    Edit:

    I have two performance-related questions:
    1) I need to check the distances of ships to the player, and I went with the player's SeaAI.Update.Ships. However, I noticed there is a function to get a NearShips object, although I assume from looking at the code that it takes more time to build that up. I guess as long as I'm centered around the MainChar I'm faster the way I did it? Or is the NearShips object updated constantly anyway?
    2) Declaring variables inside a loop or outside? A good compiler should pick that up and I actually prefer doing it inside the loop to indicate variables that are only used locally in the loop. Any experience with that? Right now I'm going for outside to be on the safe side.
     
  8. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    I'll have to check on the near ships thing.

    If you declare variables inside a loop, they are still available outside the loop. They aren't local to the code block they're in, unless they're in a different function. Given the way this works, it's probably better to declare outside the loop so people won't think it's actually only local to the loop.

    Hook
     
  9. Erwin Lindemann

    Erwin Lindemann Landlubber Storm Modder

    Joined:
    Apr 18, 2009
    Messages:
    49
    <!--quoteo(post=315795:date=Apr 25 2009, 07:10 PM:name=Hook)--><div class='quotetop'>QUOTE (Hook @ Apr 25 2009, 07:10 PM) <a href="index.php?act=findpost&pid=315795"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'll have to check on the near ships thing.

    If you declare variables inside a loop, they are still available outside the loop. They aren't local to the code block they're in, unless they're in a different function. Given the way this works, it's probably better to declare outside the loop so people won't think it's actually only local to the loop.

    Hook<!--QuoteEnd--></div><!--QuoteEEnd-->

    Yeah, I know there still available over the whole function, but it's a good reminder that they are currently only used inside. Anyway, I guess I just keep declarations outside.

    Does anyone have any experience with getting POTC to run on an integrated Intel Card (915 GM to be precise)? I tried to get it to run on my office laptop, because I'd prefer to use that one for developement and testing. I can get it to load to the worldmap or into indoor environments, but everything that's outside and it crashes without any kind of notice in anywhere in the logs. I believe it's the shaders, but beyond them I'm clueless.
     
  10. LordDrow

    LordDrow Pirate Geek Extraordinaire Staff Member Storm Modeller Storm Modder

    Joined:
    Oct 3, 2006
    Messages:
    1,704
    Gender:
    Male
    Location:
    Jefferson City, MO. USA
    Not running on integrated Intel vid chips is a known issue, though it has been said that there is an emulated codec out there that will allow you to run the game under emulated directX on intel chips.

    I've not yet had a chance to test it, so can neither confirm nor deny this allegation.

    Cap'n Drow
     
  11. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    What's the most efficient way to search the entire program folder for some variable or text and get a useful output? The tiny output window at the bottom of the screen won't work for my needs.

    I'm used to VC++ where you get a reasonable sized window for it, and can make that window full screen if necessary.

    Yes, I know that window can be resized by dragging the border. I'm just wondering what's the best way to use it. If I can't do efficient searches, it's not worth any of the other features.

    Hook
     
  12. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    Well, in the spirit of "mess with it until it does something different" I found out you can click on the search window title bar and drag it to undock it. At that point it's a separate movable window that can be resized. Pressing F2 toggles it on and off, and it remembers the various settings you've made to the window panes, etc. Not bad. Looks to be better than the VC++ method.

    Hook
     
  13. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    For the Intel graphics card, you could try this: <a href="http://www.transgaming.com/products/swiftshader/" target="_blank">http://www.transgaming.com/products/swiftshader/</a> - <a href="http://forum.piratesahoy.net//index.php?s=&showtopic=12795&view=findpost&p=313453" target="_blank">more info</a>
     
  14. LarryHookins

    LarryHookins Buccaneer Staff Member Storm Modder

    Joined:
    May 20, 2006
    Messages:
    2,297
    Location:
    Texas
    This thing has a lot of nice features. And once it's set up properly, it's nicer to use than VC++. Which means it's certainly nicer to use than Notepad++.

    Alt-G brings up a dialog box where you can type in part of a file name and it will give you a list of all matching files, including files that have the search string anywhere in the file name. Clicking on a file in the list will load it into the editor. That is SO much better than searching for a file.

    I like it. Thanks for letting us know about it.

    Hook
     
  15. konradk

    konradk Privateer Storm Modeller Storm Modder

    Joined:
    Oct 27, 2005
    Messages:
    713
    Gender:
    Male
    Location:
    Poland
    Here's definition files for CodeBlocks. All "special" commands of PotC will be visible as keywords.

    After uncompressing three files should be created, which are to be put in temporary directory.

    For Win XP:
    1. Install CodeBlocks
    2. Run it once and exit
    3. Go to file c:\Documents and Settings\<i>User</i>\Application Data\codeblocks and overwrite <i>default.conf</i> file with the one from archive
    a) Folder Application Data is hidden, so to get there there should be access to hidden files (don't tamper with other files and folders there; just replace that one file).
    b) <u>User</u> is login name of the <u>user</u> which installs and <u>uses</u> CodeBlocks.
    4. Two other files (<i>PotC.cbp</i> and <i>PotC.layout</i>) should be put in PotC main folder (together with engine.exe)
    5. Run CB again, click to open exiting project and select <i>PotC.cbp</i>.

    pirate_kk

    Edit: updated.
     

    Attached Files:

  16. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    I just installed this and it looks interesting, but I'm not quite sure how it's supposed to be used. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />
     
  17. konradk

    konradk Privateer Storm Modeller Storm Modder

    Joined:
    Oct 27, 2005
    Messages:
    713
    Gender:
    Male
    Location:
    Poland
    <!--quoteo(post=317612:date=May 5 2009, 04:51 PM:name=Pieter Boelen)--><div class='quotetop'>QUOTE (Pieter Boelen @ May 5 2009, 04:51 PM) <a href="index.php?act=findpost&pid=317612"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I just installed this and it looks interesting, but I'm not quite sure how it's supposed to be used. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" /><!--QuoteEnd--></div><!--QuoteEEnd-->
    You should be able to open PotC.cbp and have list of all files from PROGRAM\ folder in left panel. When viewing, code should have "proper" syntax highlighting (for "ref" and such) for PotC (you asked for it couple of posts above if I'm not mistaken).

    pirate_kk
     
  18. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Indeed I did, but not having tried the program yet, I didn't quite know what I was asking for. <img src="style_emoticons/<#EMO_DIR#>/razz.gif" style="vertical-align:middle" emoid=":razz" border="0" alt="razz.gif" />
    Anyway, it looks good. I like the "Find instances" and "Find definition" options. <img src="style_emoticons/<#EMO_DIR#>/w00t.gif" style="vertical-align:middle" emoid=":woot" border="0" alt="w00t.gif" />
     
  19. Mudd

    Mudd Sailor Apprentice Storm Modder

    Joined:
    Jan 8, 2008
    Messages:
    81
    Gender:
    Male
    Looks like there are a lot of files that can be downloaded from the link in the first post. <img src="style_emoticons/<#EMO_DIR#>/mybad.gif" style="vertical-align:middle" emoid=":facepalm" border="0" alt="mybad.gif" />

    Which file is the correct file?
     
  20. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,623
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    That had me confused too. I just skipped that whole forum and looked up "codeblocks" on Google instead.
    That brings me to this download: <a href="http://downloads.sourceforge.net/codeblocks/codeblocks-8.02-setup.exe" target="_blank">http://downloads.sourceforge.net/codeblock...-8.02-setup.exe</a>
     

Share This Page