You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

C++Builder

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

0
b/PC, Mac & Vintage Computers publicado por u/kotu November 09, 2016, 08:08:02 PM
Does anyone use C++Builder? it is a mighty tool.

I still use Turbo C++ 2006 free edition which came with 100 years license

* kotu runs
Inicia sesión o crea una cuenta para dejar un comentario
u/kotu November 13, 2016, 07:58:19 PM


>B)
u/Scipi November 14, 2016, 04:09:25 PM
I hold that C++ builder is rather pointless. If you need rapid development with tools for potentially non-technical devs, you shouldn't be using C++. If you need precise power and low level memory access/optimizations you shouldn't be using a builder. Both halves of the tool are fine on their own, but there's really no use case for having both.
u/kotu November 14, 2016, 05:31:40 PM
Quote from: Scipi on November 14, 2016, 04:09:25 PM
I hold that C++ builder is rather pointless.

6

*edit*
trying to edit this post, can't.  :thumbsup:


Did you think that the power / speed of C++ was somehow degraded by it having a visual form designer or something

:-|

Re. potentially non-technical devs, is this what you mean? --->


//---------------------------------------------------------------------------
void TTachGame::ProcessLeftClick(int PlayerID, int SqrX, int SqrY)
{
bool movedOrAttacked = false;
bool didNinjaMove = false;

int enemyID;
if (PlayerID == 0) enemyID = 1;
else enemyID = 0;

if (GetSelectedUnit())  // assume we are trying to move a piece
{
for (DWORD i = 0; i < GetSelectedUnit()->GetNumAvailableMoves(); i++)
{
TTachMove move = GetSelectedUnit()->GetMove(i);

if ((move.ToPosX == SqrX) && (move.ToPosY == SqrY))
{
if (move.MoveType == TMT_STANDARD)
{
// this could be a move or an attack!!

if (move.Attack || FormMain->Cursor == crCross)
{

// we are attacking another piece!! YES!!!

bool queenTeleportAttack = false;

if ((GetSelectedUnit()->GetType() == TUT_QUEEN) && (FormMain->Cursor != crCross))
{
int dx = SqrX - GetSelectedUnit()->GetPosX();
int dy = SqrY - GetSelectedUnit()->GetPosY();
if ((dx <= 1) && (dy <= 1)) {
queenTeleportAttack = false;
}
else {
queenTeleportAttack = true;
}
}

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);  //

// check for queen wish attack
if (FormMain->Cursor == crCross)
{
if (enemyUnit) enemyUnit->GetQueenWishAttacked(*GetSelectedUnit(), 2.5f);

TTachUnit* u = m_Players[enemyID].GetUnit(SqrX-1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
FormMain->Cursor = crDefault;

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}

if (enemyUnit)
{
if ((enemyUnit->GetType() == TUT_KING) && (GetSelectedUnit()->GetType() == TUT_PAWN))     // check for single move checkmate
{                                                                                         //  ] END OF GAME [
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
movedOrAttacked = true;
break;
}
else if (queenTeleportAttack) {                      // check for queen teleport attack
enemyUnit->GetTeleportAttacked(*GetSelectedUnit());
}
else {                                              // check for all other TMT_STANDARD attacks
enemyUnit->GetAttacked(*GetSelectedUnit());   // this is where most of the attacks happen
}

if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}
}
else
{
/// this is just a move.

GetSelectedUnit()->MoveToPos(SqrX, SqrY, this);
if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}
movedOrAttacked = true;
break;
}
}
else if (move.MoveType == TMT_BOMB)
{
// bomb the square
//...

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);

if (enemyUnit)
{
enemyUnit->GetBombed();
m_Players[enemyID].PurgeDeadUnits();
}
FormMain->BombNoise();
movedOrAttacked = true;
break;
}
}
}
}

if (movedOrAttacked == false)  // assume we are trying to select something else
{
if (m_NumNinjaMoves == 0) {
SelectUnit(SqrX, SqrY);
}
}

//-----------------------------------------------------

// CHECK FOR THE OTHER END OF GAME STATES  (THERE IS ONE ABOVE) //

// check for dead king

if (m_Players[enemyID].KingIsDead()) {
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
}

// check for K vs K draw

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingIsLeft()) {
FormMain->DeclareEndOfGame(true, "");
}

// check for KQ vs K win

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[1].GetName());
}
else if (m_Players[1].OnlyKingIsLeft() && m_Players[0].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[0].GetName());
}

//-----------------------------------------------------
// hand control to next player
if (movedOrAttacked)
{
if (didNinjaMove && m_NumNinjaMoves > 0)
{
if (FormMain->Menu_BlackBoxEnabled->Checked) {
FormMain->SaveBlackboxData();
}
}

// SEND GAME TO OTHER PC (NETWORK) HERE

RandomlyAddPowerup();
IncrementNumMoves();
FormMain->SendMove();


//----
if (m_NumNinjaMoves == 0)
{
HandControlToNextPlayer();
//FormMain->SendNextPlayer();
}
}
}
//---------------------------------------------------------------------------


