Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1feeea6
commit cfa92aa
Showing
4 changed files
with
767 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (C) 2020 Érico Vieira Porto | ||
* | ||
* This program is free software. You can use and redistribute it | ||
* under the terms and conditions of the MIT License (see LICENCE). | ||
*/ | ||
|
||
#include <cmath> | ||
#include "AgsImGuiStyle.h" | ||
|
||
|
||
//------------------------------------------------------------------------------ | ||
|
||
extern IAGSEngine* engine; | ||
|
||
AgsImGuiStyleInterface AgsImGuiStyle_Interface; | ||
AgsImGuiStyleReader AgsImGuiStyle_Reader; | ||
|
||
const char* AgsImGuiStyleInterface::name = "ImGuiStyle"; | ||
|
||
//------------------------------------------------------------------------------ | ||
#include "SerialHelper.h" | ||
using namespace SerialHelper; | ||
|
||
int AgsImGuiStyleInterface::Dispose(const char* address, bool force) | ||
{ | ||
delete ((AgsImGuiStyle*)address); | ||
return (1); | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
int AgsImGuiStyleInterface::Serialize(const char* address, char* buffer, int bufsize) | ||
{ | ||
AgsImGuiStyle* agsImGuiStyle = (AgsImGuiStyle*)address; | ||
char* ptr = buffer; | ||
char* end = buffer + bufsize; | ||
|
||
|
||
return (ptr - buffer); | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
void AgsImGuiStyleReader::Unserialize(int key, const char* serializedData, int dataSize) | ||
{ | ||
char* ptr = (char*) serializedData; | ||
|
||
float val_x; | ||
float val_y; | ||
|
||
|
||
AgsImGuiStyle* agsImGuiStyle = new AgsImGuiStyle(key); | ||
|
||
engine->RegisterUnserializedObject(key, agsImGuiStyle, &AgsImGuiStyle_Interface); | ||
} | ||
|
||
//.............................................................................. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright (C) 2020 Érico Vieira Porto | ||
* | ||
* This program is free software. You can use and redistribute it | ||
* under the terms and conditions of the MIT License (see LICENCE). | ||
*/ | ||
|
||
#pragma once | ||
|
||
#ifndef _AGSIMGUISTYLE_H | ||
#define _AGSIMGUISTYLE_H | ||
|
||
#include "plugin/agsplugin.h" | ||
#include "imgui/imgui.h" | ||
|
||
struct AgsImGuiStyle: ImGuiStyle { | ||
public : | ||
int id; | ||
AgsImGuiStyle() | ||
: ImGuiStyle(){ | ||
id = -1; | ||
} | ||
|
||
AgsImGuiStyle(int _id) | ||
: ImGuiStyle(){ | ||
id = _id; | ||
} | ||
}; | ||
|
||
//------------------------------------------------------------------------------ | ||
// AGS interface instances | ||
|
||
class AgsImGuiStyleInterface : public IAGSScriptManagedObject | ||
{ | ||
public: | ||
static const char* name; | ||
|
||
AgsImGuiStyleInterface() {}; | ||
|
||
virtual int Dispose(const char* address, bool force); | ||
virtual const char* GetType() { return (name); } | ||
virtual int Serialize(const char* address, char* buffer, int bufsize); | ||
|
||
}; | ||
|
||
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
|
||
class AgsImGuiStyleReader : public IAGSManagedObjectReader | ||
{ | ||
public: | ||
|
||
AgsImGuiStyleReader() {} | ||
|
||
virtual void Unserialize(int key, const char* serializedData, int dataSize); | ||
|
||
}; | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
extern AgsImGuiStyleInterface AgsImGuiStyle_Interface; | ||
extern AgsImGuiStyleReader AgsImGuiStyle_Reader; | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
#endif /* _AGSIMGUISTYLE_H */ | ||
|
||
//............ |
Oops, something went wrong.