GLZ toolkit – basecode

The basecode is the real glue between your system and the your project itself, the goal is to never expose system specific code to your project.
Sadly i wasn’t able to get the momentous task to include things like device input (keyboard,mouse gamepad, joystick and such) or any networking started for version 2 of my basecode, but is in the planning stage at least.
The goal of this specific tutorial is to get a single  blank project up and running in at least visual studio 2013 express, but with little or no actual graphics code running (except for glClear), in short we will be replicating the zeobase2_blank project that already exists in the codebase, but it does apply to all projects.

Creating a new project
First create a new solution or use the already existing one and choose in the menu File -> New Project
choose visual c++ -> win 32 and win 32 project in the top and type in your project name.
Remember to add it to the right solution

In the win 32 application wizard choose “application settings” and make sure it’s a windows application and an empty project.
When you click finish it should create the right type of empty project in your solution.

now in the case you created it just as the default toolkit projects are and that the files ended up in the same way you now need to do two things to make it work.
First go to the properties of the project and in the configuration field choose “All configurations”
then under linker -> general -> output file type “..\..\bin\$(ProjectName).exe”
and under Debugging -> working directory type “..\..\bin
You might also want to change under c/c++ -> generation -> runtime library to “Multi-treaded (MT)” to get rid of the need to include the visual studio runtime dll with your project.

this will make the code compile into and run from the correct directory so that it will run the same regardless how you run the program.
The second thing you need to do is to add the files, for the raw basecode all you need from the examples directory is

Header files
   Resource.h
   stdafx.h
   targetver.h
   zeobase2.h

Resource files
   small.ico
   zeobase2.ico
   zeobase2.rc

Source files
    zeobase2.cpp
   blank_base.cpp  – now if you create a new project you might want to create a copy of this and and use it instead

In case you also want the full toolkit you will also need these files from the glz directory

Header files
primitives.h
ztool-geo.h
ztool-geo-2d.h
ztool-geo-generate.h
ztool-glz.h
ztool-shader.h
ztool-tex.h
ztool-type.h

Source files
ztool-geo.cpp
ztool-geo-2d.cpp
ztool-geo-generate.cpp
ztool-tex.cpp
ztool-glz.cpp
ztool-shader.cpp
ztool-type.cpp

And thats it, compile and it should work well, i hope.
But do note that the actual files needed in the project may wary in future versions

Making it behave
Compared to the last basecode i now moved all configuration of the app to zeobase2.h currently as a bunch of constants instead of dotted all around the code, this is one of those things i might change later on once i have a settings file system in place but for now this will do.
It’s pretty self explanatory but here is a few tips, ideas and pitfalls.

ALLOW_FULLSCREENSWITCH – will allow you to switch between full screen and windowed mode, but it can’t for some reason switch between a window with borders to full screen without borders and back so if you want the capability of switching to fullscreen then set SHOW_FRAME to false.

NATIVE_FULLSCREEN – is best set to true since many laptops still does not use full 1080p

START_CENTERED is nice if you have SHOW_FRAME set to false, also when doing so don’t set your windowed resolution to high , use full screen mode instead, 800×450 or 900×500 is nice for windowed and will work on all computers

DISPLAY_ERRORS is really annoying in release code, in future versions this will be replaced with a crash logs, but for now give a version with this set to true to people complaining of crashes.

ENABLE_VSYNC should be true in most cases since it removes vertical tearing and if your app runs very fast it does not slow down other apps or wasting power unnecessarily.

And that’s it, if you have any questions the feel free to comment below, i will keep this up to date as this  part of the code will probably change the most with all the networking, file loading, input, and so on i plan to add


No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

*


WordPress Themes