(don't)
Last Edit: November 14, 2016, 07:43:29 PM by kotu
u/Scipi November 14, 2016, 08:19:25 PM
Quote from: kotu on November 14, 2016, 05:31:40 PM
Quote from: Scipi on November 14, 2016, 04:09:25 PM
I hold that C++ builder is rather pointless.

6

*edit*
trying to edit this post, can't.  :thumbsup:


Did you think that the power / speed of C++ was somehow degraded by it having a visual form designer or something

:-|

Not necessarily, just that when you have compiler generated code like that you lose a lot of information and control over how your program is running and the state of the system. These are things you generally want to know about when using C++ at a low-mid level. And if you don't need to work at that level, why are you using C++? A gui builder is more in the domain of designers anyways. And C++ is not at all a design language.

Really, it's a better paradigm to use a 3rd party library for your gui stuff if you need a C++ powered gui system.

1. You retain control over your main. Which means you retain control over the entire scope in which your program operates.
2. You dictate the scope in which the gui system operates, not the other way around. So you want the gui to only operate for a certain time slice? Go for it. You want to determine when in your program the gui runs? You can do that. Want to have a say over the gui working in a single thread or in multiple threads? Totally within your power.
3. You're not locked into one gui system. If a gui library doesn't have a feature you really need, you can switch out to another one. C++ Builder locks you into their system (and if you choose not to use it, what's the point of C++ Builder anyways?)
4. You have the option to offload the gui system to a scripting language more suited to the task, like python or lua. That way your non-tech designers can work with design-friendly languages while your tech engineers support them with C++ engine stuff. Example of this workflow: Unreal Engine.
5. You're not limited in how you want to architect your code.
Last Edit: November 14, 2016, 08:20:59 PM by Scipi
u/kotu November 14, 2016, 08:21:24 PM
Nothing to say really

(apart from the VCL)
u/Scipi November 14, 2016, 08:36:22 PM
Quote from: kotu on November 14, 2016, 05:31:40 PM
Re. potentially non-technical devs, is this what you mean? --->


//---------------------------------------------------------------------------
void TTachGame::ProcessLeftClick(int PlayerID, int SqrX, int SqrY)
{
bool movedOrAttacked = false;
bool didNinjaMove = false;

int enemyID;
if (PlayerID == 0) enemyID = 1;
else enemyID = 0;

if (GetSelectedUnit())  // assume we are trying to move a piece
{
for (DWORD i = 0; i < GetSelectedUnit()->GetNumAvailableMoves(); i++)
{
TTachMove move = GetSelectedUnit()->GetMove(i);

if ((move.ToPosX == SqrX) && (move.ToPosY == SqrY))
{
if (move.MoveType == TMT_STANDARD)
{
// this could be a move or an attack!!

if (move.Attack || FormMain->Cursor == crCross)
{

// we are attacking another piece!! YES!!!

bool queenTeleportAttack = false;

if ((GetSelectedUnit()->GetType() == TUT_QUEEN) && (FormMain->Cursor != crCross))
{
int dx = SqrX - GetSelectedUnit()->GetPosX();
int dy = SqrY - GetSelectedUnit()->GetPosY();
if ((dx <= 1) && (dy <= 1)) {
queenTeleportAttack = false;
}
else {
queenTeleportAttack = true;
}
}

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);  //

// check for queen wish attack
if (FormMain->Cursor == crCross)
{
if (enemyUnit) enemyUnit->GetQueenWishAttacked(*GetSelectedUnit(), 2.5f);

TTachUnit* u = m_Players[enemyID].GetUnit(SqrX-1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 2.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX-1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY-1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
u = m_Players[enemyID].GetUnit(SqrX+1, SqrY+1);
if (u) u->GetQueenWishAttacked(*GetSelectedUnit(), 1.0f);
FormMain->Cursor = crDefault;

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}

if (enemyUnit)
{
if ((enemyUnit->GetType() == TUT_KING) && (GetSelectedUnit()->GetType() == TUT_PAWN))     // check for single move checkmate
{                                                                                         //  ] END OF GAME [
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
movedOrAttacked = true;
break;
}
else if (queenTeleportAttack) {                      // check for queen teleport attack
enemyUnit->GetTeleportAttacked(*GetSelectedUnit());
}
else {                                              // check for all other TMT_STANDARD attacks
enemyUnit->GetAttacked(*GetSelectedUnit());   // this is where most of the attacks happen
}

if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}

m_Players[0].PurgeDeadUnits();
m_Players[1].PurgeDeadUnits();
movedOrAttacked = true;
break;
}
}
else
{
/// this is just a move.

GetSelectedUnit()->MoveToPos(SqrX, SqrY, this);
if (m_NumNinjaMoves > 0) {
m_NumNinjaMoves--;
didNinjaMove = true;
}
movedOrAttacked = true;
break;
}
}
else if (move.MoveType == TMT_BOMB)
{
// bomb the square
//...

TTachUnit* enemyUnit = m_Players[enemyID].GetUnit(SqrX, SqrY);

if (enemyUnit)
{
enemyUnit->GetBombed();
m_Players[enemyID].PurgeDeadUnits();
}
FormMain->BombNoise();
movedOrAttacked = true;
break;
}
}
}
}

if (movedOrAttacked == false)  // assume we are trying to select something else
{
if (m_NumNinjaMoves == 0) {
SelectUnit(SqrX, SqrY);
}
}

//-----------------------------------------------------

// CHECK FOR THE OTHER END OF GAME STATES  (THERE IS ONE ABOVE) //

// check for dead king

if (m_Players[enemyID].KingIsDead()) {
FormMain->DeclareEndOfGame(false, GetCurrentPlayer()->GetName());
}

// check for K vs K draw

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingIsLeft()) {
FormMain->DeclareEndOfGame(true, "");
}

// check for KQ vs K win

if (m_Players[0].OnlyKingIsLeft() && m_Players[1].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[1].GetName());
}
else if (m_Players[1].OnlyKingIsLeft() && m_Players[0].OnlyKingAndQueenAreLeft()) {
FormMain->DeclareEndOfGame(false, m_Players[0].GetName());
}

//-----------------------------------------------------
// hand control to next player
if (movedOrAttacked)
{
if (didNinjaMove && m_NumNinjaMoves > 0)
{
if (FormMain->Menu_BlackBoxEnabled->Checked) {
FormMain->SaveBlackboxData();
}
}

// SEND GAME TO OTHER PC (NETWORK) HERE

RandomlyAddPowerup();
IncrementNumMoves();
FormMain->SendMove();


//----
if (m_NumNinjaMoves == 0)
{
HandControlToNextPlayer();
//FormMain->SendNextPlayer();
}
}
}
//---------------------------------------------------------------------------


(don't)

That looks more the code of a naive or inexperienced dev rather than a nontechnical one. ;)

A nontechnical dev would be more along the lines of someone who has little to no knowledge of hardware and memory. They aren't able to do things like specify struct alignments, custom allocators, inline asm, specifying calling conventions, and all the other things C/C++ gives you control over. They're more along the lines of artists where they know in manipulating control flow and tweaking values to get things to look and feel the way they want.
u/kotu November 14, 2016, 08:51:09 PM
that's fine

we'll end the discussion here if you like.


*edit*
to clarify this guy just got sacked from his job [obscene] <<_____ other,une  8)

I would say someone who had little or no knowledge of hardware and memory would be an inexperienced dev.  HARDCORE


*edit--*


Quote from: Scipi on November 14, 2016, 04:09:25 PM
I hold that C++ builder is rather pointless. If you need rapid development with tools for potentially non-technical devs, you shouldn't be using C++. If you need precise power and low level memory access/optimizations you shouldn't be using a builder. Both halves of the tool are fine on their own, but there's really no use case for having both.

im done
Last Edit: November 14, 2016, 09:21:06 PM by kotu
u/Dream of Omnimaga November 14, 2016, 10:38:41 PM
Personally I think it's a matter of preference.
u/p2 November 15, 2016, 12:33:21 PM
That's seriously a 100year licence...?  :ninja:
don't all copyrights void 25years after the author's death...?  ???
And do they seriously believe we weould still use that stuff in 100 years? OR are they just trolling us there?  <_<
u/Dream of Omnimaga November 16, 2016, 01:42:50 AM
It depends of the country I believe.
u/xMarminq_ November 16, 2016, 01:44:06 AM
Quote from: p2 on November 15, 2016, 12:33:21 PM
That's seriously a 100year licence...?  :ninja:
don't all copyrights void 25years after the author's death...?  ???
And do they seriously believe we weould still use that stuff in 100 years? OR are they just trolling us there?  <_<

You have to thank Walt Disney and its lobbyists for keeping the rights to Mickey Mouz for boosting it up that high.
But keep on track  :D
u/p2 November 16, 2016, 07:38:53 AM
can't wait for someone going to yail for pirating a 99year old software ;D
but sadly won't see that happening anymore ._.
u/kotu November 25, 2016, 03:32:40 AM
Quote from: p2 on November 15, 2016, 12:33:21 PM
That's seriously a 100year licence...?  :ninja:
i have 89 years and 10 months remaining on mine
u/p2 November 25, 2016, 09:24:40 AM
you should ask them fi you could split it up to use it on 100 devices for 1 year each ;D
Start a Discussion

b/PC, Mac & Vintage Computers

Computer programming discussion and project showcase

132
Topics
Explore Board
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal